| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
1 |
/* |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
2 |
MIT License |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
3 |
|
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
4 |
Copyright (c) 2026 Poul Sander |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
5 |
|
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
6 |
Permission is hereby granted, free of charge, to any person obtaining a copy |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
7 |
of this software and associated documentation files (the "Software"), to deal |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
8 |
in the Software without restriction, including without limitation the rights |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
9 |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
10 |
copies of the Software, and to permit persons to whom the Software is |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
11 |
furnished to do so, subject to the following conditions: |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
12 |
|
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
13 |
The above copyright notice and this permission notice shall be included in all |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
14 |
copies or substantial portions of the Software. |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
15 |
|
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
16 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
17 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
18 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
19 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
20 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
21 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
22 |
SOFTWARE. |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
23 |
|
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
24 |
*/ |
| 14cf904f |
Poul Sander |
2026-06-22 18:18 |
25 |
|
| 032aa1e1 |
Poul Sander |
2026-02-19 18:55 |
26 |
#include <QApplication> |
| 4c41f5ff |
Poul Sander |
2026-05-31 00:01 |
27 |
#include <QLocale> |
| 48607848 |
Poul Sander |
2026-05-19 19:20 |
28 |
#include <QTimer> |
| 4c41f5ff |
Poul Sander |
2026-05-31 00:01 |
29 |
#include <QTranslator> |
| 032aa1e1 |
Poul Sander |
2026-02-19 18:55 |
30 |
#include "mainwindow.h" |
| 032aa1e1 |
Poul Sander |
2026-02-19 18:55 |
31 |
|
| 032aa1e1 |
Poul Sander |
2026-02-19 18:55 |
32 |
int main(int argc, char *argv[]) |
| 032aa1e1 |
Poul Sander |
2026-02-19 18:55 |
33 |
{ |
| 032aa1e1 |
Poul Sander |
2026-02-19 18:55 |
34 |
QApplication app(argc, argv); |
| ce844ce8 |
Poul Sander |
2026-06-10 18:04 |
35 |
app.setDesktopFileName("sago-image-browser"); |
| aae9a61b |
Poul Sander |
2026-05-31 00:11 |
36 |
app.setWindowIcon(QIcon(":/icons/sago_image_browser.svg")); |
| 032aa1e1 |
Poul Sander |
2026-02-19 18:55 |
37 |
|
| 4c41f5ff |
Poul Sander |
2026-05-31 00:01 |
38 |
QTranslator translator; |
| 4c41f5ff |
Poul Sander |
2026-05-31 00:01 |
39 |
const QString locale = QLocale::system().name(); // e.g. "da_DK" |
| 4c41f5ff |
Poul Sander |
2026-05-31 00:01 |
40 |
if (translator.load(":/translations/" + locale.left(2))) |
| 4c41f5ff |
Poul Sander |
2026-05-31 00:01 |
41 |
app.installTranslator(&translator); |
| 4c41f5ff |
Poul Sander |
2026-05-31 00:01 |
42 |
|
| 032aa1e1 |
Poul Sander |
2026-02-19 18:55 |
43 |
MainWindow w; |
| f00af1eb |
Poul Sander |
2026-02-23 19:17 |
44 |
w.showMaximized(); |
| 032aa1e1 |
Poul Sander |
2026-02-19 18:55 |
45 |
|
| 48607848 |
Poul Sander |
2026-05-19 19:20 |
46 |
const QStringList args = app.arguments(); |
| 48607848 |
Poul Sander |
2026-05-19 19:20 |
47 |
if (args.size() > 1) { |
| 48607848 |
Poul Sander |
2026-05-19 19:20 |
48 |
const QString path = args.at(1); |
| 48607848 |
Poul Sander |
2026-05-19 19:20 |
49 |
QTimer::singleShot(0, &w, [&w, path]() { w.openPath(path); }); |
| 48607848 |
Poul Sander |
2026-05-19 19:20 |
50 |
} |
| 48607848 |
Poul Sander |
2026-05-19 19:20 |
51 |
|
| 032aa1e1 |
Poul Sander |
2026-02-19 18:55 |
52 |
return app.exec(); |
| 032aa1e1 |
Poul Sander |
2026-02-19 18:55 |
53 |
} |
|
|
1970-01-01 00:00 |
54 |
|