mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 11:35:56 +00:00
fix: don't show tray message twice
This commit is contained in:
parent
e981a17839
commit
880f383569
3 changed files with 15 additions and 4 deletions
|
@ -272,10 +272,15 @@ void Dialog::slotActivated(QSystemTrayIcon::ActivationReason reason)
|
|||
void Dialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
this->hide();
|
||||
m_hideIcon->showMessage(tr("Notice"),
|
||||
tr("Hidden here!"),
|
||||
QSystemTrayIcon::Information,
|
||||
3000);
|
||||
UserBootConfig config = Config::getInstance().getUserBootConfig();
|
||||
if (!config.trayMessageShown) {
|
||||
config.trayMessageShown = true;
|
||||
m_hideIcon->showMessage(tr("Notice"),
|
||||
tr("Hidden here!"),
|
||||
QSystemTrayIcon::Information,
|
||||
3000);
|
||||
}
|
||||
Config::getInstance().setUserBootConfig(config);
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
|
|
|
@ -93,6 +93,9 @@
|
|||
#define COMMON_AUTO_UPDATE_DEVICE_KEY "AutoUpdateDevice"
|
||||
#define COMMON_AUTO_UPDATE_DEVICE_DEF true
|
||||
|
||||
#define COMMON_TRAY_MESSAGE_SHOWN_KEY "TrayMessageShown"
|
||||
#define COMMON_TRAY_MESSAGE_SHOWN_DEF false
|
||||
|
||||
// device config
|
||||
#define SERIAL_WINDOW_RECT_KEY_X "WindowRectX"
|
||||
#define SERIAL_WINDOW_RECT_KEY_Y "WindowRectY"
|
||||
|
@ -160,6 +163,7 @@ void Config::setUserBootConfig(const UserBootConfig &config)
|
|||
m_userData->setValue(COMMON_KEEP_ALIVE_KEY, config.keepAlive);
|
||||
m_userData->setValue(COMMON_SIMPLE_MODE_KEY, config.simpleMode);
|
||||
m_userData->setValue(COMMON_AUTO_UPDATE_DEVICE_KEY, config.autoUpdateDevice);
|
||||
m_userData->setValue(COMMON_TRAY_MESSAGE_SHOWN_KEY, config.trayMessageShown);
|
||||
m_userData->endGroup();
|
||||
m_userData->sync();
|
||||
}
|
||||
|
@ -183,6 +187,7 @@ UserBootConfig Config::getUserBootConfig()
|
|||
config.keepAlive = m_userData->value(COMMON_KEEP_ALIVE_KEY, COMMON_KEEP_ALIVE_DEF).toBool();
|
||||
config.simpleMode = m_userData->value(COMMON_SIMPLE_MODE_KEY, COMMON_SIMPLE_MODE_DEF).toBool();
|
||||
config.autoUpdateDevice = m_userData->value(COMMON_AUTO_UPDATE_DEVICE_KEY, COMMON_AUTO_UPDATE_DEVICE_DEF).toBool();
|
||||
config.trayMessageShown = m_userData->value(COMMON_TRAY_MESSAGE_SHOWN_KEY, COMMON_TRAY_MESSAGE_SHOWN_DEF).toBool();
|
||||
m_userData->endGroup();
|
||||
return config;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ struct UserBootConfig
|
|||
bool keepAlive = false;
|
||||
bool simpleMode = false;
|
||||
bool autoUpdateDevice = true;
|
||||
bool trayMessageShown = false;
|
||||
};
|
||||
|
||||
class QSettings;
|
||||
|
|
Loading…
Add table
Reference in a new issue