You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.1 KiB
C++
33 lines
1.1 KiB
C++
#include "mainwindow.h"
|
|
|
|
#include <iostream>
|
|
#include <QApplication>
|
|
#include <QDir>
|
|
#include <QSettings>
|
|
#include <QStandardPaths>
|
|
|
|
// dieser unique Pointer ist absolut genial, weil er mir erlaubt, die User-spezifischen Einstellungen zu Farben und Grid-Größe
|
|
// an das Mainwindow weiter zu reichen, noch *bevor* das Mainwindow überhaupt initialisiert ist!
|
|
std::unique_ptr<QSettings> settings;
|
|
|
|
// funktioniert komplett plattformunabhängig!
|
|
// sogar auf Android, wenn man wahnsinnig sein sollte!
|
|
void initialise_settings() {
|
|
QString config_string = QStandardPaths::locate( QStandardPaths::ConfigLocation, "ThinkPink.ini");
|
|
if (config_string == "") {
|
|
config_string = QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)).filePath("ThinkPink.ini");
|
|
std::cout << "No config file found. Creating default config at " << config_string.toStdString() << std::endl;
|
|
}
|
|
settings.reset( new QSettings( config_string, QSettings::IniFormat ) );
|
|
}
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
initialise_settings();
|
|
QApplication a(argc, argv);
|
|
MainWindow w;
|
|
w.show();
|
|
return a.exec();
|
|
}
|