changeset 2458:74d73990ac1d background-mode

Toward Windows background-mode support
author Chris Cannam
date Fri, 17 Jan 2020 21:43:40 +0000
parents a94b289f0b93
children fa64df27fc16
files main/main.cpp noconfig.pri repoint-lock.json repoint-project.json
diffstat 4 files changed, 44 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/main/main.cpp	Fri Jan 17 13:51:22 2020 +0000
+++ b/main/main.cpp	Fri Jan 17 21:43:40 2020 +0000
@@ -44,6 +44,8 @@
 #include <QFileOpenEvent>
 #include <QCommandLineParser>
 #include <QSslSocket>
+#include <QFont>
+#include <QFontInfo>
 
 #include <iostream>
 #include <signal.h>
@@ -322,6 +324,30 @@
 
     QSettings settings;
 
+    QString language = QLocale::system().name();
+    SVDEBUG << "System language is: " << language << endl;
+
+    settings.beginGroup("Preferences");
+    QString prefLanguage = settings.value("locale", language).toString();
+    if (prefLanguage != QString()) language = prefLanguage;
+    settings.endGroup();
+
+    settings.beginGroup("Preferences");
+    if (!(settings.value("always-use-default-font", false).toBool())) {
+#ifdef Q_OS_WIN32
+        if (!language.startsWith("ru_")) { // + any future non-Latin i18ns
+            QFont font(QApplication::font());
+            QString preferredFamily = "Segoe UI";
+            font.setFamily(preferredFamily);
+            if (QFontInfo(font).family() == preferredFamily) {
+                font.setPointSize(9);
+                QApplication::setFont(font);
+            }
+        }
+#endif
+    }
+    settings.endGroup();
+
     settings.beginGroup("Preferences");
     // Default to using Piper server; can change in preferences
     if (!settings.contains("run-vamp-plugins-in-process")) {
@@ -355,14 +381,6 @@
     }
     QApplication::setWindowIcon(icon);
 
-    QString language = QLocale::system().name();
-    SVDEBUG << "System language is: " << language << endl;
-
-    settings.beginGroup("Preferences");
-    QString prefLanguage = settings.value("locale", language).toString();
-    if (prefLanguage != QString()) language = prefLanguage;
-    settings.endGroup();
-
     QTranslator qtTranslator;
     QString qtTrName = QString("qt_%1").arg(language);
     SVDEBUG << "Loading " << qtTrName << "... ";
--- a/noconfig.pri	Fri Jan 17 13:51:22 2020 +0000
+++ b/noconfig.pri	Fri Jan 17 21:43:40 2020 +0000
@@ -1,5 +1,11 @@
 
-CONFIG += c++14
+win32-msvc* {
+    # Necessary for WinRT header used to determine background colour
+    CONFIG += c++17
+}
+!win32-msvc* {
+    CONFIG += c++14
+}
 
 CONFIG += release
 #CONFIG += debug
@@ -97,7 +103,7 @@
             -L$$PWD/sv-dependency-builds/win64-msvc/lib
     }
 
-    DEFINES += NOMINMAX _USE_MATH_DEFINES CAPNP_LITE HAVE_MEDIAFOUNDATION
+    DEFINES += NOMINMAX _USE_MATH_DEFINES CAPNP_LITE HAVE_MEDIAFOUNDATION _HAS_STD_BYTE=0
 
     QMAKE_CXXFLAGS_RELEASE += -fp:fast -gl
     QMAKE_LFLAGS_RELEASE += -ltcg
@@ -111,8 +117,10 @@
     # Don't have liblo
     DEFINES -= HAVE_LIBLO
     LIBS -= -llo
+
+##!!! WindowsApp seems to be win10-specific! can I avoid this?
     
-    LIBS += -lmfplat -lmfreadwrite -lmfuuid -lpropsys -ladvapi32 -lwinmm -lws2_32
+    LIBS += -lWindowsApp -lmfplat -lmfreadwrite -lmfuuid -lpropsys -ladvapi32 -lwinmm -lws2_32
 }
 
 macx* {
--- a/repoint-lock.json	Fri Jan 17 13:51:22 2020 +0000
+++ b/repoint-lock.json	Fri Jan 17 21:43:40 2020 +0000
@@ -4,13 +4,13 @@
       "pin": "c42e50a5c297"
     },
     "svcore": {
-      "pin": "23d5cb3f9f38"
+      "pin": "c5ee0746bdef"
     },
     "svgui": {
-      "pin": "4e466690bf20"
+      "pin": "dd7166cdf6bc"
     },
     "svapp": {
-      "pin": "c980a0300c58"
+      "pin": "a39538eaed9d"
     },
     "checker": {
       "pin": "ef64b3f171d9"
--- a/repoint-project.json	Fri Jan 17 13:51:22 2020 +0000
+++ b/repoint-project.json	Fri Jan 17 21:43:40 2020 +0000
@@ -16,11 +16,13 @@
         },
         "svcore": {
             "vcs": "hg",
-            "service": "soundsoftware"
+            "service": "soundsoftware",
+            "branch": "background-mode"
         },
         "svgui": {
             "vcs": "hg",
-            "service": "soundsoftware"
+            "service": "soundsoftware",
+            "branch": "background-mode"
         },
         "svapp": {
             "vcs": "hg",