-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
43 lines (35 loc) · 1.37 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "./ctxindicator.h"
#include <QApplication>
#include <QDesktopWidget>
#include <QObject>
#include "kbugscontext.h"
int main(int argc, char *argv[]) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
// https://doc.qt.io/qt-5/qt.html#ApplicationAttribute-enum
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QApplication a(argc, argv);
KBugsContext w;
#if defined(Q_OS_LINUX)
CtxIndicator ctx(argc, argv);
QObject::connect(&w, &KBugsContext::showCtxInMenuBar, &ctx,
&CtxIndicator::setIndicatorLabel);
QObject::connect(&w, &KBugsContext::addCtxs, &ctx,
&CtxIndicator::addCtxsToIndicatorMenu);
QObject::connect(&w, &KBugsContext::showCtxInMenuBar, &ctx,
&CtxIndicator::setIndicatorLabel);
QObject::connect(&w, &KBugsContext::ctxNameChanged, &ctx,
&CtxIndicator::updateCtxActionName);
QObject::connect(&w, &KBugsContext::curCtxIndexChanged, &ctx,
&CtxIndicator::activeCtx);
QObject::connect(&ctx, &CtxIndicator::actionActive, &w,
&KBugsContext::doAction);
QObject::connect(&ctx, SIGNAL(ctxIndexChanged(const int &)), &w,
SLOT(switchCtx(const int &)));
#endif
w.move((a.desktop()->width() - w.width()) / 2,
(a.desktop()->height() - w.height()) / 2);
w.show();
w.emitAddCtxs();
return a.exec();
}