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/qcma.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>
 | 
			
		||||
</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()
 | 
			
		||||
{
 | 
			
		||||
#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"));
 | 
			
		||||
    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()
 | 
			
		||||
{
 | 
			
		||||
    connectSignals();
 | 
			
		||||
@@ -92,6 +109,7 @@ void MainWidget::connectSignals()
 | 
			
		||||
{
 | 
			
		||||
    connect(&dialog, SIGNAL(finished(int)), this, SLOT(dialogResult(int)));
 | 
			
		||||
    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(setTrayTooltip(QString)));
 | 
			
		||||
    connect(&manager, SIGNAL(deviceDisconnected()), this, SLOT(deviceDisconnect()));
 | 
			
		||||
@@ -164,9 +182,9 @@ void MainWidget::createTrayIcon()
 | 
			
		||||
    trayIcon = new QSystemTrayIcon(this);
 | 
			
		||||
    trayIcon->setContextMenu(trayIconMenu);
 | 
			
		||||
#ifndef Q_OS_WIN32
 | 
			
		||||
    trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon.png"));
 | 
			
		||||
    trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_dc.png"));
 | 
			
		||||
#else
 | 
			
		||||
    trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_16.png"));
 | 
			
		||||
    trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_16_dc.png"));
 | 
			
		||||
#endif
 | 
			
		||||
    trayIcon->show();
 | 
			
		||||
    // try to avoid the iconTray Qt bug
 | 
			
		||||
 
 | 
			
		||||
@@ -69,6 +69,7 @@ private slots:
 | 
			
		||||
    void openManager();
 | 
			
		||||
    void showAboutQt();
 | 
			
		||||
    void showAboutDialog();
 | 
			
		||||
    void deviceConnected(QString message);
 | 
			
		||||
    void deviceDisconnect();
 | 
			
		||||
    void dialogResult(int result);
 | 
			
		||||
    void receiveMessage(QString message);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user