mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 03:25:02 +00:00
Merge pull request #770 from FrzMtrsprt/kill_tray_message
fix: don't show tray message twice
This commit is contained in:
commit
cec31a6f67
3 changed files with 29 additions and 4 deletions
|
@ -272,10 +272,13 @@ void Dialog::slotActivated(QSystemTrayIcon::ActivationReason reason)
|
|||
void Dialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
this->hide();
|
||||
m_hideIcon->showMessage(tr("Notice"),
|
||||
tr("Hidden here!"),
|
||||
QSystemTrayIcon::Information,
|
||||
3000);
|
||||
if (!Config::getInstance().getTrayMessageShown()) {
|
||||
Config::getInstance().setTrayMessageShown(true);
|
||||
m_hideIcon->showMessage(tr("Notice"),
|
||||
tr("Hidden here!"),
|
||||
QSystemTrayIcon::Information,
|
||||
3000);
|
||||
}
|
||||
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"
|
||||
|
@ -187,6 +190,23 @@ UserBootConfig Config::getUserBootConfig()
|
|||
return config;
|
||||
}
|
||||
|
||||
void Config::setTrayMessageShown(bool shown)
|
||||
{
|
||||
m_userData->beginGroup(GROUP_COMMON);
|
||||
m_userData->setValue(COMMON_TRAY_MESSAGE_SHOWN_KEY, shown);
|
||||
m_userData->endGroup();
|
||||
m_userData->sync();
|
||||
}
|
||||
|
||||
bool Config::getTrayMessageShown()
|
||||
{
|
||||
bool shown;
|
||||
m_userData->beginGroup(GROUP_COMMON);
|
||||
shown = m_userData->value(COMMON_TRAY_MESSAGE_SHOWN_KEY, COMMON_TRAY_MESSAGE_SHOWN_DEF).toBool();
|
||||
m_userData->endGroup();
|
||||
return shown;
|
||||
}
|
||||
|
||||
void Config::setRect(const QString &serial, const QRect &rc)
|
||||
{
|
||||
m_userData->beginGroup(serial);
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
// user data:common
|
||||
void setUserBootConfig(const UserBootConfig &config);
|
||||
UserBootConfig getUserBootConfig();
|
||||
void setTrayMessageShown(bool shown);
|
||||
bool getTrayMessageShown();
|
||||
|
||||
// user data:device
|
||||
void setNickName(const QString &serial, const QString &name);
|
||||
|
|
Loading…
Add table
Reference in a new issue