// This file is part of JustMotion. // JustMotion is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // JustMotion is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details.RPOSE. See the // GNU General Public License for more details. #include "common.h" #include "main_widget.h" #include "recents.h" int main(int argc, char** argv) { QApplication app(argc, argv); QApplication::setApplicationName(APP_NAME); QApplication::setApplicationVersion(APP_VERSION); shared_t shared; MainGui mainGui(&shared); auto rec = app.primaryScreen()->geometry(); shared.appDataPath = QDir::homePath() + QDir::separator() + "." + QString(APP_TARGET); shared.recentsPath = shared.appDataPath + QDir::separator() + "recent"; shared.appConfPath = shared.appDataPath + QDir::separator() + "app.conf"; shared.windowH = (rec.height() / 4) * 3; shared.windowW = rec.width() / 2; shared.windowX = rec.x(); shared.windowY = rec.y(); shared.retCode = 0; mkPath(shared.appDataPath); mkPath(shared.recentsPath); if (!QFileInfo::exists(shared.appConfPath)) { wrConf(shared.appConfPath, &shared); } rdConf(shared.appConfPath, &shared); MainWidget mainWidget(&shared, &mainGui); elasticWid(&mainWidget); mainGui.setContentsMargins(0,0,0,0); mainGui.setCentralWidget(&mainWidget); mainGui.setWindowTitle(APP_NAME); mainGui.setMinimumHeight(600); mainGui.setMinimumWidth(800); mainGui.setGeometry(shared.windowX, shared.windowY, shared.windowW, shared.windowH); mainGui.show(); auto ret = app.exec(); rec = mainGui.geometry(); shared.windowH = rec.height(); shared.windowW = rec.width(); shared.windowX = rec.x(); shared.windowY = rec.y(); resetSharedRes(&shared); wrConf(shared.appConfPath, &shared); return ret; }