* Handle captures without sigslots Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Set {app,organization}Name and version consistently Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make 'full' dbus-free Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Move CaptureRequest::exportCapture to Controller We need to wait until the upload widget (or similar widgets) have finished before exiting. This must be done using a signal. The problem is that CaptureRequest can't be guaranteed to survive until the widget has finished what it's doing. Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Use QApplication with the 'full' subcommand Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Do unto 'screen' as we did to 'full' Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add FlameshotDaemon singleton class Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Support clipboard hosting for both pixmaps and text * Fix upload handling Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Do not show tray icon if not daemon Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Clean up handling of pin task Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove annoying Qt warning messages The messages were caused by the color wheel. Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix small bug in Controller::exportCapture * Fix --raw output * Make 'gui' dbus-independent Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix accept on select bug Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix compile error on Windows Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make it work on Windows * Remove obsolete function in main.cpp Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make 'launcher' work without dbus Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * clang-format, sigh Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Enable CLI parsing on MacOS Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make 'config' work without dbus Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Small refactor of capture request handling Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove obsolete DBusUtils Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove unused D-Bus sigslots Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove D-Bus methods openConfig, autostartEnabled and trayIconEnabled Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove D-Bus method requestCapture Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove CaptureRequest id mechanism Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix 'launcher' crash Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Handle clipboard notifications properly Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add 'autoCloseIdleDaemon' option Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Document FlameshotDaemon class Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make 'flameshot gui' run in single-application mode Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add `allowmultipleGuiInstances` config option Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix endless loop with multiple GUI instances Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Move upload confirmation dialog where it belongs Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add the new config options to the GUI as well Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix failing build on Windows Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Handle persistence on MacOS Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * fixed notifications on macos * Fixed display on macos * Reformat tests/action_options.sh Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix infinite recursion in tests/action_options.sh Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> Co-authored-by: Dearsh Oberoi <59907159+deo002@users.noreply.github.com> Co-authored-by: Jeremy Borgman <borgman.jeremy@pm.me>
110 lines
3.4 KiB
C++
110 lines
3.4 KiB
C++
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
|
|
|
|
#include "infowindow.h"
|
|
#include "src/core/flameshotdaemon.h"
|
|
#include "src/core/qguiappcurrentscreen.h"
|
|
#include "src/utils/globalvalues.h"
|
|
#include <QApplication>
|
|
#include <QClipboard>
|
|
#include <QHeaderView>
|
|
#include <QIcon>
|
|
#include <QKeyEvent>
|
|
#include <QLabel>
|
|
#include <QPushButton>
|
|
#include <QSysInfo>
|
|
#include <QVBoxLayout>
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
|
|
|
#include <QRect>
|
|
#include <QScreen>
|
|
|
|
#endif
|
|
|
|
// InfoWindow show basic information about the usage of Flameshot
|
|
|
|
InfoWindow::InfoWindow(QWidget* parent)
|
|
: QWidget(parent)
|
|
{
|
|
setAttribute(Qt::WA_DeleteOnClose);
|
|
setWindowIcon(QIcon(GlobalValues::iconPath()));
|
|
setWindowTitle(tr("About"));
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
|
QRect position = frameGeometry();
|
|
QScreen* screen = QGuiAppCurrentScreen().currentScreen();
|
|
position.moveCenter(screen->availableGeometry().center());
|
|
move(position.topLeft());
|
|
#endif
|
|
|
|
m_layout = new QVBoxLayout(this);
|
|
m_layout->setAlignment(Qt::AlignHCenter);
|
|
initLabels();
|
|
show();
|
|
}
|
|
|
|
void InfoWindow::initLabels()
|
|
{
|
|
auto* icon = new QLabel();
|
|
icon->setPixmap(QPixmap(GlobalValues::iconPath()));
|
|
icon->setAlignment(Qt::AlignHCenter);
|
|
m_layout->addWidget(icon);
|
|
|
|
auto* licenseTitleLabel = new QLabel(tr("<u><b>License</b></u>"), this);
|
|
licenseTitleLabel->setAlignment(Qt::AlignHCenter);
|
|
licenseTitleLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
|
m_layout->addWidget(licenseTitleLabel);
|
|
|
|
auto* licenseLabel = new QLabel(QStringLiteral("GPLv3+"), this);
|
|
licenseLabel->setAlignment(Qt::AlignHCenter);
|
|
licenseLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
|
m_layout->addWidget(licenseLabel);
|
|
m_layout->addStretch();
|
|
|
|
auto* versionTitleLabel = new QLabel(tr("<u><b>Version</b></u>"), this);
|
|
versionTitleLabel->setAlignment(Qt::AlignHCenter);
|
|
versionTitleLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
|
m_layout->addWidget(versionTitleLabel);
|
|
|
|
auto* versionLabel = new QLabel(GlobalValues::versionInfo(), this);
|
|
versionLabel->setAlignment(Qt::AlignHCenter);
|
|
versionLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
|
versionLabel->setCursor(QCursor(Qt::IBeamCursor));
|
|
m_layout->addWidget(versionLabel);
|
|
|
|
QString kernelInfo = generateKernelString();
|
|
auto* kernelLabel = new QLabel(kernelInfo, this);
|
|
kernelLabel->setAlignment(Qt::AlignHCenter);
|
|
kernelLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
|
kernelLabel->setCursor(QCursor(Qt::IBeamCursor));
|
|
m_layout->addWidget(kernelLabel);
|
|
|
|
auto* copyVersion = new QPushButton("Copy Info", this);
|
|
m_layout->addWidget(copyVersion);
|
|
connect(copyVersion, &QPushButton::pressed, this, &InfoWindow::copyInfo);
|
|
|
|
m_layout->addSpacing(30);
|
|
}
|
|
|
|
void InfoWindow::copyInfo()
|
|
{
|
|
FlameshotDaemon::copyToClipboard(GlobalValues::versionInfo() + "\n" +
|
|
generateKernelString());
|
|
}
|
|
|
|
void InfoWindow::keyPressEvent(QKeyEvent* e)
|
|
{
|
|
if (e->key() == Qt::Key_Escape) {
|
|
close();
|
|
}
|
|
}
|
|
|
|
QString generateKernelString()
|
|
{
|
|
QString kernelVersion =
|
|
QSysInfo::kernelType() + ": " + QSysInfo::kernelVersion() + "\n" +
|
|
QSysInfo::productType() + ": " + QSysInfo::productVersion();
|
|
return kernelVersion;
|
|
}
|