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
Games
libkdegames
Commits
b0361ff8
Commit
b0361ff8
authored
Nov 11, 2021
by
Oleg Solovyov
🐴
Browse files
Use NewStuff Elements
parent
547e5ce3
Pipeline
#104189
passed with stage
in 1 minute and 1 second
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/kgthemeselector.cpp
View file @
b0361ff8
...
...
@@ -9,7 +9,8 @@
// KF
#include <KLocalizedString>
#include <KNS3/DownloadDialog>
#include <KNS3/Button>
#include <KNS3/Entry>
// Qt
#include <QCloseEvent>
#include <QFont>
...
...
@@ -41,7 +42,7 @@ class KgThemeSelectorPrivate
KgThemeProvider
*
m_provider
;
KgThemeSelector
::
Options
m_options
;
QListWidget
*
m_list
;
QPush
Button
*
m_knsButton
;
KNS3
::
Button
*
m_knsButton
;
void
fillList
();
...
...
@@ -54,7 +55,6 @@ class KgThemeSelectorPrivate
void
_k_updateListSelection
(
const
KgTheme
*
theme
);
void
_k_updateProviderSelection
();
void
_k_showNewStuffDialog
();
};
KgThemeSelector
::
KgThemeSelector
(
KgThemeProvider
*
provider
,
Options
options
,
QWidget
*
parent
)
...
...
@@ -97,14 +97,24 @@ KgThemeSelector::KgThemeSelector(KgThemeProvider* provider, Options options, QWi
//setup KNS button
if
(
options
&
EnableNewStuffDownload
)
{
d
->
m_knsButton
=
new
QPushButton
(
QIcon
::
fromTheme
(
QStringLiteral
(
"get-hot-new-stuff"
)),
i18n
(
"Get New Themes..."
),
this
);
QString
name
=
QCoreApplication
::
applicationName
()
+
QStringLiteral
(
".knsrc"
);
d
->
m_knsButton
=
new
KNS3
::
Button
(
i18n
(
"Get New Themes..."
),
name
,
this
);
QHBoxLayout
*
hLayout
=
new
QHBoxLayout
();
hLayout
->
addStretch
(
1
);
hLayout
->
addWidget
(
d
->
m_knsButton
);
layout
->
addLayout
(
hLayout
);
connect
(
d
->
m_knsButton
,
&
QAbstractButton
::
clicked
,
this
,
[
this
]()
{
d
->
_k_showNewStuffDialog
();
});
// clang-format off
connect
(
d
->
m_knsButton
,
&
KNS3
::
Button
::
dialogFinished
,
[
this
](
const
QList
<
KNS3
::
Entry
>
&
changedEntries
)
{
if
(
!
changedEntries
.
isEmpty
())
{
d
->
m_provider
->
rediscoverThemes
();
d
->
fillList
();
}
// restore previous selection
d
->
_k_updateListSelection
(
d
->
m_provider
->
currentTheme
());
}
);
// clang-format on
}
}
...
...
@@ -163,20 +173,6 @@ void KgThemeSelectorPrivate::_k_updateProviderSelection()
}
}
void
KgThemeSelectorPrivate
::
_k_showNewStuffDialog
()
{
QPointer
<
KNS3
::
DownloadDialog
>
dialog
(
new
KNS3
::
DownloadDialog
(
q
));
dialog
->
exec
();
if
(
dialog
&&
!
dialog
->
changedEntries
().
isEmpty
())
{
m_provider
->
rediscoverThemes
();
fillList
();
}
//restore previous selection
_k_updateListSelection
(
m_provider
->
currentTheme
());
delete
dialog
;
}
class
KgThemeSelector
::
Dialog
:
public
QDialog
{
public:
...
...
Write
Preview
Supports
Markdown
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