Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions vkconfig_gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include <cassert>

MainWindow::MainWindow(QApplication &app, QWidget *parent)
: QMainWindow(parent), _tray_icon(nullptr), app(app), ui(new Ui::MainWindow) {
: QMainWindow(parent), _tray_icon(new QSystemTrayIcon(this)), app(app), ui(new Ui::MainWindow) {
ui->setupUi(this);

this->tabs[TAB_DIAGNOSTIC].reset(new TabDiagnostics(*this, ui));
Expand Down Expand Up @@ -111,6 +111,7 @@ void MainWindow::UpdateUI_Status() {
// Device
{
QMenu *menu = new QMenu(this);

QSignalMapper *mapper_device = new QSignalMapper(menu);
QSignalMapper *mapper_layers = new QSignalMapper(menu);

Expand Down Expand Up @@ -194,20 +195,23 @@ void MainWindow::UpdateUI_Status() {
this->connect(tray_quit_action, &QAction::triggered, qApp, &QCoreApplication::quit);
menu->addAction(tray_quit_action);

if (this->_tray_icon != nullptr) {
delete this->_tray_icon;
if (VKC_PLATFORM == PLATFORM_LINUX) {
if (this->_tray_icon != nullptr) {
delete this->_tray_icon;
}
this->_tray_icon = new QSystemTrayIcon(this);
}

this->_tray_icon = new QSystemTrayIcon(this);
this->_tray_icon->setContextMenu(menu);
this->_tray_icon->show();
this->connect(this->_tray_icon, &QSystemTrayIcon::activated, this, &MainWindow::OnIconActivated);

if (configurator.layers_override_enabled || configurator.driver_override_enabled || configurator.loader_log_enabled) {
this->_tray_icon->setIcon(QIcon(":/resourcefiles/vkconfig-on.png"));
} else {
this->_tray_icon->setIcon(QIcon(":/resourcefiles/vkconfig-off.png"));
}

this->_tray_icon->show();
}
}

Expand Down Expand Up @@ -384,7 +388,6 @@ void MainWindow::OnTrayActionOverrideLayers(bool toggled) {
configurator.Override(OVERRIDE_AREA_ALL);

this->tabs[TAB_CONFIGURATIONS]->UpdateUI(UPDATE_REBUILD_UI);
this->UpdateUI(UPDATE_REBUILD_UI);
}

void MainWindow::OnLayersChanged(int index) {
Expand All @@ -393,7 +396,6 @@ void MainWindow::OnLayersChanged(int index) {
configurator.Override(OVERRIDE_AREA_ALL);

this->tabs[TAB_CONFIGURATIONS]->UpdateUI(UPDATE_REBUILD_UI);
this->UpdateUI(UPDATE_REBUILD_UI);
}

void MainWindow::OnTrayActionOverrideDevice(bool toggled) {
Expand All @@ -403,7 +405,6 @@ void MainWindow::OnTrayActionOverrideDevice(bool toggled) {
configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT);

this->tabs[TAB_DRIVERS]->UpdateUI(UPDATE_REBUILD_UI);
this->UpdateUI(UPDATE_REBUILD_UI);
}

void MainWindow::OnDeviceChanged(int index) {
Expand All @@ -412,7 +413,6 @@ void MainWindow::OnDeviceChanged(int index) {
configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT);

this->tabs[TAB_DRIVERS]->UpdateUI(UPDATE_REBUILD_UI);
this->UpdateUI(UPDATE_REBUILD_UI);
}

void MainWindow::OnTrayActionOverrideLog(bool toggled) {
Expand All @@ -421,7 +421,6 @@ void MainWindow::OnTrayActionOverrideLog(bool toggled) {
configurator.Override(OVERRIDE_AREA_LOADER_SETTINGS_BIT);

this->tabs[TAB_DIAGNOSTIC]->UpdateUI(UPDATE_REBUILD_UI);
this->UpdateUI(UPDATE_REBUILD_UI);
}

/// The only thing we need to do here is clear the configuration if
Expand Down
Loading