Just Intonation
Version 1.3.1 (19)
Explore key-independent dynamically adapting tuning in just intonation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
main.cpp
Go to the documentation of this file.
1
/*****************************************************************************
2
* Copyright 2016-2017 Karolin Stange, Christoph Wick, and Haye Hinrichsen
3
*
4
* This file is part of JustIntonation.
5
*
6
* JustIntonation is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* JustIntonation is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* for more details.
15
*
16
* You should have received a copy of the GNU General Public License along
17
* with JustIntonation. If not, see http://www.gnu.org/licenses/.
18
*****************************************************************************/
19
20
//=============================================================================
21
// JustIntonation
22
// Main application file
23
//=============================================================================
24
25
#include <QApplication>
26
#include <QQmlApplicationEngine>
27
#include <QLoggingCategory>
28
29
#include "
config.h
"
30
#include "
system/runguard.h
"
31
#include "
system/downloader.h
"
32
#include "
system/systemtools.h
"
33
#include "
system/filehandler.h
"
34
#include "
application.h
"
35
36
37
int
main
(
int
argc,
char
*argv[])
38
{
39
// Assign Main thread name for debugging
40
SystemTools::setThreadName
(
"MainThread"
);
41
42
// Suppress warning "qt.network.ssl: Error receiving trust for a CA certificate"
43
// This warning is caused by the assumption that the download page is https,
44
// but actually it is non-encrypted
45
QLoggingCategory::setFilterRules(QStringLiteral(
"qt.network.ssl=false"
));
46
47
while
(
true
)
48
{
49
// Create the application
50
QApplication app(argc, argv);
51
52
// If another instance is already running show a message box and quit:
53
#if defined(INT_INCLUDE_RUNGUARD)
54
RunGuard
runguard (
INT_APPLICATIONNAME
);
55
if
(runguard.
anotherInstanceIsRunning
())
return
0;
56
#endif
57
58
// Register map key->cents for tuning corrections
59
qRegisterMetaType<QMap<int,double>>();
60
61
// Specify unique identifiers, needed for QSettings
62
app.setOrganizationName(
INT_ORGANIZATIONNAME
);
63
app.setOrganizationDomain(
INT_ORGANIZATIONDOMAIN
);
64
app.setApplicationName(
INT_APPLICATIONNAME
);
65
66
// Create an instance of the Application class
67
Application
justintonation(app);
68
justintonation.
installTranslations
();
69
70
// Create, load and init the Qml application engine
71
QQmlApplicationEngine engine;
72
engine.load(QUrl(QStringLiteral(
"qrc:/Main.qml"
)));
73
if
(engine.rootObjects().empty())
74
{
75
qDebug() <<
"ERROR: main.cpp: Could not load Qml objects, exiting.\n"
;
76
return
0;
77
}
78
79
// execute the application
80
justintonation.
init
(engine);
81
justintonation.
start
();
82
int
result = app.exec();
83
84
// shut down and exit
85
justintonation.
stop
();
86
justintonation.
exit
();
87
if
(not justintonation.
restartRequested
())
return
result;
88
}
89
}
Application::stop
void stop()
Stop the application and its components.
Definition:
application.cpp:340
runguard.h
application.h
downloader.h
SystemTools::setThreadName
void setThreadName(QString threadname)
Helper function for debugging: set the current thread name.
Definition:
systemtools.cpp:64
config.h
Application::init
void init(QQmlApplicationEngine &engine)
Initialization of the application.
Definition:
application.cpp:103
Application::start
void start()
Start the application and its components.
Definition:
application.cpp:306
filehandler.h
INT_APPLICATIONNAME
#define INT_APPLICATIONNAME
Definition:
config.h:31
Application::exit
void exit()
Exit from the application and all its components.
Definition:
application.cpp:367
Application::restartRequested
bool restartRequested()
Definition:
application.h:74
RunGuard
Class for checking whether the application is already running.
Definition:
runguard.h:52
INT_ORGANIZATIONNAME
#define INT_ORGANIZATIONNAME
Definition:
config.h:32
RunGuard::anotherInstanceIsRunning
bool anotherInstanceIsRunning(bool showMessage=true)
Check whether another instance of the application is running.
Definition:
runguard.cpp:148
Application::installTranslations
void installTranslations()
Install existing translations.
Definition:
application.cpp:465
Application
Main application.
Definition:
application.h:60
systemtools.h
INT_ORGANIZATIONDOMAIN
#define INT_ORGANIZATIONDOMAIN
Definition:
config.h:33
main
int main(int argc, char *argv[])
Definition:
main.cpp:37
application
main.cpp
Generated on Wed Jul 12 2017 10:39:47 for Just Intonation by
1.8.11