Add local history for last screenshots

This commit is contained in:
Yuriy Puchkov
2020-07-16 16:36:15 +03:00
committed by Yuriy Puchkov
parent c84db1fa03
commit 5861b21fcf
14 changed files with 335 additions and 29 deletions

View File

@@ -22,14 +22,19 @@
#include "src/config/configwindow.h"
#include "src/widgets/capture/capturebutton.h"
#include "src/widgets/capturelauncher.h"
#include "src/widgets/notificationwidget.h"
#include "src/utils/systemnotification.h"
#include "src/utils/screengrabber.h"
#include "src/utils/history.h"
#include "src/utils/configenterprise.h"
#include "src/tools/historywidget.h"
#include <QFile>
#include <QApplication>
#include <QSystemTrayIcon>
#include <QAction>
#include <QMenu>
#include <QDesktopWidget>
#include <QClipboard>
#ifdef Q_OS_WIN
#include "src/core/globalshortcutfilter.h"
@@ -171,6 +176,8 @@ void Controller::enableTrayIcon() {
if (m_trayIcon) {
return;
}
QMenu *trayIconMenu = new QMenu();
ConfigHandler().setDisabledTrayIcon(false);
QAction *captureAction = new QAction(tr("&Take Screenshot"), this);
connect(captureAction, &QAction::triggered, this, [this](){
@@ -180,6 +187,7 @@ void Controller::enableTrayIcon() {
QAction *launcherAction = new QAction(tr("&Open Launcher"), this);
connect(launcherAction, &QAction::triggered, this,
&Controller::openLauncherWindow);
QAction *configAction = new QAction(tr("&Configuration"), this);
connect(configAction, &QAction::triggered, this,
&Controller::openConfigWindow);
@@ -190,10 +198,16 @@ void Controller::enableTrayIcon() {
connect(quitAction, &QAction::triggered, qApp,
&QCoreApplication::quit);
QMenu *trayIconMenu = new QMenu();
// recent screenshots
QAction *recentAction = new QAction(tr("&Recent Screenshot"), this);
connect(recentAction, SIGNAL(triggered()), this, SLOT(showRecentScreenshots()));
// generate menu
trayIconMenu->addAction(captureAction);
trayIconMenu->addAction(launcherAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(recentAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(configAction);
trayIconMenu->addAction(infoAction);
trayIconMenu->addSeparator();
@@ -239,6 +253,11 @@ void Controller::updateConfigComponents() {
}
}
void Controller::showRecentScreenshots() {
HistoryWidget *pHistory = new HistoryWidget();
pHistory->show();
}
void Controller::startFullscreenCapture(const uint id) {
bool ok = true;
QPixmap p(ScreenGrabber().grabEntireDesktop(ok));