Skip to content

Commit df682fe

Browse files
committed
GUI - minor style hint tweaks
1 parent f94a3be commit df682fe

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

app/gui/main.cpp

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
#include <iostream>
1515

1616
#include <QApplication>
17-
#include <QSplashScreen>
18-
#include <QPixmap>
1917
#include <QBitmap>
2018
#include <QLabel>
2119
#include <QLibraryInfo>
20+
#include <QPixmap>
21+
#include <QSplashScreen>
2222
#include <QThread>
2323

2424
#include "mainwindow.h"
@@ -31,66 +31,62 @@
3131
#include "platform/macos.h"
3232
#endif
3333

34-
int main(int argc, char *argv[])
34+
int main(int argc, char* argv[])
3535
{
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+
}
4849

4950
#ifndef Q_OS_DARWIN
50-
Q_INIT_RESOURCE(SonicPi);
51+
Q_INIT_RESOURCE(SonicPi);
5152
#endif
5253

53-
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, true);
54+
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, true);
5455

5556
#if defined(Q_OS_LINUX)
56-
//linux code goes here
57+
// linux code goes here
5758
#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);
6763

68-
}
6964
#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);
7368
#endif
7469

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");
8076

81-
qRegisterMetaType<SonicPiLog::MultiMessage>("SonicPiLog::MultiMessage");
77+
qRegisterMetaType<SonicPiLog::MultiMessage>("SonicPiLog::MultiMessage");
8278

83-
app.setApplicationName(QObject::tr("Sonic Pi"));
84-
app.setStyle("gtk");
79+
app.setApplicationName(QObject::tr("Sonic Pi"));
8580

86-
QPixmap pixmap(":/images/[email protected]");
81+
app.setStyle("fusion");
8782

88-
QSplashScreen *splash = new QSplashScreen(pixmap);
89-
splash->show();
90-
app.processEvents();
83+
QPixmap pixmap(":/images/[email protected]");
9184

92-
MainWindow mainWin(app, splash);
85+
QSplashScreen* splash = new QSplashScreen(pixmap);
86+
splash->show();
87+
app.processEvents();
9388

94-
return app.exec();
89+
MainWindow mainWin(app, splash);
9590

91+
return app.exec();
9692
}

app/gui/mainwindow.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,12 @@ void MainWindow::setupWindowStructure()
551551

552552
connect(signalMapper, SIGNAL(mappedInt(int)), this, SLOT(changeTab(int)));
553553

554-
QFont font("Monospace");
554+
QFont font("Hack", 10);
555555
font.setStyleHint(QFont::Monospace);
556+
#ifdef Q_OS_WIN
557+
font.setStyleStrategy(QFont::PreferAntialias);
558+
font.setHintingPreference(QFont::PreferFullHinting);
559+
#endif
556560
lexer->setDefaultFont(font);
557561

558562
autocomplete = new ScintillaAPI(lexer);

0 commit comments

Comments
 (0)