Some bugfixes

This commit is contained in:
ArsenArsen 2017-04-29 09:44:30 +02:00
parent 3201a7c584
commit 25d33a7209
4 changed files with 9 additions and 6 deletions

View File

@ -26,7 +26,6 @@ CropEditor::~CropEditor()
{ {
delete scene; delete scene;
delete view; delete view;
delete pixmap;
delete pixmapItem; delete pixmapItem;
} }

View File

@ -50,8 +50,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
connect(tray, &QSystemTrayIcon::activated, this, [this](QSystemTrayIcon::ActivationReason reason) { connect(tray, &QSystemTrayIcon::activated, this, [this](QSystemTrayIcon::ActivationReason reason) {
if (reason == QSystemTrayIcon::DoubleClick) toggleVisible(); if (reason == QSystemTrayIcon::DoubleClick) toggleVisible();
}); });
connect(fullscreen, &QAction::triggered, this, &MainWindow::on_actionFullscreen_triggered); connect(fullscreen, &QAction::triggered, this, [] { screenshotter::area(); });
connect(area, &QAction::triggered, this, &MainWindow::on_actionArea_triggered); connect(area, &QAction::triggered, this, [] { screenshotter::area(); });
tray->setContextMenu(menu); tray->setContextMenu(menu);
ui->uploaderList->setSelectionBehavior(QAbstractItemView::SelectRows); ui->uploaderList->setSelectionBehavior(QAbstractItemView::SelectRows);
@ -81,8 +81,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
ui->hotkeys->setSelectionMode(QListWidget::SingleSelection); ui->hotkeys->setSelectionMode(QListWidget::SingleSelection);
addHotkeyItem("Fullscreen image", "fullscreen", new std::function<void()>([&] { on_actionFullscreen_triggered(); })); addHotkeyItem("Fullscreen image", "fullscreen", new std::function<void()>([] { screenshotter::fullscreen(); }));
addHotkeyItem("Area image", "area", new std::function<void()>([&] { on_actionArea_triggered(); })); addHotkeyItem("Area image", "area", new std::function<void()>([] { screenshotter::area(); }));
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()

View File

@ -9,7 +9,10 @@
void screenshotter::area() void screenshotter::area()
{ {
CropEditor *editor = new CropEditor(screenshotutil::fullscreen()); CropEditor *editor = new CropEditor(screenshotutil::fullscreen());
QObject::connect(editor, &CropEditor::cropped, [&](QPixmap *pixmap) { UploaderSingleton::inst().upload(pixmap); }); QObject::connect(editor, &CropEditor::cropped, [&](QPixmap *pixmap) {
UploaderSingleton::inst().upload(pixmap);
delete editor;
});
} }
void screenshotter::fullscreen() void screenshotter::fullscreen()

View File

@ -61,6 +61,7 @@ void UploaderSingleton::upload(QPixmap *pixmap)
} }
} }
uploaders.value(uploader)->doUpload(pixmap); uploaders.value(uploader)->doUpload(pixmap);
delete pixmap;
} }
QList<Uploader *> UploaderSingleton::uploaderList() QList<Uploader *> UploaderSingleton::uploaderList()