qt_themes: add themed connected/disconnected icons for dark and fix status bar theme updating

In dark theme, it is very hard to see the connected/disconnected icons because they are dark too. So I added two white-coloured icons for the dark theme. This also fixed an issue where theme update does not change the icon on the status bar.
This commit is contained in:
zhupengfei 2018-07-27 10:51:33 +08:00
parent 4a3c4f5f67
commit b1bbe0441e
No known key found for this signature in database
GPG key ID: 85B82A3E62174206
6 changed files with 13 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

View file

@ -1,6 +1,8 @@
<RCC> <RCC>
<qresource prefix="icons/qdarkstyle"> <qresource prefix="icons/qdarkstyle">
<file alias="index.theme">icons/index.theme</file> <file alias="index.theme">icons/index.theme</file>
<file alias="16x16/connected.png">icons/16x16/connected.png</file>
<file alias="16x16/disconnected.png">icons/16x16/disconnected.png</file>
<file alias="16x16/lock.png">icons/16x16/lock.png</file> <file alias="16x16/lock.png">icons/16x16/lock.png</file>
<file alias="48x48/bad_folder.png">icons/48x48/bad_folder.png</file> <file alias="48x48/bad_folder.png">icons/48x48/bad_folder.png</file>
<file alias="48x48/chip.png">icons/48x48/chip.png</file> <file alias="48x48/chip.png">icons/48x48/chip.png</file>

View file

@ -440,6 +440,8 @@ void GMainWindow::ConnectWidgetEvents() {
connect(this, &GMainWindow::UpdateProgress, this, &GMainWindow::OnUpdateProgress); connect(this, &GMainWindow::UpdateProgress, this, &GMainWindow::OnUpdateProgress);
connect(this, &GMainWindow::CIAInstallReport, this, &GMainWindow::OnCIAInstallReport); connect(this, &GMainWindow::CIAInstallReport, this, &GMainWindow::OnCIAInstallReport);
connect(this, &GMainWindow::CIAInstallFinished, this, &GMainWindow::OnCIAInstallFinished); connect(this, &GMainWindow::CIAInstallFinished, this, &GMainWindow::OnCIAInstallFinished);
connect(this, &GMainWindow::UpdateThemedIcons, multiplayer_state,
&MultiplayerState::UpdateThemedIcons);
} }
void GMainWindow::ConnectMenuEvents() { void GMainWindow::ConnectMenuEvents() {

View file

@ -134,6 +134,14 @@ void MultiplayerState::OnAnnounceFailed(const Common::WebResult& result) {
QMessageBox::Ok); QMessageBox::Ok);
} }
void MultiplayerState::UpdateThemedIcons() {
if (current_state == Network::RoomMember::State::Joined) {
status_icon->setPixmap(QIcon::fromTheme("connected").pixmap(16));
} else {
status_icon->setPixmap(QIcon::fromTheme("disconnected").pixmap(16));
}
}
static void BringWidgetToFront(QWidget* widget) { static void BringWidgetToFront(QWidget* widget) {
widget->show(); widget->show();
widget->activateWindow(); widget->activateWindow();

View file

@ -46,6 +46,7 @@ public slots:
void OnOpenNetworkRoom(); void OnOpenNetworkRoom();
void OnDirectConnectToRoom(); void OnDirectConnectToRoom();
void OnAnnounceFailed(const Common::WebResult&); void OnAnnounceFailed(const Common::WebResult&);
void UpdateThemedIcons();
signals: signals:
void NetworkStateChanged(const Network::RoomMember::State&); void NetworkStateChanged(const Network::RoomMember::State&);