MCPcopy Create free account
hub / github.com/ckaiser/Lightscreen / LightscreenWindow

Method LightscreenWindow

lightscreenwindow.cpp:58–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56#include <updater/updater.h>
57
58LightscreenWindow::LightscreenWindow(QWidget *parent) :
59 QMainWindow(parent),
60 mDoCache(false),
61 mHideTrigger(false),
62 mReviveMain(false),
63 mWasVisible(true),
64 mLastMessage(0),
65 mLastMode(Screenshot::None),
66 mLastScreenshot(),
67 mHasTaskbarButton(false)
68{
69 ui.setupUi(this);
70
71 ui.screenPushButton->setIcon(os::icon("screen.big"));
72 ui.areaPushButton->setIcon(os::icon("area.big"));
73 ui.windowPushButton->setIcon(os::icon("pickWindow.big"));
74
75 ui.optionsPushButton->setIcon(os::icon("configure"));
76 ui.folderPushButton->setIcon(os::icon("folder"));
77 ui.imgurPushButton->setIcon(os::icon("imgur"));
78
79 createUploadMenu();
80
81#ifdef Q_OS_WIN
82 if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7) {
83 mTaskbarButton = new QWinTaskbarButton(this);
84 mHasTaskbarButton = true;
85
86 if (QtWin::isCompositionEnabled()) {
87 setAttribute(Qt::WA_NoSystemBackground);
88 QtWin::enableBlurBehindWindow(this);
89 QtWin::extendFrameIntoClientArea(this, QMargins(-1, -1, -1, -1));
90 }
91 }
92
93 if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS7) {
94 ui.centralWidget->setStyleSheet("QPushButton { padding: 2px; border: 1px solid #acacac; background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #eaeaea, stop:1 #e5e5e5);} QPushButton:hover { border: 1px solid #7eb4ea; background-color: #e4f0fc; }");
95 }
96#endif
97
98 setMinimumSize(size());
99 setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
100
101 // Actions
102 connect(ui.screenPushButton, &QPushButton::clicked, this, &LightscreenWindow::screenHotkey);
103 connect(ui.areaPushButton , &QPushButton::clicked, this, &LightscreenWindow::areaHotkey);
104 connect(ui.windowPushButton, &QPushButton::clicked, this, &LightscreenWindow::windowPickerHotkey);
105
106 connect(ui.optionsPushButton, &QPushButton::clicked, this, &LightscreenWindow::showOptions);
107 connect(ui.folderPushButton , &QPushButton::clicked, this, &LightscreenWindow::goToFolder);
108
109 // Shortcuts
110 mGlobalHotkeys = new UGlobalHotkeys(this);
111
112 connect(mGlobalHotkeys, &UGlobalHotkeys::activated, [&](size_t id) {
113 action(id);
114 });
115

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected