43int main(
int argc,
char *argv[]) {
44#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
45 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
46 QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
49 for (
int i = 1; i < argc; ++i) {
55 if ((text.indexOf(
"-psn_") == 0) || (text.indexOf(
"-session") == 0)) {
60 QString name = qgetenv(
"USER");
62 name = qgetenv(
"USERNAME");
65 if (text.length() > 0)
70 QApplication app(argc, argv);
73 Q_INIT_RESOURCE(resources);
74 Q_INIT_RESOURCE(qmake_qmake_qm_files);
76 QCoreApplication::setOrganizationName(
"IJHack");
77 QCoreApplication::setOrganizationDomain(
"ijhack.org");
78 QCoreApplication::setApplicationName(
"QtPass");
79 QCoreApplication::setApplicationVersion(VERSION);
82 QTranslator translator;
83 QString locale = QLocale::system().name();
88 QString(
":localization/localization_%1.qm").arg(locale))) {
89 SingleApplication::installTranslator(&translator);
90 SingleApplication::setLayoutDirection(
91 QObject::tr(
"LTR") ==
"RTL" ? Qt::RightToLeft : Qt::LeftToRight);
96 SingleApplication::setActiveWindow(&w);
97 SingleApplication::setWindowIcon(QIcon(
":artwork/icon.png"));
104 QGuiApplication::setDesktopFileName(
"qtpass.desktop");
107#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
108 static int cursorScreen =
109 app.desktop()->screenNumber(app.desktop()->cursor().pos());
110 QPoint cursorScreenCenter =
111 app.desktop()->screenGeometry(cursorScreen).center();
113 QScreen *screen = QGuiApplication::screenAt(QCursor::pos());
114 QPoint cursorScreenCenter = screen->geometry().center();
116 QRect windowFrameGeo = w.frameGeometry();
117 windowFrameGeo.moveCenter(cursorScreenCenter);
118 w.move(windowFrameGeo.topLeft());
122 return SingleApplication::exec();
The MainWindow class does way too much, not only is it a switchboard, configuration handler and more,...
void messageAvailable(QString message)
MainWindow::messageAvailable we have some text/message/search to do.
The SingleApplication class is used for commandline intergration.
bool isRunning()
SingleApplication::isRunning is there already a QtPass instance running, to check wether to be server...
bool sendMessage(const QString &message)
SingleApplication::sendMessage send a message (from commandline) to an already running QtPass instanc...
void messageAvailable(QString message)
messageAvailable notification from commandline
int main(int argc, char *argv[])
main