Merge branch 'statico-statico-icons' into v1-dev

This commit is contained in:
Jamie Newbon 2020-01-21 16:15:03 +00:00
commit e7263ae763
14 changed files with 101 additions and 4 deletions

View file

@ -11,6 +11,11 @@ file (GLOB LEGACY_GUI_UI_FILES src/*.ui)
file (GLOB LEGACY_ACTIVATION_FILES src/*Activation* src/*License*)
file (GLOB LEGACY_ZEROCONF_FILES src/Zeroconf*)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
file (GLOB LEGACY_GUI_MAC_SOURCE_FILES src/*.mm)
list (APPEND LEGACY_GUI_SOURCE_FILES ${LEGACY_GUI_MAC_SOURCE_FILES})
endif()
if (SYNERGY_ENTERPRISE)
list (REMOVE_ITEM LEGACY_GUI_SOURCE_FILES ${LEGACY_ACTIVATION_FILES})
list (REMOVE_ITEM LEGACY_GUI_UI_FILES ${LEGACY_ACTIVATION_FILES})

View file

@ -127,6 +127,8 @@ macx {
QSYNERGY_ICON.path = Contents/Resources
QMAKE_BUNDLE_DATA += QSYNERGY_ICON
LIBS += $$MACX_LIBS
HEADERS += src/OSXHelpers.h
SOURCES += src/OSXHelpers.mm
}
unix:!macx:LIBS += -ldns_sd
debug {

View file

@ -54,6 +54,11 @@
<file>image/spinning-wheel.gif</file>
<file>icons/16x16/padlock.png</file>
<file>icons/16x16/synergy-transfering.png</file>
<file>icons/16x16/auto-config.png</file>
<file>icons/64x64/synergy-dark-transfering.png</file>
<file>icons/64x64/synergy-dark-disconnected.png</file>
<file>icons/64x64/synergy-dark-connected.png</file>
<file>icons/64x64/synergy-light-transfering.png</file>
<file>icons/64x64/synergy-light-disconnected.png</file>
<file>icons/64x64/synergy-light-connected.png</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

View file

@ -36,6 +36,10 @@
#include "SslCertificate.h"
#include "Zeroconf.h"
#if defined(Q_OS_MAC)
#include "OSXHelpers.h"
#endif
#include <QtCore>
#include <QtGui>
#include <QtNetwork>
@ -63,7 +67,25 @@ static const char* tlsCheckString = "network encryption protocol: ";
static const int debugLogLevel = 1;
static const char* synergyIconFiles[] =
static const char* synergyLightIconFiles[] =
{
":/res/icons/64x64/synergy-light-disconnected.png",
":/res/icons/64x64/synergy-light-disconnected.png",
":/res/icons/64x64/synergy-light-connected.png",
":/res/icons/64x64/synergy-light-transfering.png",
":/res/icons/64x64/synergy-light-disconnected.png"
};
static const char* synergyDarkIconFiles[] =
{
":/res/icons/64x64/synergy-dark-disconnected.png",
":/res/icons/64x64/synergy-dark-disconnected.png",
":/res/icons/64x64/synergy-dark-connected.png",
":/res/icons/64x64/synergy-dark-transfering.png",
":/res/icons/64x64/synergy-dark-disconnected.png" //synergyPendingRetry
};
static const char* synergyDefaultIconFiles[] =
{
":/res/icons/16x16/synergy-disconnected.png", //synergyDisconnected
":/res/icons/16x16/synergy-disconnected.png", //synergyConnecting
@ -333,7 +355,15 @@ void MainWindow::saveSettings()
void MainWindow::setIcon(qSynergyState state)
{
QIcon icon;
icon.addFile(synergyIconFiles[state]);
#ifdef Q_OS_MAC
if (isOSXInterfaceStyleDark())
icon.addFile(synergyDarkIconFiles[state]);
else
icon.addFile(synergyLightIconFiles[state]);
#else
icon.addFile(synergyDefaultIconFiles[state]);
#endif
if (m_pTrayIcon)
m_pTrayIcon->setIcon(icon);
@ -528,7 +558,7 @@ void MainWindow::checkSecureSocket(const QString& line)
//Get the protocol version from the line
m_SecureSocketVersion = line.mid(index + strlen(tlsCheckString));
}
}
}
QString MainWindow::getTimeStamp()
{

24
src/gui/src/OSXHelpers.h Normal file
View file

@ -0,0 +1,24 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(OSXHELPERS__H)
#define OSXHELPERS__H
bool isOSXInterfaceStyleDark();
#endif

31
src/gui/src/OSXHelpers.mm Normal file
View file

@ -0,0 +1,31 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#import "OSXHelpers.h"
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import <Cocoa/Cocoa.h>
bool
isOSXInterfaceStyleDark()
{
// Implementation from http://stackoverflow.com/a/26472651
NSDictionary* dict = [[NSUserDefaults standardUserDefaults] persistentDomainForName:NSGlobalDomain];
id style = [dict objectForKey:@"AppleInterfaceStyle"];
return (style && [style isKindOfClass:[NSString class]] && NSOrderedSame == [style caseInsensitiveCompare:@"dark"]);
}