46auto main(
int argc,
char *argv[]) ->
int {
47#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
48 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
49 QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
54 QString name = qgetenv(
"USER");
56 name = qgetenv(
"USERNAME");
59 QApplication app(argc, argv);
62 const QStringList args = app.arguments();
63 bool consumeNextArg =
false;
64 for (
int i = 1; i < args.count(); ++i) {
65 const auto &arg = args.at(i);
68 consumeNextArg =
false;
69 for (
int j = i + 1; j < args.count(); ++j) {
78 consumeNextArg =
false;
82 if (arg.startsWith(
'-')) {
83 if (!arg.contains(
'=') && i + 1 < args.count())
84 consumeNextArg =
true;
93 if ((text.indexOf(
"-psn_") == 0) || (text.indexOf(
"-session") == 0)) {
104 Q_INIT_RESOURCE(resources);
105 Q_INIT_RESOURCE(qmake_qmake_qm_files);
107 QCoreApplication::setOrganizationName(
"IJHack");
108 QCoreApplication::setOrganizationDomain(
"ijhack.org");
109 QCoreApplication::setApplicationName(
"QtPass");
110 QCoreApplication::setApplicationVersion(VERSION);
113 QTranslator translator;
114 QString locale = QLocale::system().name();
119 QString(
":localization/localization_%1.qm").arg(locale))) {
120 SingleApplication::installTranslator(&translator);
121 SingleApplication::setLayoutDirection(
122 QObject::tr(
"LTR") ==
"RTL" ? Qt::RightToLeft : Qt::LeftToRight);
129 QApplication::setWindowIcon(QIcon(
":artwork/icon.png"));
131 SingleApplication::setWindowIcon(QIcon(
":artwork/icon.png"));
135 QObject::connect(&app, &SingleApplication::messageAvailable, &w,
139 QGuiApplication::setDesktopFileName(
"qtpass.desktop");
142#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
143 static int cursorScreen =
144 app.desktop()->screenNumber(app.desktop()->cursor().pos());
145 QPoint cursorScreenCenter =
146 app.desktop()->screenGeometry(cursorScreen).center();
148 QScreen *screen = QGuiApplication::screenAt(QCursor::pos());
150 screen = QGuiApplication::primaryScreen();
151 QPoint cursorScreenCenter;
153 cursorScreenCenter = screen->geometry().center();
155 QRect windowFrameGeo = w.frameGeometry();
156 windowFrameGeo.moveCenter(cursorScreenCenter);
157 w.move(windowFrameGeo.topLeft());
161 return SingleApplication::exec();
The MainWindow class does way too much, not only is it a switchboard, configuration handler and more,...
void messageAvailable(const QString &message)
MainWindow::messageAvailable we have some text/message/search to do.
auto main(int argc, char *argv[]) -> int
main