5454#include < QHotkey>
5555#endif
5656
57- // #if defined(Q_OS_MACOS)
58- // #include <../3rdparty/KDMacTouchBar/src/kdmactouchbar.h>
59- // #endif
57+ #if defined(Q_OS_MACOS)
58+ #include < ../3rdparty/KDMacTouchBar/src/kdmactouchbar.h>
59+ #endif
6060
6161#include " ../qprompt_version.h"
6262#include " abstractunits.hpp"
@@ -72,25 +72,6 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
7272 qputenv (" QT_QUICK_CONTROLS_STYLE" , QByteArray (" Material" ));
7373 qputenv (" QT_QUICK_CONTROLS_MATERIAL_THEME" , QByteArray (" Dark" ));
7474 qputenv (" QT_QUICK_CONTROLS_MATERIAL_ACCENT" , QByteArray (" #3daee9" ));
75-
76- // Initialize app metadata
77- QCoreApplication::setOrganizationName (QString::fromUtf8 (" Cuperino" ));
78- QCoreApplication::setOrganizationDomain (QString::fromUtf8 (QPROMPT_URI));
79- QCoreApplication::setApplicationName (QString::fromUtf8 (" QPrompt" ));
80-
81- // Acquire saved settings
82- QSettings settings (QCoreApplication::organizationName (), QCoreApplication::applicationName ().toLower ());
83-
84- // The following code forces the use of a specific language.
85- QString language = settings.value (" ui/language" , " " ).toString ();
86- if (!language.isEmpty ()) {
87- auto langCode = language.append (" .UTF-8" ).toStdString ();
88- qDebug () << langCode;
89- qputenv (" LANGUAGE" , langCode);
90- qputenv (" LC_ALL" , langCode);
91- qputenv (" LANG" , langCode);
92- }
93-
9475 // Instantiate app
9576#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
9677 QGuiApplication::setAttribute (Qt::AA_EnableHighDpiScaling);
@@ -100,10 +81,11 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
10081#else
10182 QApplication app (argc, argv);
10283#endif
103-
104- // Initialize i18n metadata
84+ // Initialize app metadata
10585 KLocalizedString::setApplicationDomain (" qprompt" );
106-
86+ QCoreApplication::setOrganizationName (QString::fromUtf8 (" Cuperino" ));
87+ QCoreApplication::setOrganizationDomain (QString::fromUtf8 (QPROMPT_URI));
88+ QCoreApplication::setApplicationName (QString::fromUtf8 (" QPrompt" ));
10789 // Parse command line arguments
10890 QCommandLineParser parser;
10991 parser.setApplicationDescription (
@@ -121,6 +103,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
121103 if (positionalArguments.length ())
122104 fileToOpen = parser.positionalArguments ().at (0 );
123105
106+ // Acquire saved settings
107+ QSettings settings (QCoreApplication::organizationName (), QCoreApplication::applicationName ().toLower ());
108+
124109 // Substract from 2 because order in app is intentionally inverted from order in Qt
125110 app.setLayoutDirection (static_cast <Qt::LayoutDirection>(2 - settings.value (" ui/layout" , 0 ).toInt ()));
126111
@@ -181,43 +166,43 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
181166 // KirigamiPlugin::getInstance().registerTypes();
182167 // #endif
183168
184- // #if defined(Q_OS_MACOS)
185- // // Enable automatic display of dialog prompts on the touchbar.
186- // KDMacTouchBar::setAutomaticallyCreateMessageBoxTouchBar(true);
187- // // // Create touchbar for use through all of QPrompt's execusion
188- // // KDMacTouchBar *touchBar = new KDMacTouchBar();
189- // // //QMainWindow *mainWindow = nullptr;
190- // // //foreach(QWidget *widget, app.topLevelWidgets())
191- // // // if(widget->inherits("QMainWindow")) {
192- // // // mainWindow = qobject_cast<QMainWindow *>(widget);
193- // // // break;
194- // // // };
195- // // //KDMacTouchBar *touchBar = new KDMacTouchBar(mainWindow);
196- // // // Toggle teleprompter state
197- // // QIcon qpromptIcon(QStringLiteral(":images/qprompt"));
198- // // QAction *action = new QAction(qpromptIcon, "Toggle");
199- // // touchBar->addAction(action);
200- // // // connect(action, &QAction::triggered, this, &MainWindow::activated);
201- // // touchBar->addSeparator();
202- // // // Velocity and placement toachbar controls
203- // // touchBar->setTouchButtonStyle(KDMacTouchBar::IconOnly);
204- // // // Up
205- // // QIcon upIcon(QStringLiteral(":icons/go-previous"));
206- // // QAction *reduceAction = new QAction(upIcon, "Reduce");
207- // // touchBar->addAction(reduceAction);
208- // // touchBar->setPrincipialAction(reduceAction);
209- // // // connect(reduceAction, &QAction::triggered, this, &MainWindow::activated);
210- // // // Down
211- // // QIcon downIcon(QStringLiteral(":icons/go-next"));
212- // // QAction *increaseAction = new QAction(downIcon, "Increase");
213- // // touchBar->addAction(increaseAction);
214- // // // connect(increaseAction, &QAction::triggered, this, &MainWindow::activated);
215- // // // touchBar->addSeparator();
216- // // // // Stop prompter
217- // // // QAction *stopAction = new QAction(upIcon, "Stop");
218- // // // touchBar->addAction(stopAction);
219- // // // // connect(stopAction, &QAction::triggered, this, &MainWindow::activated);
220- // #endif
169+ #if defined(Q_OS_MACOS)
170+ // Enable automatic display of dialog prompts on the touchbar.
171+ KDMacTouchBar::setAutomaticallyCreateMessageBoxTouchBar (true );
172+ // // Create touchbar for use through all of QPrompt's execusion
173+ // KDMacTouchBar *touchBar = new KDMacTouchBar();
174+ // //QMainWindow *mainWindow = nullptr;
175+ // //foreach(QWidget *widget, app.topLevelWidgets())
176+ // // if(widget->inherits("QMainWindow")) {
177+ // // mainWindow = qobject_cast<QMainWindow *>(widget);
178+ // // break;
179+ // // };
180+ // //KDMacTouchBar *touchBar = new KDMacTouchBar(mainWindow);
181+ // // Toggle teleprompter state
182+ // QIcon qpromptIcon(QStringLiteral(":images/qprompt"));
183+ // QAction *action = new QAction(qpromptIcon, "Toggle");
184+ // touchBar->addAction(action);
185+ // // connect(action, &QAction::triggered, this, &MainWindow::activated);
186+ // touchBar->addSeparator();
187+ // // Velocity and placement toachbar controls
188+ // touchBar->setTouchButtonStyle(KDMacTouchBar::IconOnly);
189+ // // Up
190+ // QIcon upIcon(QStringLiteral(":icons/go-previous"));
191+ // QAction *reduceAction = new QAction(upIcon, "Reduce");
192+ // touchBar->addAction(reduceAction);
193+ // touchBar->setPrincipialAction(reduceAction);
194+ // // connect(reduceAction, &QAction::triggered, this, &MainWindow::activated);
195+ // // Down
196+ // QIcon downIcon(QStringLiteral(":icons/go-next"));
197+ // QAction *increaseAction = new QAction(downIcon, "Increase");
198+ // touchBar->addAction(increaseAction);
199+ // // connect(increaseAction, &QAction::triggered, this, &MainWindow::activated);
200+ // // touchBar->addSeparator();
201+ // // // Stop prompter
202+ // // QAction *stopAction = new QAction(upIcon, "Stop");
203+ // // touchBar->addAction(stopAction);
204+ // // // connect(stopAction, &QAction::triggered, this, &MainWindow::activated);
205+ #endif
221206
222207#if defined(QHotkey_FOUND)
223208 // Toggle transparency of all windows
@@ -252,9 +237,6 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
252237 engine.addImportPath (QStringLiteral (" ../../lib/qml/" ));
253238 engine.addImportPath (QStringLiteral (" ../lib/qml/" ));
254239 engine.addImportPath (QStringLiteral (" ./lib/qml/" ));
255- engine.addImportPath (QStringLiteral (" ../../../install/lib/qml/" ));
256- engine.addImportPath (QStringLiteral (" ../../install/lib/qml/" ));
257- engine.addImportPath (QStringLiteral (" ./../install/lib/qml/" ));
258240 // MacOS paths
259241 engine.addImportPath (QStringLiteral (" ../build/" ));
260242 engine.addImportPath (QStringLiteral (" ../Resources/qml/" ));
0 commit comments