|
14 | 14 | #include <iostream>
|
15 | 15 |
|
16 | 16 | #include <QApplication>
|
17 |
| -#include <QSplashScreen> |
18 |
| -#include <QPixmap> |
19 | 17 | #include <QBitmap>
|
20 | 18 | #include <QLabel>
|
21 | 19 | #include <QLibraryInfo>
|
| 20 | +#include <QPixmap> |
| 21 | +#include <QSplashScreen> |
22 | 22 | #include <QThread>
|
23 | 23 |
|
24 | 24 | #include "mainwindow.h"
|
|
31 | 31 | #include "platform/macos.h"
|
32 | 32 | #endif
|
33 | 33 |
|
34 |
| -int main(int argc, char *argv[]) |
| 34 | +int main(int argc, char* argv[]) |
35 | 35 | {
|
36 |
| - if(qgetenv("SONIC_PI_RESTART") != "") |
37 |
| - { |
38 |
| - std::cout << "Restarting Sonic Pi..." << std::endl; |
39 |
| - // Pause for a couple of seconds to enable the previous instance |
40 |
| - // of Sonic Pi to complete before starting this new replacement |
41 |
| - // instance. This is to ensure that the two processes don't |
42 |
| - // conflict with the SingleApplication constraint. |
43 |
| - QThread::msleep(2000); |
44 |
| - } else |
45 |
| - { |
46 |
| - std::cout << "Starting Sonic Pi..." << std::endl; |
47 |
| - } |
| 36 | + if (qgetenv("SONIC_PI_RESTART") != "") |
| 37 | + { |
| 38 | + std::cout << "Restarting Sonic Pi..." << std::endl; |
| 39 | + // Pause for a couple of seconds to enable the previous instance |
| 40 | + // of Sonic Pi to complete before starting this new replacement |
| 41 | + // instance. This is to ensure that the two processes don't |
| 42 | + // conflict with the SingleApplication constraint. |
| 43 | + QThread::msleep(2000); |
| 44 | + } |
| 45 | + else |
| 46 | + { |
| 47 | + std::cout << "Starting Sonic Pi..." << std::endl; |
| 48 | + } |
48 | 49 |
|
49 | 50 | #ifndef Q_OS_DARWIN
|
50 |
| - Q_INIT_RESOURCE(SonicPi); |
| 51 | + Q_INIT_RESOURCE(SonicPi); |
51 | 52 | #endif
|
52 | 53 |
|
53 |
| - QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, true); |
| 54 | + QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, true); |
54 | 55 |
|
55 | 56 | #if defined(Q_OS_LINUX)
|
56 |
| - //linux code goes here |
| 57 | + // linux code goes here |
57 | 58 | #elif defined(Q_OS_WIN)
|
58 |
| - // windows code goes here |
59 |
| - |
60 |
| - // A temporary fix, until stylesheets are removed. |
61 |
| - // Only do the dpi scaling when the platform is high dpi |
62 |
| - |
63 |
| - if (GetDisplayScale().width() > 1.1f) |
64 |
| - { |
65 |
| - QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); |
66 |
| - QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); |
| 59 | + // windows code goes here |
| 60 | + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); |
| 61 | + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); |
| 62 | + QApplication::setAttribute(Qt::AA_UseDesktopOpenGL); |
67 | 63 |
|
68 |
| - } |
69 | 64 | #elif defined(Q_OS_DARWIN)
|
70 |
| - // macOS code goes here |
71 |
| - SonicPi::removeMacosSpecificMenuItems(); |
72 |
| - QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); |
| 65 | + // macOS code goes here |
| 66 | + SonicPi::removeMacosSpecificMenuItems(); |
| 67 | + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); |
73 | 68 | #endif
|
74 | 69 |
|
75 |
| - QApplication app(argc, argv); |
76 |
| - QFontDatabase::addApplicationFont(":/fonts/Hack-Regular.ttf"); |
77 |
| - QFontDatabase::addApplicationFont(":/fonts/Hack-Italic.ttf"); |
78 |
| - QFontDatabase::addApplicationFont(":/fonts/Hack-Bold.ttf"); |
79 |
| - QFontDatabase::addApplicationFont(":/fonts/Hack-BoldItalic.ttf"); |
| 70 | + QApplication app(argc, argv); |
| 71 | + |
| 72 | + QFontDatabase::addApplicationFont(":/fonts/Hack-Regular.ttf"); |
| 73 | + QFontDatabase::addApplicationFont(":/fonts/Hack-Italic.ttf"); |
| 74 | + QFontDatabase::addApplicationFont(":/fonts/Hack-Bold.ttf"); |
| 75 | + QFontDatabase::addApplicationFont(":/fonts/Hack-BoldItalic.ttf"); |
80 | 76 |
|
81 |
| - qRegisterMetaType<SonicPiLog::MultiMessage>("SonicPiLog::MultiMessage"); |
| 77 | + qRegisterMetaType<SonicPiLog::MultiMessage>("SonicPiLog::MultiMessage"); |
82 | 78 |
|
83 |
| - app.setApplicationName(QObject::tr("Sonic Pi")); |
84 |
| - app.setStyle("gtk"); |
| 79 | + app.setApplicationName(QObject::tr("Sonic Pi")); |
85 | 80 |
|
86 |
| - QPixmap pixmap(":/images/[email protected]"); |
| 81 | + app.setStyle("fusion"); |
87 | 82 |
|
88 |
| - QSplashScreen *splash = new QSplashScreen(pixmap); |
89 |
| - splash->show(); |
90 |
| - app.processEvents(); |
| 83 | + QPixmap pixmap( ":/images/[email protected]"); |
91 | 84 |
|
92 |
| - MainWindow mainWin(app, splash); |
| 85 | + QSplashScreen* splash = new QSplashScreen(pixmap); |
| 86 | + splash->show(); |
| 87 | + app.processEvents(); |
93 | 88 |
|
94 |
| - return app.exec(); |
| 89 | + MainWindow mainWin(app, splash); |
95 | 90 |
|
| 91 | + return app.exec(); |
96 | 92 | }
|
0 commit comments