Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KTorrent
Commits
58ec83be
Commit
58ec83be
authored
May 05, 2009
by
Joris Guisson
Browse files
Backport scroll area config dialog stuff from trunk
svn path=/branches/stable/extragear-kde4/network/ktorrent/; revision=963671
parent
012afcd0
Changes
4
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
58ec83be
...
...
@@ -10,6 +10,7 @@ Changes in 3.2.2 :
- Fix bug causing drag and drop of torrent on to plasma desktop not to work
- Increase numwant to 200 and the maximum number of potential peers to 500
- Cancel all scan dialogs before exiting, this fixes a crash (191487)
- Config dialog now embeds pages in scroll areas, so that the dialog also is useable on small screens
Changes in 3.2.1 :
- Resort torrents if display name is changed
...
...
ktorrent/gui.cpp
View file @
58ec83be
...
...
@@ -152,7 +152,10 @@ namespace kt
void
GUI
::
addPrefPage
(
PrefPageInterface
*
page
)
{
if
(
!
pref_dlg
)
{
pref_dlg
=
new
PrefDialog
(
this
,
core
);
pref_dlg
->
loadState
(
KGlobal
::
config
());
}
pref_dlg
->
addPrefPage
(
page
);
}
...
...
@@ -695,6 +698,9 @@ namespace kt
group_view
->
saveState
(
cfg
);
qm
->
saveState
(
cfg
);
ideal
::
MainWindow
::
saveState
(
cfg
);
if
(
pref_dlg
)
pref_dlg
->
saveState
(
cfg
);
cfg
->
sync
();
}
void
GUI
::
currentTorrentChanged
(
bt
::
TorrentInterface
*
tc
)
...
...
ktorrent/prefdialog.cpp
View file @
58ec83be
...
...
@@ -18,6 +18,7 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <klocale.h>
#include <kconfigdialogmanager.h>
...
...
@@ -43,7 +44,6 @@ namespace kt
{
setupUi
(
this
);
}
virtual
~
QMPref
()
{}
void
loadSettings
()
...
...
@@ -135,19 +135,26 @@ namespace kt
void
PrefDialog
::
addPrefPage
(
PrefPageInterface
*
page
)
{
KPageWidgetItem
*
p
=
addPage
(
page
,
page
->
config
(),
page
->
pageName
(),
page
->
pageIcon
());
pages
.
insert
(
page
,
p
);
PrefPageScrollArea
*
area
=
new
PrefPageScrollArea
(
page
,
this
);
KPageWidgetItem
*
p
=
addPage
(
area
,
page
->
config
(),
page
->
pageName
(),
page
->
pageIcon
());
area
->
page_widget_item
=
p
;
pages
.
append
(
area
);
if
(
!
isHidden
())
page
->
loadSettings
();
}
void
PrefDialog
::
removePrefPage
(
PrefPageInterface
*
page
)
{
KPageWidgetItem
*
p
=
pages
.
value
(
page
);
if
(
p
)
foreach
(
PrefPageScrollArea
*
area
,
pages
)
{
removePage
(
p
);
pages
.
remove
(
page
);
if
(
area
->
page
==
page
)
{
area
->
takeWidget
();
pages
.
removeAll
(
area
);
removePage
(
area
->
page_widget_item
);
break
;
}
}
}
...
...
@@ -159,20 +166,20 @@ namespace kt
void
PrefDialog
::
updateWidgets
()
{
foreach
(
PrefPage
Interface
*
p
,
pages
.
keys
()
)
p
->
loadSettings
();
foreach
(
PrefPage
ScrollArea
*
area
,
pages
)
area
->
page
->
loadSettings
();
}
void
PrefDialog
::
updateWidgetsDefault
()
{
foreach
(
PrefPage
Interface
*
p
,
pages
.
keys
()
)
p
->
loadDefaults
();
foreach
(
PrefPage
ScrollArea
*
area
,
pages
)
area
->
page
->
loadDefaults
();
}
void
PrefDialog
::
updateSettings
()
{
foreach
(
PrefPage
Interface
*
p
,
pages
.
keys
()
)
p
->
updateSettings
();
foreach
(
PrefPage
ScrollArea
*
area
,
pages
)
area
->
page
->
updateSettings
();
}
void
PrefDialog
::
calculateRecommendedSettings
()
...
...
@@ -189,6 +196,34 @@ namespace kt
net_pref
->
kcfg_maxTotalConnections
->
setValue
(
dlg
.
max_conn_glob
);
}
}
void
PrefDialog
::
loadState
(
KSharedConfigPtr
cfg
)
{
KConfigGroup
g
=
cfg
->
group
(
"PrefDialog"
);
QSize
s
=
g
.
readEntry
(
"size"
,
sizeHint
());
resize
(
s
);
}
void
PrefDialog
::
saveState
(
KSharedConfigPtr
cfg
)
{
KConfigGroup
g
=
cfg
->
group
(
"PrefDialog"
);
g
.
writeEntry
(
"size"
,
size
());
}
///////////////////////////////////////
PrefPageScrollArea
::
PrefPageScrollArea
(
kt
::
PrefPageInterface
*
page
,
QWidget
*
parent
)
:
QScrollArea
(
parent
),
page
(
page
),
page_widget_item
(
0
)
{
setWidget
(
page
);
setWidgetResizable
(
true
);
setFrameStyle
(
QFrame
::
NoFrame
);
viewport
()
->
setAutoFillBackground
(
false
);
}
PrefPageScrollArea
::~
PrefPageScrollArea
()
{
}
}
...
...
ktorrent/prefdialog.h
View file @
58ec83be
...
...
@@ -21,7 +21,8 @@
#ifndef KT_PREFDIALOG_HH
#define KT_PREFDIALOG_HH
#include <QMap>
#include <QList>
#include <QScrollArea>
#include <kconfigdialog.h>
namespace
kt
...
...
@@ -30,6 +31,7 @@ namespace kt
class
PrefPageInterface
;
class
NetworkPref
;
class
QMPref
;
class
PrefPageScrollArea
;
/**
* KTorrent's preferences dialog, this uses the new KConfigDialog class which should make our live much easier.
...
...
@@ -60,6 +62,16 @@ namespace kt
* Update the widgets and show
*/
void
updateWidgetsAndShow
();
/**
* Load the state of the dialog
*/
void
loadState
(
KSharedConfigPtr
cfg
);
/**
* Save the state of the dialog
*/
void
saveState
(
KSharedConfigPtr
cfg
);
protected:
virtual
void
updateWidgets
();
...
...
@@ -70,10 +82,20 @@ namespace kt
void
calculateRecommendedSettings
();
private:
Q
Map
<
PrefPage
Interface
*
,
KPageWidgetItem
*>
pages
;
Q
List
<
PrefPage
ScrollArea
*>
pages
;
NetworkPref
*
net_pref
;
QMPref
*
qm_pref
;
};
class
PrefPageScrollArea
:
public
QScrollArea
{
public:
PrefPageScrollArea
(
PrefPageInterface
*
page
,
QWidget
*
parent
=
0
);
virtual
~
PrefPageScrollArea
();
PrefPageInterface
*
page
;
KPageWidgetItem
*
page_widget_item
;
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment