src/ and include/ are what is left: the controller the screens delegate to, its workers and its data model (core/), and the window and entry point that hold them together (app/). With those moved, src/ and include/ are empty and go away — a header is now always next to its source, in a folder named after what it does.
60 lines
2.4 KiB
C++
60 lines
2.4 KiB
C++
#include <QApplication>
|
|
#include <QLoggingCategory>
|
|
#include <QStringList>
|
|
#include <QTimer>
|
|
|
|
#include "app-settings.h"
|
|
#include "language-manager.h"
|
|
#include "log-manager.h"
|
|
#include "main-window.h"
|
|
#include "update-manager.h"
|
|
|
|
int main(int argc, char* argv[]) {
|
|
QApplication app(argc, argv);
|
|
app.setApplicationName("PacManager");
|
|
app.setApplicationVersion(UpdateManager::currentVersion());
|
|
app.setOrganizationName("Freebuff");
|
|
// Before any widget exists: the palette is what the platform draws the
|
|
// parts the stylesheet cannot reach, such as the margin around a menu.
|
|
app.setPalette(MainWindow::appPalette());
|
|
|
|
// Every log category the app uses is enabled (qCDebug included) and funnelled
|
|
// into the journal, so the Logs screen shows the same detail as a debug run
|
|
// without the user having to set QT_LOGGING_RULES.
|
|
QLoggingCategory::setFilterRules(QStringLiteral("pacmgr.*=true"));
|
|
// The chosen catalogue goes in before anything is built, widget or journal
|
|
// line: the whole session, interface included, is then in one language
|
|
// rather than starting in French and switching halfway.
|
|
LanguageManager::apply(AppSettings::instance().language());
|
|
|
|
// The journal opens where the user asked it to, not where the previous
|
|
// release wrote it: AppSettings is read before the first line is written.
|
|
LogManager::installQtMessageHandler();
|
|
LogManager::instance().logEvent(
|
|
QStringLiteral("app"),
|
|
QCoreApplication::translate("main", "session démarrée (v%1)")
|
|
.arg(UpdateManager::currentVersion()));
|
|
|
|
MainWindow window;
|
|
window.setWindowTitle(QCoreApplication::translate("main", "PacManager - Gestionnaire de Paquets"));
|
|
window.resize(1200, 760);
|
|
window.setMinimumSize(960, 600);
|
|
window.show();
|
|
|
|
// Files the desktop handed over ("Ouvrir avec PacManager", the desktop
|
|
// entry declares %U): installed once the event loop runs, so the window is
|
|
// visible and any dialog has a parent.
|
|
const QStringList fileArgs = app.arguments().mid(1);
|
|
if (!fileArgs.isEmpty()) {
|
|
QTimer::singleShot(0, &window, [&window, fileArgs] {
|
|
window.installLocalFiles(fileArgs);
|
|
});
|
|
}
|
|
|
|
const int code = app.exec();
|
|
|
|
LogManager::instance().logEvent(QStringLiteral("app"),
|
|
QCoreApplication::translate("main", "session terminée (code %1)").arg(code));
|
|
return code;
|
|
}
|