-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathlivecoding.cpp
More file actions
41 lines (35 loc) · 869 Bytes
/
Copy pathlivecoding.cpp
File metadata and controls
41 lines (35 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "livecoding.h"
#include <QCoreApplication>
#include <QDesktopServices>
#include <QLocale>
#include <QProcess>
#include <QSettings>
LiveCoding::LiveCoding(QQmlEngine* engine, QObject* parent)
: QObject(parent)
, m_engine(engine)
{
}
bool LiveCoding::openUrlWithDefaultApplication(const QUrl& url) const
{
return QDesktopServices::openUrl(url);
}
void LiveCoding::clearQmlComponentCache() const
{
m_engine->clearComponentCache();
}
QString LiveCoding::currentLanguage() const
{
const auto languages = QLocale().uiLanguages();
return languages.first();
}
void LiveCoding::setLanguage(const QString& language)
{
QSettings settings;
settings.setValue("language", language);
settings.sync();
}
void LiveCoding::restartApplication()
{
qApp->quit();
QProcess::startDetached(qApp->arguments()[0], qApp->arguments());
}