Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
17896b1c
Commit
17896b1c
authored
6 years ago
by
Anton Karmanov
Committed by
mujx
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Start in tray (#319)
parent
7d809be7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/UserSettingsPage.h
+9
-0
9 additions, 0 deletions
include/UserSettingsPage.h
src/UserSettingsPage.cc
+28
-0
28 additions, 0 deletions
src/UserSettingsPage.cc
src/main.cc
+4
-1
4 additions, 1 deletion
src/main.cc
with
41 additions
and
1 deletion
include/UserSettingsPage.h
+
9
−
0
View file @
17896b1c
...
...
@@ -46,6 +46,12 @@ public:
save
();
};
void
setStartInTray
(
bool
state
)
{
isStartInTrayEnabled_
=
state
;
save
();
};
void
setRoomOrdering
(
bool
state
)
{
isOrderingEnabled_
=
state
;
...
...
@@ -75,6 +81,7 @@ public:
QString
theme
()
const
{
return
!
theme_
.
isEmpty
()
?
theme_
:
"light"
;
}
bool
isTrayEnabled
()
const
{
return
isTrayEnabled_
;
}
bool
isStartInTrayEnabled
()
const
{
return
isStartInTrayEnabled_
;
}
bool
isOrderingEnabled
()
const
{
return
isOrderingEnabled_
;
}
bool
isGroupViewEnabled
()
const
{
return
isGroupViewEnabled_
;
}
bool
isTypingNotificationsEnabled
()
const
{
return
isTypingNotificationsEnabled_
;
}
...
...
@@ -86,6 +93,7 @@ signals:
private
:
QString
theme_
;
bool
isTrayEnabled_
;
bool
isStartInTrayEnabled_
;
bool
isOrderingEnabled_
;
bool
isGroupViewEnabled_
;
bool
isTypingNotificationsEnabled_
;
...
...
@@ -128,6 +136,7 @@ private:
QSharedPointer
<
UserSettings
>
settings_
;
Toggle
*
trayToggle_
;
Toggle
*
startInTrayToggle_
;
Toggle
*
roomOrderToggle_
;
Toggle
*
groupViewToggle_
;
Toggle
*
typingNotifications_
;
...
...
This diff is collapsed.
Click to expand it.
src/UserSettingsPage.cc
+
28
−
0
View file @
17896b1c
...
...
@@ -37,6 +37,7 @@ UserSettings::load()
{
QSettings
settings
;
isTrayEnabled_
=
settings
.
value
(
"user/window/tray"
,
true
).
toBool
();
isStartInTrayEnabled_
=
settings
.
value
(
"user/window/start_in_tray"
,
false
).
toBool
();
isOrderingEnabled_
=
settings
.
value
(
"user/room_ordering"
,
true
).
toBool
();
isGroupViewEnabled_
=
settings
.
value
(
"user/group_view"
,
true
).
toBool
();
isTypingNotificationsEnabled_
=
settings
.
value
(
"user/typing_notifications"
,
true
).
toBool
();
...
...
@@ -85,6 +86,7 @@ UserSettings::save()
settings
.
beginGroup
(
"window"
);
settings
.
setValue
(
"tray"
,
isTrayEnabled_
);
settings
.
setValue
(
"start_in_tray"
,
isStartInTrayEnabled_
);
settings
.
endGroup
();
settings
.
setValue
(
"room_ordering"
,
isOrderingEnabled_
);
...
...
@@ -140,6 +142,20 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
trayOptionLayout_
->
addWidget
(
trayLabel
);
trayOptionLayout_
->
addWidget
(
trayToggle_
,
0
,
Qt
::
AlignBottom
|
Qt
::
AlignRight
);
auto
startInTrayOptionLayout_
=
new
QHBoxLayout
;
startInTrayOptionLayout_
->
setContentsMargins
(
0
,
OptionMargin
,
0
,
OptionMargin
);
auto
startInTrayLabel
=
new
QLabel
(
tr
(
"Start in tray"
),
this
);
startInTrayToggle_
=
new
Toggle
(
this
);
startInTrayToggle_
->
setActiveColor
(
QColor
(
"#38A3D8"
));
startInTrayToggle_
->
setInactiveColor
(
QColor
(
"gray"
));
if
(
!
settings_
->
isTrayEnabled
())
startInTrayToggle_
->
setDisabled
(
true
);
startInTrayLabel
->
setStyleSheet
(
"font-size: 15px;"
);
startInTrayOptionLayout_
->
addWidget
(
startInTrayLabel
);
startInTrayOptionLayout_
->
addWidget
(
startInTrayToggle_
,
0
,
Qt
::
AlignBottom
|
Qt
::
AlignRight
);
auto
orderRoomLayout
=
new
QHBoxLayout
;
orderRoomLayout
->
setContentsMargins
(
0
,
OptionMargin
,
0
,
OptionMargin
);
auto
orderLabel
=
new
QLabel
(
tr
(
"Re-order rooms based on activity"
),
this
);
...
...
@@ -207,6 +223,8 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
mainLayout_
->
addWidget
(
new
HorizontalLine
(
this
));
mainLayout_
->
addLayout
(
trayOptionLayout_
);
mainLayout_
->
addWidget
(
new
HorizontalLine
(
this
));
mainLayout_
->
addLayout
(
startInTrayOptionLayout_
);
mainLayout_
->
addWidget
(
new
HorizontalLine
(
this
));
mainLayout_
->
addLayout
(
orderRoomLayout
);
mainLayout_
->
addWidget
(
new
HorizontalLine
(
this
));
mainLayout_
->
addLayout
(
groupViewLayout
);
...
...
@@ -228,9 +246,18 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
connect
(
trayToggle_
,
&
Toggle
::
toggled
,
this
,
[
this
](
bool
isDisabled
)
{
settings_
->
setTray
(
!
isDisabled
);
if
(
isDisabled
)
{
startInTrayToggle_
->
setDisabled
(
true
);
}
else
{
startInTrayToggle_
->
setEnabled
(
true
);
}
emit
trayOptionChanged
(
!
isDisabled
);
});
connect
(
startInTrayToggle_
,
&
Toggle
::
toggled
,
this
,
[
this
](
bool
isDisabled
)
{
settings_
->
setStartInTray
(
!
isDisabled
);
});
connect
(
roomOrderToggle_
,
&
Toggle
::
toggled
,
this
,
[
this
](
bool
isDisabled
)
{
settings_
->
setRoomOrdering
(
!
isDisabled
);
});
...
...
@@ -260,6 +287,7 @@ UserSettingsPage::showEvent(QShowEvent *)
// FIXME: Toggle treats true as "off"
trayToggle_
->
setState
(
!
settings_
->
isTrayEnabled
());
startInTrayToggle_
->
setState
(
!
settings_
->
isStartInTrayEnabled
());
roomOrderToggle_
->
setState
(
!
settings_
->
isOrderingEnabled
());
groupViewToggle_
->
setState
(
!
settings_
->
isGroupViewEnabled
());
typingNotifications_
->
setState
(
!
settings_
->
isTypingNotificationsEnabled
());
...
...
This diff is collapsed.
Click to expand it.
src/main.cc
+
4
−
1
View file @
17896b1c
...
...
@@ -160,7 +160,10 @@ main(int argc, char *argv[])
// Move the MainWindow to the center
w
.
move
(
screenCenter
(
w
.
width
(),
w
.
height
()));
w
.
show
();
if
(
!
settings
.
value
(
"user/window/start_in_tray"
,
false
).
toBool
()
||
!
settings
.
value
(
"user/window/tray"
,
true
).
toBool
())
w
.
show
();
QObject
::
connect
(
&
app
,
&
QApplication
::
aboutToQuit
,
&
w
,
&
MainWindow
::
saveCurrentWindowSize
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment