Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature for adding multiple magnet links #1313

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions addlink.lfm
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
inherited AddLinkForm: TAddLinkForm
Left = 354
Height = 93
Top = 193
Width = 574
Left = 502
Height = 186
Top = 373
Width = 438
AutoSize = True
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'Add torrent link'
ClientHeight = 93
ClientWidth = 574
ClientHeight = 186
ClientWidth = 438
OnCreate = FormCreate
Position = poMainFormCenter
object Buttons: TButtonPanel[0]
Left = 8
Height = 26
Top = 59
Width = 558
Top = 152
Width = 422
BorderSpacing.Left = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Expand All @@ -35,30 +34,31 @@ inherited AddLinkForm: TAddLinkForm
end
object Panel1: TPanel[1]
Left = 8
Height = 43
Height = 136
Top = 8
Width = 558
Width = 422
Align = alClient
BorderSpacing.Around = 8
BevelOuter = bvNone
ClientHeight = 43
ClientWidth = 558
ClientHeight = 136
ClientWidth = 422
TabOrder = 0
object txLink: TLabel
Left = 0
Height = 14
Height = 15
Top = 0
Width = 183
Caption = 'URL of a .torrent file or a magnet link:'
Width = 267
Caption = 'URL of a .torrent file or a magnet link(one per line):'
ParentColor = False
end
object edLink: TEdit
object meLink: TMemo
Left = 0
Height = 21
Top = 20
Width = 558
Anchors = [akTop, akLeft, akRight]
Height = 115
Top = 21
Width = 422
Anchors = [akTop, akLeft, akRight, akBottom]
TabOrder = 0
WordWrap = False
end
end
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the code patch provided, the following observations can be made:

  • The form's size and position have been changed.
  • The border style has been removed from the form.
  • The Buttons component's top property has been modified to adjust its position based on the new height of the form.
  • A new meLink component (TMemo) has been added to replace the old edLink component (TEdit). The new component allows for multiple lines of input and has a vertical scrollbar that appears when needed.
  • The caption of the txLink label has been updated to reflect that multiple links can be entered.

As far as potential improvements go, this code patch seems to be relatively minor and doesn't introduce any obvious bugs. One suggestion could be to validate input in the meLink component to ensure that only valid .torrent files or magnet links are accepted. Another suggestion could be to add tooltips to help users differentiate between entering a single link versus entering multiple links.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code patch seems to include changes to the visual layout of a form.

Some improvements could be made to improve the user experience, such as labeling the "Add" button more clearly and adding validation to ensure that the user enters a valid URL or magnet link.

There don't appear to be any immediate bug risks in the code. However, it's difficult to assess the quality of the code as a whole without seeing the complete program.

20 changes: 15 additions & 5 deletions addlink.pas
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
along with Transmission Remote GUI; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

In addition, as a special exception, the copyright holders give permission to
In addition, as a special exception, the copyright holders give permission to
link the code of portions of this program with the
OpenSSL library under certain conditions as described in each individual
source file, and distribute linked combinations including the two.
Expand Down Expand Up @@ -48,7 +48,7 @@ interface

TAddLinkForm = class(TBaseForm)
Buttons: TButtonPanel;
edLink: TEdit;
meLink: TMemo;
Panel1: TPanel;
txLink: TLabel;
procedure btOKClick(Sender: TObject);
Expand All @@ -66,10 +66,20 @@ implementation
{ TAddLinkForm }

procedure TAddLinkForm.btOKClick(Sender: TObject);
var
i: integer;
ok: Boolean = false;
begin
edLink.Text:=Trim(edLink.Text);
if edLink.Text = '' then begin
edLink.SetFocus;
for i := meLink.Lines.Count - 1 downto 0 do
begin
meLink.Lines[i]:=Trim(meLink.Lines[i]);
if meLink.Lines[i] <> '' then ok := true // have at least one link
else meLink.Lines.Delete(i); // remove empty lines
end;

if not ok then
begin
meLink.SetFocus;
MessageDlg(SNoLink, mtError, [mbOK], 0);
exit;
end;
Expand Down
26 changes: 17 additions & 9 deletions addtorrent.lfm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inherited AddTorrentForm: TAddTorrentForm
Left = 494
Left = 1165
Height = 457
Top = 276
Top = 360
Width = 508
HorzScrollBar.Page = 505
VertScrollBar.Page = 404
Expand Down Expand Up @@ -75,7 +75,7 @@ inherited AddTorrentForm: TAddTorrentForm
Height = 26
Hint = 'Browse folder'
Top = 13
Width = 91
Width = 88
Anchors = [akTop, akRight]
Caption = 'Browse...'
OnClick = btBrowseClick
Expand All @@ -95,17 +95,17 @@ inherited AddTorrentForm: TAddTorrentForm
Left = 10
Height = 23
Top = 96
Width = 467
Width = 465
Anchors = [akTop, akLeft, akRight]
OnChange = edSaveAsChange
TabOrder = 2
end
object edExtension: TEdit
Left = 8
Left = 10
Height = 23
Hint = 'for example: *.avi *.mkv tom*jerry*.avi'
Top = 56
Width = 467
Width = 465
Anchors = [akTop, akLeft, akRight]
OnChange = edSaveAsChange
ParentShowHint = False
Expand All @@ -117,7 +117,7 @@ inherited AddTorrentForm: TAddTorrentForm
Height = 15
Hint = 'for example: *.avi *.mkv tom*jerry*.avi'
Top = 40
Width = 59
Width = 57
Caption = 'Template: '
ParentColor = False
ParentShowHint = False
Expand Down Expand Up @@ -201,6 +201,14 @@ inherited AddTorrentForm: TAddTorrentForm
ShowHint = True
TabOrder = 5
end
object cbApplyAll: TCheckBox
Left = 10
Height = 19
Top = 127
Width = 80
Caption = 'Apply to all'
TabOrder = 6
end
end
object gbContents: TGroupBox[1]
Left = 8
Expand Down Expand Up @@ -237,12 +245,12 @@ inherited AddTorrentForm: TAddTorrentForm
Top = 40
Width = 467
Anchors = [akTop, akLeft, akRight, akBottom]
Columns = <
Columns = <
item
ReadOnly = True
Title.Caption = 'File name'
Width = 350
end
end
item
ReadOnly = True
Title.Caption = 'Size'
Expand Down
2 changes: 2 additions & 0 deletions addtorrent.pas
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ TFilesTree = class;
{ TAddTorrentForm }

TAddTorrentForm = class(TBaseForm)
cbApplyAll: TCheckBox;
DelButton: TBitBtn;
btSelectAll: TButton;
btSelectNone: TButton;
Expand Down Expand Up @@ -95,6 +96,7 @@ TAddTorrentForm = class(TBaseForm)
procedure TreeStateChanged(Sender: TObject);
procedure UpdateSize;
public
ApplyToAll: boolean;
OrigCaption: string;
Extension : string;
property FilesTree: TFilesTree read FTree;
Expand Down
Loading