Change the tray ico color to indicate if the device is connected.
This commit is contained in:
@@ -7,5 +7,7 @@
|
|||||||
<file>resources/images/psv_icon_16.png</file>
|
<file>resources/images/psv_icon_16.png</file>
|
||||||
<file>resources/images/qcma.png</file>
|
<file>resources/images/qcma.png</file>
|
||||||
<file>resources/images/edit-clear-locationbar-rtl.png</file>
|
<file>resources/images/edit-clear-locationbar-rtl.png</file>
|
||||||
|
<file>resources/images/psv_icon_dc.png</file>
|
||||||
|
<file>resources/images/psv_icon_16_dc.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
resources/images/psv_icon_16_dc.png
Normal file
BIN
resources/images/psv_icon_16_dc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 301 B |
BIN
resources/images/psv_icon_dc.png
Normal file
BIN
resources/images/psv_icon_dc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 336 B |
@@ -77,10 +77,27 @@ void MainWidget::stopServer()
|
|||||||
|
|
||||||
void MainWidget::deviceDisconnect()
|
void MainWidget::deviceDisconnect()
|
||||||
{
|
{
|
||||||
|
#ifndef Q_OS_WIN32
|
||||||
|
trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_dc.png"));
|
||||||
|
#else
|
||||||
|
trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_16_dc.png"));
|
||||||
|
#endif
|
||||||
|
qDebug("Icon changed - disconnected");
|
||||||
setTrayTooltip(tr("Disconnected"));
|
setTrayTooltip(tr("Disconnected"));
|
||||||
receiveMessage(tr("The device has been disconnected"));
|
receiveMessage(tr("The device has been disconnected"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWidget::deviceConnected(QString message)
|
||||||
|
{
|
||||||
|
Q_UNUSED(message);
|
||||||
|
#ifndef Q_OS_WIN32
|
||||||
|
trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon.png"));
|
||||||
|
#else
|
||||||
|
trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_16.png"));
|
||||||
|
#endif
|
||||||
|
qDebug("Icon changed - connected");
|
||||||
|
}
|
||||||
|
|
||||||
void MainWidget::prepareApplication()
|
void MainWidget::prepareApplication()
|
||||||
{
|
{
|
||||||
connectSignals();
|
connectSignals();
|
||||||
@@ -92,6 +109,7 @@ void MainWidget::connectSignals()
|
|||||||
{
|
{
|
||||||
connect(&dialog, SIGNAL(finished(int)), this, SLOT(dialogResult(int)));
|
connect(&dialog, SIGNAL(finished(int)), this, SLOT(dialogResult(int)));
|
||||||
connect(&manager, SIGNAL(stopped()), qApp, SLOT(quit()));
|
connect(&manager, SIGNAL(stopped()), qApp, SLOT(quit()));
|
||||||
|
connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(deviceConnected(QString)));
|
||||||
connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(receiveMessage(QString)));
|
connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(receiveMessage(QString)));
|
||||||
connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(setTrayTooltip(QString)));
|
connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(setTrayTooltip(QString)));
|
||||||
connect(&manager, SIGNAL(deviceDisconnected()), this, SLOT(deviceDisconnect()));
|
connect(&manager, SIGNAL(deviceDisconnected()), this, SLOT(deviceDisconnect()));
|
||||||
@@ -164,9 +182,9 @@ void MainWidget::createTrayIcon()
|
|||||||
trayIcon = new QSystemTrayIcon(this);
|
trayIcon = new QSystemTrayIcon(this);
|
||||||
trayIcon->setContextMenu(trayIconMenu);
|
trayIcon->setContextMenu(trayIconMenu);
|
||||||
#ifndef Q_OS_WIN32
|
#ifndef Q_OS_WIN32
|
||||||
trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon.png"));
|
trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_dc.png"));
|
||||||
#else
|
#else
|
||||||
trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_16.png"));
|
trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_16_dc.png"));
|
||||||
#endif
|
#endif
|
||||||
trayIcon->show();
|
trayIcon->show();
|
||||||
// try to avoid the iconTray Qt bug
|
// try to avoid the iconTray Qt bug
|
||||||
|
@@ -69,6 +69,7 @@ private slots:
|
|||||||
void openManager();
|
void openManager();
|
||||||
void showAboutQt();
|
void showAboutQt();
|
||||||
void showAboutDialog();
|
void showAboutDialog();
|
||||||
|
void deviceConnected(QString message);
|
||||||
void deviceDisconnect();
|
void deviceDisconnect();
|
||||||
void dialogResult(int result);
|
void dialogResult(int result);
|
||||||
void receiveMessage(QString message);
|
void receiveMessage(QString message);
|
||||||
|
Reference in New Issue
Block a user