Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Elisa
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
11
Merge Requests
11
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Multimedia
Elisa
Commits
526efc1b
Commit
526efc1b
authored
Jul 06, 2020
by
Matthieu Gallien
🎵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a qml singleton type for the c++ backend of configuration dialog
parent
42004039
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
16 deletions
+28
-16
src/elisaqmlplugin.cpp
src/elisaqmlplugin.cpp
+8
-1
src/main.cpp
src/main.cpp
+0
-1
src/qml/ElisaConfigurationDialog.qml
src/qml/ElisaConfigurationDialog.qml
+5
-3
src/qml/FileScanningConfiguration.qml
src/qml/FileScanningConfiguration.qml
+9
-7
src/qml/GeneralConfiguration.qml
src/qml/GeneralConfiguration.qml
+6
-4
No files found.
src/elisaqmlplugin.cpp
View file @
526efc1b
...
...
@@ -174,7 +174,14 @@ void ElisaQmlTestPlugin::registerTypes(const char *uri)
qRegisterMetaType
<
TracksListener
::
TrackDataType
>
(
"TracksListener::TrackDataType"
);
qRegisterMetaType
<
ViewManager
::
IsTreeModelType
>
(
"ViewManager::IsTreeModelType"
);
qRegisterMetaType
<
DataTypes
::
DataType
>
(
"DataTypes::DataType"
);
qmlRegisterUncreatableType
<
ElisaConfigurationDialog
>
(
uri
,
1
,
0
,
"ElisaConfigurationDialog"
,
QStringLiteral
(
"only one and done in c++"
));
qmlRegisterSingletonType
<
ElisaConfigurationDialog
>
(
uri
,
1
,
0
,
"ElisaConfigurationDialog"
,
[](
QQmlEngine
*
engine
,
QJSEngine
*
scriptEngine
)
->
QObject
*
{
Q_UNUSED
(
engine
)
Q_UNUSED
(
scriptEngine
)
return
new
ElisaConfigurationDialog
;
});
qmlRegisterUncreatableType
<
ElisaApplication
>
(
uri
,
1
,
0
,
"ElisaApplication"
,
QStringLiteral
(
"only one and done in c++"
));
qmlRegisterUncreatableMetaObject
(
ElisaUtils
::
staticMetaObject
,
uri
,
1
,
0
,
"ElisaUtils"
,
QStringLiteral
(
"Namespace ElisaUtils"
));
...
...
src/main.cpp
View file @
526efc1b
...
...
@@ -166,7 +166,6 @@ int main(int argc, char *argv[])
myApp
->
setArguments
(
arguments
);
engine
.
rootContext
()
->
setContextProperty
(
QStringLiteral
(
"elisa"
),
myApp
.
release
());
engine
.
rootContext
()
->
setContextProperty
(
QStringLiteral
(
"config"
),
new
ElisaConfigurationDialog
);
engine
.
load
(
QUrl
(
QStringLiteral
(
"qrc:/qml/ElisaMainWindow.qml"
)));
...
...
src/qml/ElisaConfigurationDialog.qml
View file @
526efc1b
...
...
@@ -11,6 +11,8 @@ import QtQuick.Window 2.12
import
QtQml
.
Models
2.3
import
org
.
kde
.
kirigami
2.5
as
Kirigami
import
org
.
kde
.
elisa
1.0
Window
{
id
:
dialog
...
...
@@ -98,7 +100,7 @@ Window {
icon.name
:
'
dialog-ok-apply
'
DialogButtonBox.buttonRole
:
DialogButtonBox
.
ApplyRole
enabled
:
confi
g
.
isDirty
enabled
:
ElisaConfigurationDialo
g
.
isDirty
}
Button
{
...
...
@@ -108,11 +110,11 @@ Window {
}
onAccepted
:
{
confi
g
.
save
()
ElisaConfigurationDialo
g
.
save
()
close
()
}
onApplied
:
confi
g
.
save
()
onApplied
:
ElisaConfigurationDialo
g
.
save
()
onRejected
:
close
()
}
...
...
src/qml/FileScanningConfiguration.qml
View file @
526efc1b
...
...
@@ -10,6 +10,8 @@ import QtQuick.Layouts 1.3
import
QtQml
.
Models
2.3
import
QtQuick
.
Dialogs
1.2
as
Dialogs
import
org
.
kde
.
elisa
1.0
ColumnLayout
{
spacing
:
0
...
...
@@ -18,9 +20,9 @@ ColumnLayout {
text
:
i18n
(
"
Force filesystem indexing
"
)
checked
:
!
confi
g
.
forceUsageOfFastFileSearch
checked
:
!
ElisaConfigurationDialo
g
.
forceUsageOfFastFileSearch
onCheckedChanged
:
confi
g
.
forceUsageOfFastFileSearch
=
!
checked
onCheckedChanged
:
ElisaConfigurationDialo
g
.
forceUsageOfFastFileSearch
=
!
checked
}
Label
{
...
...
@@ -88,9 +90,9 @@ ColumnLayout {
onClicked
:
{
var
oldPaths
=
confi
g
.
rootPath
var
oldPaths
=
ElisaConfigurationDialo
g
.
rootPath
oldPaths
.
splice
(
delegateItem
.
DelegateModel
.
itemsIndex
,
1
)
confi
g
.
rootPath
=
oldPaths
ElisaConfigurationDialo
g
.
rootPath
=
oldPaths
}
}
}
...
...
@@ -108,7 +110,7 @@ ColumnLayout {
clip
:
true
model
:
DelegateModel
{
model
:
confi
g
.
rootPath
model
:
ElisaConfigurationDialo
g
.
rootPath
delegate
:
pathDelegate
}
...
...
@@ -142,9 +144,9 @@ ColumnLayout {
visible
:
false
onAccepted
:
{
var
oldPaths
=
confi
g
.
rootPath
var
oldPaths
=
ElisaConfigurationDialo
g
.
rootPath
oldPaths
.
push
(
fileDialog
.
fileUrls
)
confi
g
.
rootPath
=
oldPaths
ElisaConfigurationDialo
g
.
rootPath
=
oldPaths
}
}
}
...
...
src/qml/GeneralConfiguration.qml
View file @
526efc1b
...
...
@@ -8,6 +8,8 @@ import QtQuick 2.11
import
QtQuick
.
Controls
2.4
import
QtQuick
.
Layouts
1.3
import
org
.
kde
.
elisa
1.0
ColumnLayout
{
spacing
:
0
...
...
@@ -17,18 +19,18 @@ ColumnLayout {
}
CheckBox
{
checked
:
confi
g
.
showProgressInTaskBar
checked
:
ElisaConfigurationDialo
g
.
showProgressInTaskBar
text
:
i18n
(
"
Show progress on Task Manager entries
"
)
onCheckedChanged
:
confi
g
.
showProgressInTaskBar
=
checked
onCheckedChanged
:
ElisaConfigurationDialo
g
.
showProgressInTaskBar
=
checked
}
CheckBox
{
checked
:
confi
g
.
showSystemTrayIcon
checked
:
ElisaConfigurationDialo
g
.
showSystemTrayIcon
text
:
i18n
(
"
Keep running in System Tray when main window is closed
"
)
onToggled
:
confi
g
.
showSystemTrayIcon
=
checked
onToggled
:
ElisaConfigurationDialo
g
.
showSystemTrayIcon
=
checked
}
}
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