git repos / SagoImageBrowser

blame: src/main.cpp

normal view · raw

032aa1e1 Poul Sander 2026-02-19 18:55 1
#include <QApplication>
4c41f5ff Poul Sander 2026-05-31 00:01 2
#include <QLocale>
48607848 Poul Sander 2026-05-19 19:20 3
#include <QTimer>
4c41f5ff Poul Sander 2026-05-31 00:01 4
#include <QTranslator>
032aa1e1 Poul Sander 2026-02-19 18:55 5
#include "mainwindow.h"
032aa1e1 Poul Sander 2026-02-19 18:55 6
032aa1e1 Poul Sander 2026-02-19 18:55 7
int main(int argc, char *argv[])
032aa1e1 Poul Sander 2026-02-19 18:55 8
{
032aa1e1 Poul Sander 2026-02-19 18:55 9
    QApplication app(argc, argv);
ce844ce8 Poul Sander 2026-06-10 18:04 10
    app.setDesktopFileName("sago-image-browser");
aae9a61b Poul Sander 2026-05-31 00:11 11
    app.setWindowIcon(QIcon(":/icons/sago_image_browser.svg"));
032aa1e1 Poul Sander 2026-02-19 18:55 12
4c41f5ff Poul Sander 2026-05-31 00:01 13
    QTranslator translator;
4c41f5ff Poul Sander 2026-05-31 00:01 14
    const QString locale = QLocale::system().name();   // e.g. "da_DK"
4c41f5ff Poul Sander 2026-05-31 00:01 15
    if (translator.load(":/translations/" + locale.left(2)))
4c41f5ff Poul Sander 2026-05-31 00:01 16
        app.installTranslator(&translator);
4c41f5ff Poul Sander 2026-05-31 00:01 17
032aa1e1 Poul Sander 2026-02-19 18:55 18
    MainWindow w;
f00af1eb Poul Sander 2026-02-23 19:17 19
    w.showMaximized();
032aa1e1 Poul Sander 2026-02-19 18:55 20
48607848 Poul Sander 2026-05-19 19:20 21
    const QStringList args = app.arguments();
48607848 Poul Sander 2026-05-19 19:20 22
    if (args.size() > 1) {
48607848 Poul Sander 2026-05-19 19:20 23
        const QString path = args.at(1);
48607848 Poul Sander 2026-05-19 19:20 24
        QTimer::singleShot(0, &w, [&w, path]() { w.openPath(path); });
48607848 Poul Sander 2026-05-19 19:20 25
    }
48607848 Poul Sander 2026-05-19 19:20 26
032aa1e1 Poul Sander 2026-02-19 18:55 27
    return app.exec();
032aa1e1 Poul Sander 2026-02-19 18:55 28
}
1970-01-01 00:00 29