Repository navigation
Expand file tree
/
Copy pathPhototonic.cpp
More file actions
3899 lines (3431 loc) · 158 KB
/
Copy pathPhototonic.cpp
File metadata and controls
3899 lines (3431 loc) · 158 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2013-2015 Ofer Kashayov <oferkv@live.com>
* This file is part of Phototonic Image Viewer.
*
* Phototonic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Phototonic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Phototonic. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QActionGroup>
#include <QApplication>
#include <QClipboard>
#include <QCloseEvent>
#include <QDockWidget>
#include <QElapsedTimer>
#include <QFileDialog>
#include <QFileSystemModel>
#include <QInputDialog>
#include <QKeyEvent>
#include <QLabel>
#include <QLineEdit>
#include <QMenu>
#include <QMenuBar>
#include <QMimeData>
#include <QMouseEvent>
#include <QMovie>
#include <QProcess>
#include <QProgressBar>
#include <QProgressDialog>
#include <QPropertyAnimation>
#include <QPushButton>
#include <QRandomGenerator>
#include <QScrollBar>
#include <QSettings>
#include <QSpinBox>
#include <QSocketNotifier>
#include <QStackedLayout>
#include <QStandardPaths>
#include <QStandardItemModel>
#include <QStatusBar>
#include <QTextEdit>
#include <QThread>
#include <QToolBar>
#include <QToolButton>
#include <QToolTip>
#include <QWheelEvent>
#include <QWidgetAction>
#include <unistd.h>
#include "Bookmarks.h"
#include "CopyMoveDialog.h"
#include "CopyMoveToDialog.h"
#include "ColorsDialog.h"
#include "DirCompleter.h"
#include "ExternalAppsDialog.h"
#include "FileSystemTree.h"
#include "GuideWidget.h"
#include "IconProvider.h"
#include "ImageViewer.h"
#include "InfoViewer.h"
#include "MessageBox.h"
#include "MetadataCache.h"
#include "Phototonic.h"
#include "RenameDialog.h"
#include "ResizeDialog.h"
#include "Settings.h"
#include "SettingsDialog.h"
#include "Tags.h"
#include "ThumbsViewer.h"
#if __cplusplus >= 202002L
#define _LCD_ =,this
#else
#define _LCD_ =
#endif
static QString localFile(const QString &fileOrUrl) {
QUrl url(fileOrUrl);
if (url.scheme().isEmpty())
return fileOrUrl;
return url.toLocalFile();
}
Phototonic::Phototonic(QStringList argumentsList, int filesStartAt, QString filter, QWidget *parent) : QMainWindow(parent) {
imageViewer = nullptr;
m_presentationMode = false;
Settings::appSettings = new QSettings("phototonic", "phototonic");
fileSystemModel = new QFileSystemModel(this);
fileSystemModel->setFilter(QDir::AllDirs | QDir::Dirs | QDir::NoDotAndDotDot);
fileSystemModel->setOptions(QFileSystemModel::DontWatchForChanges);
fileSystemModel->setIconProvider(new IconProvider);
setDockOptions(QMainWindow::AllowNestedDocks);
readSettings();
createThumbsViewer();
if (!filter.isEmpty()) {
if (argumentsList.size()) {
QFileInfo firstArgument(localFile(argumentsList.at(filesStartAt)));
if (firstArgument.isDir()) {
// Confusingly we need the absoluteFile and not absolutePath if it's a directory
Settings::currentDirectory = firstArgument.absoluteFilePath();
}
}
if (Settings::currentDirectory.isEmpty())
Settings::currentDirectory = QDir::currentPath();
thumbsViewer->disconnect();
thumbsViewer->selectionModel()->disconnect();
thumbsViewer->reload();
if (thumbsViewer->setFilter(filter)) {
thumbsViewer->filterRows();
for (int i = 0; i < thumbsViewer->model()->rowCount(); ++i) {
if (!thumbsViewer->isRowHidden(i))
printf("%s\n", qPrintable(thumbsViewer->fullPathOf(i)));
}
} else {
qWarning() << "Inalid filter:" << filter;
}
close();
QMetaObject::invokeMethod(qApp, "exit", Qt::QueuedConnection);
return;
}
createActions();
myMainMenu = new QMenu(this);
statusBar()->setVisible(false);
createFileSystemDock();
createBookmarksDock();
createImagePreviewDock();
createThumbviewDock();
createImageTagsDock();
setupDocks();
myMainToolBar = nullptr; // accessed but undesired by …
createMenus(); // createPopupMenu …
createToolBars(); // and created only here
createImageViewer();
m_imageToolBar->setParent(imageViewer);
m_imageToolBar->setVisible(Settings::showViewerToolbar);
positionImageToolbar();
updateExternalApps();
loadShortcuts();
m_statusLabel = new QLabel(this);
m_statusLabel->hide();
m_statusLabel->setMargin(3);
m_statusLabel->setAutoFillBackground(true);
m_statusLabel->setFrameStyle(QFrame::Plain|QFrame::NoFrame);
QPalette pal = m_statusLabel->palette();
pal.setColor(m_statusLabel->backgroundRole(), QColor(0,0,0,192));
pal.setColor(m_statusLabel->foregroundRole(), QColor(255,255,255,192));
connect (thumbsViewer, &ThumbsViewer::currentIndexChanged, this, [this](const QModelIndex ¤t) {
if (!current.isValid())
return;
if (m_infoViewer->isVisible()) {
QStandardItemModel *thumbModel = static_cast<QStandardItemModel*>(thumbsViewer->model());
if (QStandardItem *citem = thumbModel->item(current.row()))
m_infoViewer->hint(tr("Average brightness"), QString::number(citem->data(ThumbsViewer::BrightnessRole).toInt()/255.0f, 'f', 2));
const QString filePath = thumbsViewer->fullPathOf(current.row());
m_infoViewer->read(filePath, thumbsViewer->renderHistogram(filePath, m_logHistogram));
}
if (imageViewer->isVisible()) {
const QString &imagePath = thumbsViewer->fullPathOf(current.row());
if (m_imageInfoAction->isChecked()) {
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
if (!m_infoViewer->isVisible()) {
QStandardItemModel *thumbModel = static_cast<QStandardItemModel*>(thumbsViewer->model());
if (QStandardItem *citem = thumbModel->item(current.row()))
m_infoViewer->hint(tr("Average brightness"), QString::number(citem->data(ThumbsViewer::BrightnessRole).toInt()/255.0f, 'f', 2));
m_infoViewer->read(imagePath);
}
imageViewer->setFeedback(m_infoViewer->html(), false);
}
if (!thumbsViewer->isVisible())
setImageViewerWindowTitle();
imageViewer->loadImage(imagePath, m_slideShowActive ? QImage() : thumbsViewer->icon(current.row()).pixmap(THUMB_SIZE_MAX).toImage());
}
}, Qt::QueuedConnection);
connect(qApp, SIGNAL(focusChanged(QWidget * , QWidget * )), this, SLOT(updateActions()));
QApplication::setWindowIcon(QIcon(":/images/phototonic.png"));
m_centralLayout = new QStackedLayout;
QWidget *stackedLayoutWidget = new QWidget;
m_centralLayout->addWidget(thumbsViewer);
m_centralLayout->addWidget(imageViewer);
stackedLayoutWidget->setLayout(m_centralLayout);
setCentralWidget(stackedLayoutWidget);
restoreGeometry(Settings::value(Settings::optionGeometry, QByteArray()).toByteArray());
restoreState(Settings::value(Settings::optionWindowState, QByteArray()).toByteArray());
processStartupArguments(argumentsList, filesStartAt);
if (Settings::currentDirectory.isEmpty())
Settings::currentDirectory = QDir::currentPath();
m_thumbSizeDelta = 0;
colorsDialog = nullptr;
initComplete = true;
m_deleteInProgress = false;
currentHistoryIdx = -1;
needHistoryRecord = true;
m_reloadPending = false;
m_slideShowActive = false;
refreshThumbs(true);
if (m_centralLayout->currentWidget() == thumbsViewer) {
thumbsViewer->setFocus(Qt::OtherFocusReason);
}
action(QString()); // clear hash
}
void Phototonic::processStartupArguments(QStringList argumentsList, int filesStartAt) {
if (Settings::startupDir == Settings::SpecifiedDir) {
Settings::currentDirectory = Settings::specifiedStartDir;
} else if (Settings::startupDir == Settings::RememberLastDir) {
Settings::currentDirectory = Settings::value(Settings::optionLastDir, QString()).toString();
}
QFile *input = nullptr;
if (filesStartAt < argumentsList.size() && argumentsList.at(filesStartAt) == "-") { // stdin ?
#ifdef Q_OS_WIN
if (!_isatty(_fileno(stdin))) {
#else
if (!isatty(fileno(stdin))) {
#endif
input = new QFile;
QByteArray ba;
if (input->open(stdin, QFile::ReadOnly))
ba = input->readLine();
if (ba.isEmpty()) { // catches /dev/null or <&-
input->close();
delete input;
input = nullptr;
} else { // load first file into list
QString line = QString::fromLocal8Bit(ba.trimmed());
if (!line.isEmpty())
loadStartupFileList(QStringList() << line, 0);
}
}
if (!input)
argumentsList.remove(filesStartAt);
}
if (input) {
QSocketNotifier *snr = new QSocketNotifier(input->handle(), QSocketNotifier::Read, input);
static QStringList newFiles;
static QTimer *bouncer;
if (!bouncer) {
bouncer = new QTimer(this);
bouncer->setInterval(30);
bouncer->setSingleShot(true);
connect(bouncer, &QTimer::timeout, [_LCD_]() {
loadStartupFileList(newFiles, 0);
newFiles.clear();
thumbsViewer->reload(true);
});
if (!Settings::filesList.isEmpty())
bouncer->start(); // for the first file
}
connect (snr, &QSocketNotifier::activated, [_LCD_](){
QByteArray ba = input->readLine();
if (ba.isEmpty()) { // effectively EOF
snr->setEnabled(false);
input->close();
delete input;
// snr->deleteLater(); // segfault
return;
}
QString line = QString::fromLocal8Bit(ba.trimmed());
if (!line.isEmpty()) {
newFiles << line;
if (newFiles.size() < 25) // if we got some batch, let the timer run out to load it
bouncer->start();
}
});
} else if (filesStartAt < argumentsList.size()) {
QFileInfo firstArgument(localFile(argumentsList.at(filesStartAt)));
if (firstArgument.isDir()) {
// Confusingly we need the absoluteFile and not absolutePath if it's a directory
Settings::currentDirectory = firstArgument.absoluteFilePath();
} else if (argumentsList.size() > filesStartAt + 1) {
loadStartupFileList(argumentsList, filesStartAt);
return;
} else {
Settings::currentDirectory = firstArgument.absolutePath();
const QString cliFileName = Settings::currentDirectory + QDir::separator() + firstArgument.fileName();
if (QFile::exists(cliFileName)) {
showViewer();
imageViewer->loadImage(cliFileName);
thumbsViewer->setCurrentIndex(cliFileName);
setWindowTitle(cliFileName + " - Phototonic");
} else {
MessageBox(this).critical(tr("Error"), tr("Failed to open file %1, file not found.").arg(cliFileName));
}
}
}
selectCurrentViewDir();
}
// for singleton update
void Phototonic::setCurrentFileOrDirectory(const QString &path) {
activateWindow();
QFileInfo info(localFile(path));
if (info.isDir()) {
if (Settings::currentDirectory != info.absoluteFilePath())
goTo(info.absoluteFilePath());
} else if (info.exists()) {
showViewer();
imageViewer->loadImage(info.absoluteFilePath());
setWindowTitle(info.absoluteFilePath() + " - Phototonic");
if (Settings::currentDirectory != info.absolutePath())
goTo(info.absolutePath());
thumbsViewer->setCurrentIndex(info.absoluteFilePath());
thumbsViewer->scrollTo(thumbsViewer->currentIndex());
}
}
void Phototonic::loadStartupFileList(QStringList argumentsList, int filesStartAt) {
const int oldSize = Settings::filesList.size();
for (int i = filesStartAt; i < argumentsList.size(); i++) {
QFileInfo file(localFile(argumentsList[i]));
if (!file.exists() || file.isDir())
continue;
QString path = file.canonicalFilePath();
if (path.isEmpty())
path = file.absoluteFilePath();
if (!Settings::filesList.contains(path)) {
Settings::filesList << path;
}
}
if (oldSize == Settings::filesList.size())
return; // stale
if (!oldSize) { // only on first update, don't undo user interactions
QToolButton *btn = static_cast<QToolButton*>(myMainToolBar->widgetForAction(m_goHomeAction));
QMenu *btnmenu = new QMenu(btn);
QAction *act = btnmenu->addAction(tr("Home"));
connect(act, &QAction::triggered, [this]() { goTo(QDir::homePath()); });
//: The file list is the optional list of files in the execution parameters, some virtual directory
act = btnmenu->addAction(tr("File List"));
connect(act, &QAction::triggered, [this]() { goTo("Phototonic::FileList"); });
btn->setMenu(btnmenu);
setFileListMode(true);
}
}
void Phototonic::setFileListMode(bool on) {
Settings::isFileListLoaded = on;
if (on) {
m_includeSubDirsAction->setChecked(false);
fileSystemTree->clearSelection();
}
m_includeSubDirsAction->setEnabled(!on);
}
void Phototonic::createThumbsViewer() {
thumbsViewer = new ThumbsViewer(this);
thumbsViewer->installEventFilter(this);
thumbsViewer->viewport()->installEventFilter(this);
thumbsViewer->thumbsSortFlags = (QDir::SortFlags) Settings::value(Settings::optionThumbsSortFlags, 0).toInt();
connect(thumbsViewer->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
this, SLOT(updateActions()));
connect (thumbsViewer, &ThumbsViewer::status, this, &Phototonic::setStatus);
connect (thumbsViewer, &ThumbsViewer::progress, [this](unsigned int v, unsigned int t) {
m_progressBar->setMaximum(t);
m_progressBar->setValue(v);
});
connect (thumbsViewer, &ThumbsViewer::doubleClicked, this, &Phototonic::loadSelectedThumbImage);
imageInfoDock = new QDockWidget(tr("Image Info"), this);
imageInfoDock->setObjectName("Image Info");
m_infoViewer = new InfoView(this);
imageInfoDock->setWidget(m_infoViewer);
m_logHistogram = false;
connect(imageInfoDock, &QDockWidget::visibilityChanged, [this](bool visible) {
if (!m_presentationMode) {
Settings::imageInfoDockVisible = visible;
}
if (visible) {
QStandardItemModel *thumbModel = static_cast<QStandardItemModel*>(thumbsViewer->model());
int currentRow = thumbsViewer->currentIndex().row();
if (currentRow > -1) {
m_infoViewer->hint(tr("Average brightness"),
QString::number(thumbModel->item(currentRow)->data(ThumbsViewer::BrightnessRole).toInt()/255.0f, 'f', 2));
const QString filePath = thumbsViewer->fullPathOf(currentRow);
m_infoViewer->read(filePath, thumbsViewer->renderHistogram(filePath, m_logHistogram));
}
}
} );
connect(m_infoViewer, &InfoView::histogramClicked, [this](){
m_logHistogram = !m_logHistogram;
int currentRow = thumbsViewer->currentIndex().row();
if (currentRow > -1) {
const QString filePath = thumbsViewer->fullPathOf(currentRow);
m_infoViewer->read(filePath, thumbsViewer->renderHistogram(filePath, m_logHistogram));
}
});
connect(m_infoViewer, &InfoView::exifChanged, [this](const QString &fileName) {
thumbsViewer->updateThumbnail(fileName);
m_imageTags->setSelectedFiles(thumbsViewer->selectedFiles());
});
}
void Phototonic::createImageViewer() {
imageViewer = new ImageViewer(this);
imageViewer->setFocusPolicy(Qt::StrongFocus);
imageViewer->installEventFilter(this);
connect(m_saveAction, SIGNAL(triggered()), imageViewer, SLOT(saveImage()));
connect(m_saveAsAction, SIGNAL(triggered()), imageViewer, SLOT(saveImageAs()));
connect(action("copyImage"), SIGNAL(triggered()), imageViewer, SLOT(copyImage()));
connect(action("pasteImage"), SIGNAL(triggered()), imageViewer, SLOT(pasteImage()));
QAction *rotateMouse = action("rotateMouse");
connect(imageViewer, &ImageViewer::toolsUpdated, [_LCD_](){ rotateMouse->setChecked(Settings::mouseRotateEnabled); });
connect(imageViewer, &ImageViewer::gotFocus, [this](){
if (thumbsViewer->selectionModel()->selectedIndexes().size() < 1)
thumbsViewer->setCurrentIndex(imageViewer->fullImagePath);
});
connect(imageViewer, &ImageViewer::imageSaved, thumbsViewer, &ThumbsViewer::updateThumbnail);
m_editSteps = 0;
connect(imageViewer, &ImageViewer::imageEdited, [this](bool yes) {
m_editSteps = yes ? m_editSteps+1 : 0;
m_saveAction->setEnabled(m_editSteps);
m_saveAsAction->setEnabled(m_editSteps);
});
QMenu *contextMenu = new QMenu(imageViewer);
// Widget actions
imageViewer->addAction(action("toggleSlideShow"));
imageViewer->addAction(action("nextImage"));
imageViewer->addAction(action("prevImage"));
imageViewer->addAction(action("firstImage"));
imageViewer->addAction(action("lastImage"));
imageViewer->addAction(action("randomImage"));
imageViewer->addAction(action("zoomIn"));
imageViewer->addAction(action("zoomOut"));
imageViewer->addAction(action("origZoom"));
imageViewer->addAction(action("resetZoom"));
imageViewer->addAction(action("rotateLeft"));
imageViewer->addAction(action("rotateRight"));
imageViewer->addAction(action("freeRotateLeft"));
imageViewer->addAction(action("freeRotateRight"));
imageViewer->addAction(action("flipH"));
imageViewer->addAction(action("flipV"));
imageViewer->addAction(action("letterbox"));
imageViewer->addAction(action("resize"));
imageViewer->addAction(action("save"));
imageViewer->addAction(action("saveAs"));
imageViewer->addAction(action("copyImage"));
imageViewer->addAction(action("pasteImage"));
imageViewer->addAction(action("moveToTrash"));
imageViewer->addAction(action("delete"));
imageViewer->addAction(action("rename"));
imageViewer->addAction(action("closeImage"));
imageViewer->addAction(action("fullScreen"));
imageViewer->addAction(action("settings"));
imageViewer->addAction(action("keepTransform"));
imageViewer->addAction(action("keepZoom"));
imageViewer->addAction(action("refresh"));
imageViewer->addAction(action("colors"));
imageViewer->addAction(action("moveLeft"));
imageViewer->addAction(action("moveRight"));
imageViewer->addAction(action("moveUp"));
imageViewer->addAction(action("moveDown"));
imageViewer->addAction(action("showClipboard"));
imageViewer->addAction(action("copyTo"));
imageViewer->addAction(action("moveTo"));
imageViewer->addAction(action("open"));
imageViewer->addAction(action("exit"));
imageViewer->addAction(action("showViewerToolbar"));
imageViewer->addAction(action("chooseApp"));
imageViewer->addAction(action("imageinfo"));
imageViewer->addAction(action("showgrid"));
// Actions
contextMenu->addAction(action("setwallpaper"));
contextMenu->addAction(action("openWithMenu"));
contextMenu->addAction(action("imageinfo"));
contextMenu->addSeparator();
contextMenu->addAction(action("showgrid"));
contextMenu->addAction(action("showViewerToolbar"));
QMenu *menu = contextMenu->addMenu(tr("Navigate"));
menu->addAction(action("nextImage"));
menu->addAction(action("prevImage"));
menu->addAction(action("firstImage"));
menu->addAction(action("lastImage"));
menu->addAction(action("randomImage"));
menu->addAction(action("toggleSlideShow"));
menu = contextMenu->addMenu(tr("Transform"));
QMenu *submenu = menu->addMenu(QIcon::fromTheme("zoom-fit-best", QIcon(":/images/zoom-fit-best.png")), tr("Zoom"));
submenu->addAction(action("zoomIn"));
submenu->addAction(action("zoomOut"));
submenu->addAction(action("origZoom"));
submenu->addAction(action("resetZoom"));
submenu->addAction(action("keepZoom"));
submenu = menu->addMenu(tr("Flip and Flop and Rotate"));
submenu->addAction(action("flipH"));
submenu->addAction(action("flipV"));
submenu->addSeparator();
submenu->addAction(action("rotateLeft"));
submenu->addAction(action("rotateRight"));
submenu->addAction(action("freeRotateLeft"));
submenu->addAction(action("freeRotateRight"));
submenu->addSeparator();
submenu->addAction(action("keepTransform"));
menu = contextMenu->addMenu(tr("Edit"));
menu->setObjectName("image_edit_menu");
menu->addAction(action("resize"));
menu->addAction(action("colors"));
menu->addAction(action("crop"));
menu->addSeparator();
menu->addAction(action("blackout"));
menu->addAction(action("cartouche"));
menu->addAction(action("annotate"));
menu = contextMenu->addMenu(tr("File"));
menu->addAction(action("copyTo"));
menu->addAction(action("moveTo"));
menu->addAction(action("save"));
menu->addAction(action("saveAs"));
menu->addAction(action("rename"));
menu->addSeparator();
menu->addAction(action("removeMetadata"));
menu->addAction(action("moveToTrash"));
menu->addAction(action("delete"));
menu = contextMenu->addMenu(tr("View"));
menu->addAction(action("fullScreen"));
menu->addSeparator();
menu->addAction(action("letterbox"));
//: The guides a lines across the image for orientation
submenu = menu->addMenu(tr("Guides"));
QAction *act = new QAction(tr("Add vertical guide"), submenu);
connect(act, &QAction::triggered, [this]() { new GuideWidget(imageViewer, Qt::Vertical, imageViewer->contextSpot().x()); });
submenu->addAction(act);
act = new QAction(tr("Add horizontal guide"), submenu);
connect(act, &QAction::triggered, [this]() { new GuideWidget(imageViewer, Qt::Horizontal, imageViewer->contextSpot().y()); });
submenu->addAction(act);
menu->addSeparator();
menu->addAction(action("showClipboard"));
menu->addSeparator();
menu->addAction(action("refresh"));
contextMenu->addSeparator();
contextMenu->addAction(action("copyImage"));
contextMenu->addAction(action("pasteImage"));
contextMenu->addSeparator();
contextMenu->addAction(action("closeImage"));
imageViewer->setContextMenuPolicy(Qt::DefaultContextMenu);
imageViewer->setContextMenu(contextMenu);
Settings::isFullScreen = Settings::value(Settings::optionFullScreenMode, false).toBool();
m_fullScreenAction->setChecked(Settings::isFullScreen);
}
void Phototonic::createActions() {
#define MAKE_ACTION_NOSC(_TEXT_, _NAME_) \
action = new QAction(_TEXT_, this); action->setObjectName(_NAME_)
#define MAKE_ACTION(_TEXT_, _NAME_, _SHORTCUT_) \
MAKE_ACTION_NOSC(_TEXT_, _NAME_); action->setProperty("sc_default", _SHORTCUT_)
#define SET_ICON(_ICON_) action->setProperty("icon_name", #_ICON_)
QAction *action;
MAKE_ACTION(tr("Top"), "thumbsGoTop", "Ctrl+Home");
SET_ICON(go-top);
connect(action, &QAction::triggered, thumbsViewer, &ThumbsViewer::scrollToTop);
MAKE_ACTION(tr("Bottom"), "thumbsGoBottom", "Ctrl+End");
SET_ICON(go-bottom);
connect(action, &QAction::triggered, thumbsViewer, &ThumbsViewer::scrollToBottom);
m_closeImageAction = MAKE_ACTION(tr("Close Viewer"), "closeImage", "Esc");
connect(action, SIGNAL(triggered()), this, SLOT(hideViewer()));
m_fullScreenAction = MAKE_ACTION(tr("Full Screen"), "fullScreen", "Alt+Return");
action->setCheckable(true);
connect(action, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
MAKE_ACTION(tr("Preferences"), "settings", "Ctrl+P");
SET_ICON(preferences-system);
connect(action, SIGNAL(triggered()), this, SLOT(showSettings()));
MAKE_ACTION(tr("Exit"), "exit", "Ctrl+Q");
connect(action, SIGNAL(triggered()), this, SLOT(close()));
MAKE_ACTION_NOSC(tr("Enlarge Thumbnails"), "thumbsZoomIn");
connect(action, &QAction::triggered, [this]() {m_thumbSizeDelta = 1; resizeThumbs();});
SET_ICON(zoom-in);
if (thumbsViewer->thumbSize == THUMB_SIZE_MAX) {
action->setEnabled(false);
}
MAKE_ACTION_NOSC(tr("Shrink Thumbnails"), "thumbsZoomOut");
connect(action, &QAction::triggered, [this]() {m_thumbSizeDelta = -1; resizeThumbs();});
SET_ICON(zoom-out);
if (thumbsViewer->thumbSize == THUMB_SIZE_MIN) {
action->setEnabled(false);
}
m_cutAction = MAKE_ACTION(tr("Cut"), "cut", "Ctrl+X");
SET_ICON(edit-cut);
connect(action, &QAction::triggered, [this]() { copyOrCutThumbs(false); });
action->setEnabled(false);
m_copyAction = MAKE_ACTION(tr("Copy"), "copy", "Ctrl+C");
SET_ICON(edit-copy);
connect(action, &QAction::triggered, [this]() { copyOrCutThumbs(true); });
action->setEnabled(false);
MAKE_ACTION_NOSC(tr("Show classic thumbnails"), "setClassicThumbs");
action->setCheckable(true);
action->setChecked(Settings::thumbsLayout == ThumbsViewer::Classic);
connect(action, &QAction::triggered, [this](){ Settings::thumbsLayout = ThumbsViewer::Classic; thumbsViewer->refreshThumbs(); });
MAKE_ACTION_NOSC(tr("Show square thumbnails"), "setSquareThumbs");
action->setCheckable(true);
action->setChecked(Settings::thumbsLayout == ThumbsViewer::Squares);
connect(action, &QAction::triggered, [this](){ Settings::thumbsLayout = ThumbsViewer::Squares; thumbsViewer->refreshThumbs(); });
MAKE_ACTION_NOSC(tr("Show compact thumbnails"), "setCompactThumbs");
action->setCheckable(true);
action->setChecked(Settings::thumbsLayout == ThumbsViewer::Compact);
connect(action, &QAction::triggered, [this](){ Settings::thumbsLayout = ThumbsViewer::Compact; thumbsViewer->refreshThumbs(); });
m_copyToAction = MAKE_ACTION(tr("Copy to..."), "copyTo", "Ctrl+Y");
connect(action, &QAction::triggered, [this]() { copyOrMoveImages(true); });
m_moveToAction = MAKE_ACTION(tr("Move to..."), "moveTo", "Ctrl+M");
connect(action, &QAction::triggered, [this]() { copyOrMoveImages(false); });
m_trashAction = MAKE_ACTION(tr("Move to Trash"), "moveToTrash", "Del");
action->setIcon(style()->standardIcon(QStyle::SP_TrashIcon));
connect(action, SIGNAL(triggered()), this, SLOT(deleteOperation()));
m_deleteAction = MAKE_ACTION(tr("Delete"), "delete", "Shift+Del");
SET_ICON(edit-delete);
connect(action, SIGNAL(triggered()), this, SLOT(deletePermanentlyOperation()));
m_saveAction = MAKE_ACTION(tr("Save"), "save", "Ctrl+S");
SET_ICON(document-save);
action->setEnabled(false);
m_saveAsAction = MAKE_ACTION_NOSC(tr("Save As"), "saveAs");
SET_ICON(document-save-as);
action->setEnabled(false);
MAKE_ACTION(tr("Copy Image"), "copyImage", "Ctrl+Shift+C");
MAKE_ACTION(tr("Paste Image"), "pasteImage", "Ctrl+Shift+V");
MAKE_ACTION(tr("Rename"), "rename", "F2");
connect(action, SIGNAL(triggered()), this, SLOT(rename()));
MAKE_ACTION_NOSC(tr("Remove Metadata"), "removeMetadata");
connect(action, SIGNAL(triggered()), this, SLOT(removeMetadata()));
MAKE_ACTION_NOSC(tr("Regenerate Thumbnail"), "regenerateThumbnail");
connect(action, SIGNAL(triggered()), this, SLOT(regenerateThumbnails()));
MAKE_ACTION_NOSC(tr("Select All"), "selectAll");
connect(action, SIGNAL(triggered()), this, SLOT(selectAllThumbs()));
MAKE_ACTION_NOSC(tr("About"), "about");
connect(action, &QAction::triggered, [this](){MessageBox(this).about();});
// Sort actions
#define CHECKABLE_SORT action->setCheckable(true); connect(action, SIGNAL(triggered()), this, SLOT(sortThumbnails()));
QAction *sortByName, *sortByTime, *sortBySize, *sortByType, *sortByDuplicate;
sortByName = MAKE_ACTION_NOSC(tr("Sort by Name"), "sortByName");
CHECKABLE_SORT
sortByDuplicate = MAKE_ACTION_NOSC(tr("Sort by Duplicate Group"), "sortByDuplicate");
CHECKABLE_SORT
sortByTime = MAKE_ACTION_NOSC(tr("Sort by Time"), "sortByTime");
CHECKABLE_SORT
MAKE_ACTION_NOSC(tr("Sort by Time") + " (Exif)", "sortByExifTime");
CHECKABLE_SORT
sortBySize = MAKE_ACTION_NOSC(tr("Sort by Size"), "sortBySize");
CHECKABLE_SORT
sortByType = MAKE_ACTION_NOSC(tr("Sort by Type"), "sortByType");
CHECKABLE_SORT
MAKE_ACTION_NOSC(tr("Sort by Similarity"), "sortBySimilarity");
CHECKABLE_SORT
MAKE_ACTION_NOSC(tr("Sort by Brightness"), "sortByBrightness");
CHECKABLE_SORT
MAKE_ACTION_NOSC(tr("Sort by Color"), "sortByColor");
CHECKABLE_SORT
if (thumbsViewer->thumbsSortFlags & QDir::Time)
sortByTime->setChecked(true);
else if (thumbsViewer->thumbsSortFlags & QDir::Size)
sortBySize->setChecked(true);
else if (thumbsViewer->thumbsSortFlags & QDir::Type)
sortByType->setChecked(true);
else
sortByName->setChecked(true);
sortByDuplicate->setVisible(false);
MAKE_ACTION_NOSC(tr("Reverse Sort Order"), "sortReverse");
CHECKABLE_SORT
action->setChecked(thumbsViewer->thumbsSortFlags & QDir::Reversed);
MAKE_ACTION(tr("Show Hidden Files"), "showHidden", "Ctrl+H");
action->setCheckable(true);
action->setChecked(Settings::showHiddenFiles);
connect(action, SIGNAL(triggered()), this, SLOT(showHiddenFiles()));
MAKE_ACTION_NOSC(tr("Small Toolbar Icons"), "smallToolbarIcons");
action->setCheckable(true);
action->setChecked(Settings::smallToolbarIcons);
connect(action, SIGNAL(triggered()), this, SLOT(setToolbarIconSize()));
MAKE_ACTION_NOSC(tr("Hide Dock Title Bars"), "lockDocks");
action->setCheckable(true);
action->setChecked(Settings::hideDockTitlebars);
connect(action, SIGNAL(triggered()), this, SLOT(lockDocks()));
MAKE_ACTION_NOSC(tr("Show Toolbar"), "showViewerToolbar");
action->setCheckable(true);
action->setChecked(Settings::showViewerToolbar);
connect(action, &QAction::triggered, [this,action]() {
Settings::showViewerToolbar = action->isChecked();
m_imageToolBar->setVisible(Settings::showViewerToolbar);
positionImageToolbar();
});
m_refreshAction = MAKE_ACTION(tr("Reload"), "refresh", "F5");
SET_ICON(view-refresh);
connect(action, SIGNAL(triggered()), this, SLOT(reload()));
m_includeSubDirsAction = MAKE_ACTION_NOSC(tr("Include Sub-directories"), "includeSubDirs");
action->setIcon(QIcon(":/images/tree.png"));
action->setCheckable(true);
connect(action, SIGNAL(triggered()), this, SLOT(setIncludeSubDirs()));
MAKE_ACTION(tr("Paste Here"), "paste", "Ctrl+V");
SET_ICON(edit-paste);
connect(action, SIGNAL(triggered()), this, SLOT(pasteThumbs()));
action->setEnabled(false);
MAKE_ACTION_NOSC(tr("New Directory"), "createDir");
connect(action, SIGNAL(triggered()), this, SLOT(createSubDirectory()));
SET_ICON(folder-new);
MAKE_ACTION_NOSC(tr("Set Save Directory"), "setSaveDir");
connect(action, SIGNAL(triggered()), this, SLOT(setSaveDirectory()));
SET_ICON(folder-visiting);
m_goBackAction = MAKE_ACTION(tr("Back"), "goBack", "Alt+Left");
m_goBackAction->setIcon(QIcon::fromTheme("go-previous", QIcon(":/images/go-previous.png")));
connect(m_goBackAction, &QAction::triggered, this, [this]() {
if (currentHistoryIdx < 1)
return;
needHistoryRecord = false;
goTo(pathHistoryList.at(--currentHistoryIdx));
m_goFrwdAction->setEnabled(true);
if (currentHistoryIdx == 0)
m_goBackAction->setEnabled(false);
});
m_goBackAction->setEnabled(false);
m_goFrwdAction = MAKE_ACTION(tr("Forward"), "goFrwd", "Alt+Right");
m_goFrwdAction->setIcon(QIcon::fromTheme("go-next", QIcon(":/images/go-next.png")));
connect(m_goFrwdAction, &QAction::triggered, this, [this]() {
if (currentHistoryIdx > pathHistoryList.size() - 2)
return;
needHistoryRecord = false;
goTo(pathHistoryList.at(++currentHistoryIdx));
if (currentHistoryIdx == (pathHistoryList.size() - 1))
m_goFrwdAction->setEnabled(false);
});
m_goFrwdAction->setEnabled(false);
m_goUpAction = MAKE_ACTION(tr("Go Up"), "up", "Alt+Up");
SET_ICON(go-up);
connect(action, &QAction::triggered, [this](){ goTo(QFileInfo(Settings::currentDirectory).dir().absolutePath()); });
m_goHomeAction = MAKE_ACTION_NOSC(tr("Home"), "goHome");
connect(action, &QAction::triggered, [this](){
if (Settings::isFileListLoaded || Settings::filesList.isEmpty() || Settings::currentDirectory != QDir::homePath())
goTo(QDir::homePath());
else
goTo("Phototonic::FileList");
});
SET_ICON(go-home);
MAKE_ACTION(tr("Slide Show"), "toggleSlideShow", "Ctrl+W");
connect(action, &QAction::triggered, this, [this]() { setSlideShow(!m_slideShowActive); });
SET_ICON(media-playback-start);
m_nextImageAction = MAKE_ACTION(tr("Next Image"), "nextImage", "PgDown");
SET_ICON(go-next);
connect(action, &QAction::triggered, [this](){ loadImage(Phototonic::Next); });
m_prevImageAction = MAKE_ACTION(tr("Previous Image"), "prevImage", "PgUp");
SET_ICON(go-previous);
connect(action, &QAction::triggered, [this](){ loadImage(Phototonic::Previous); });
MAKE_ACTION(tr("First Image"), "firstImage", "Home");
SET_ICON(go-first);
connect(action, &QAction::triggered, [this](){ loadImage(Phototonic::First); });
MAKE_ACTION(tr("Last Image"), "lastImage", "End");
SET_ICON(go-last);
connect(action, &QAction::triggered, [this](){ loadImage(Phototonic::Last); });
MAKE_ACTION(tr("Random Image"), "randomImage", "Ctrl+D");
connect(action, &QAction::triggered, [this](){ loadImage(Phototonic::Random); });
m_viewImageAction = MAKE_ACTION(tr("View Image"), "open", "Return");
SET_ICON(document-open);
connect(action, SIGNAL(triggered()), this, SLOT(viewImage()));
MAKE_ACTION_NOSC(tr("Load Clipboard"), "showClipboard");
SET_ICON(insert-image);
connect(action, SIGNAL(triggered()), this, SLOT(newImage()));
m_wallpaperAction = MAKE_ACTION_NOSC(tr("Set Wallpaper"), "setwallpaper");
connect(action, &QAction::triggered, this, &Phototonic::runExternalApp);
openWithSubMenu = new QMenu(tr("Open With..."));
m_openWithMenuAction = MAKE_ACTION_NOSC(tr("Open With..."), "openWithMenu");
action->setMenu(openWithSubMenu);
MAKE_ACTION_NOSC(tr("External Applications"), "chooseApp");
action->setIcon(QIcon::fromTheme("preferences-other", QIcon(":/images/preferences-system.png")));
connect(action, SIGNAL(triggered()), this, SLOT(chooseExternalApp()));
MAKE_ACTION_NOSC(tr("Add Bookmark"), "addBookmark");
action->setIcon(QIcon(":/images/new_bookmark.png"));
connect(action, &QAction::triggered, [this](){ addBookmark(getSelectedPath()); });
MAKE_ACTION_NOSC(tr("Delete Bookmark"), "removeBookmark");
SET_ICON(edit-delete);
MAKE_ACTION(tr("Zoom Out"), "zoomOut", "-");
connect(action, &QAction::triggered, [this](){ zoom(-1.0f); });
SET_ICON(zoom-out);
MAKE_ACTION(tr("Zoom In"), "zoomIn", "+");
connect(action, &QAction::triggered, [this](){ zoom(1.0f); });
SET_ICON(zoom-in);
MAKE_ACTION(tr("Reset Zoom"), "resetZoom", "*");
SET_ICON(zoom-fit-best);
connect(action, &QAction::triggered, this, [this](){
imageViewer->zoomTo(imageViewer->zoomMode() == ImageViewer::ZoomToFit ?
ImageViewer::ZoomToFill :
ImageViewer::ZoomToFit);
});
MAKE_ACTION(tr("Original Size"), "origZoom", "/");
SET_ICON(zoom-original);
connect(action, &QAction::triggered, this, [this](){ imageViewer->zoomTo(ImageViewer::ZoomOriginal); });
MAKE_ACTION_NOSC(tr("Keep Zoom"), "keepZoom");
action->setCheckable(true);
connect(action, &QAction::toggled, this, [this](bool keep) {imageViewer->lockZoom(keep);});
MAKE_ACTION(tr("Rotate 90° CCW"), "rotateLeft", "Ctrl+Left");
SET_ICON(object-rotate-left);
connect(action, &QAction::triggered, this, [this]() { rotate(-90); });
MAKE_ACTION(tr("Rotate 90° CW"), "rotateRight", "Ctrl+Right");
SET_ICON(object-rotate-right);
connect(action, &QAction::triggered, this, [this]() { rotate(+90); });
MAKE_ACTION_NOSC(tr("Rotate with mouse"), "rotateMouse");
SET_ICON(rotation-allowed);
action->setCheckable(true);
connect(action, &QAction::triggered, [this,action](){
Settings::mouseRotateEnabled = action->isChecked();
imageViewer->setFeedback(tr("Or try holding Shift"));
});
MAKE_ACTION(tr("Flip Horizontally"), "flipH", "Ctrl+Down");
SET_ICON(object-flip-horizontal);
connect(action, SIGNAL(triggered()), this, SLOT(flipHorizontal()));
MAKE_ACTION(tr("Flip Vertically"), "flipV", "Ctrl+Up");
SET_ICON(object-flip-vertical);
connect(action, SIGNAL(triggered()), this, SLOT(flipVertical()));
MAKE_ACTION(tr("Letterbox"), "letterbox", "Ctrl+G");
action->setIcon(QIcon(":/images/crop.png"));
connect(action, SIGNAL(triggered()), this, SLOT(cropImage()));
MAKE_ACTION(tr("Scale Image"), "resize", "Ctrl+I");
SET_ICON(transform-scale);
connect(action, SIGNAL(triggered()), this, SLOT(scaleImage()));
MAKE_ACTION(tr("Rotate 1° CCW"), "freeRotateLeft", "Ctrl+Shift+Left");
connect(action, &QAction::triggered, this, [this]() { freeRotate(-1); });
MAKE_ACTION(tr("Rotate 1° CW"), "freeRotateRight", "Ctrl+Shift+Right");
connect(action, &QAction::triggered, this, [this]() { freeRotate(+1); });
MAKE_ACTION(tr("Colors"), "colors", "Ctrl+O");
connect(action, SIGNAL(triggered()), this, SLOT(showColorsDialog()));
action->setIcon(QIcon(":/images/colors.png"));
MAKE_ACTION_NOSC(tr("Crop"), "crop");
action->setIcon(QIcon(":/images/crop.png"));
connect(action, &QAction::triggered, [this](){ imageViewer->setEditMode(ImageViewer::Crop); });
MAKE_ACTION_NOSC(tr("Blackout"), "blackout");
action->setIcon(QIcon(":/images/blackout.png"));
connect(action, &QAction::triggered, [this](){ imageViewer->setEditMode(ImageViewer::Blackout); });
MAKE_ACTION_NOSC(tr("Cartouche"), "cartouche");
action->setIcon(QIcon(":/images/cartouche.png"));
connect(action, &QAction::triggered, [this](){ imageViewer->setEditMode(ImageViewer::Cartouche); });
MAKE_ACTION_NOSC(tr("Annotate"), "annotate");
action->setIcon(QIcon(":/images/annotate.png"));
connect(action, &QAction::triggered, [this](){ imageViewer->setEditMode(ImageViewer::Annotate); });
m_findDupesAction = MAKE_ACTION_NOSC(tr("Find Duplicate Images"), "findDupes");
action->setIcon(QIcon(":/images/duplicates.png"));
action->setCheckable(true);
connect(action, &QAction::triggered, [_LCD_]() {
if (action->isChecked()) {
sortByDuplicate->setVisible(true);
sortByDuplicate->setChecked(true);
// scenario: user enters a filter and clicks the duplicate button
QString error;
if (!thumbsViewer->setFilter(filterLineEdit->text(), &error))
QToolTip::showText(filterLineEdit->mapToGlobal(QPoint(0, filterLineEdit->height()*6/5)),
error, filterLineEdit);
} else {
sortByDuplicate->setVisible(false);
sortByName->setChecked(true);
}
refreshThumbs(true);
});
MAKE_ACTION(tr("Keep Transformations"), "keepTransform", "Ctrl+K");
action->setCheckable(true);
connect(action, &QAction::triggered, [this,action](){ imageViewer->keepTransformation(action->isChecked()); });
m_moveLeftAction = MAKE_ACTION(tr("Slide Image Left"), "moveLeft", "Left");
connect(action, &QAction::triggered, [this](){ imageViewer->slideImage(QPoint(50, 0)); });
m_moveRightAction = MAKE_ACTION(tr("Slide Image Right"), "moveRight", "Right");
connect(action, &QAction::triggered, [this](){ imageViewer->slideImage(QPoint(-50, 0)); });
m_moveUpAction = MAKE_ACTION(tr("Slide Image Up"), "moveUp", "Up");
connect(action, &QAction::triggered, [this](){ imageViewer->slideImage(QPoint(0, 50)); });
m_moveDownAction = MAKE_ACTION(tr("Slide Image Down"), "moveDown", "Down");
connect(action, &QAction::triggered, [this](){ imageViewer->slideImage(QPoint(0, -50)); });
MAKE_ACTION_NOSC(tr("Invert Selection"), "invertSelection");
connect(action, SIGNAL(triggered()), thumbsViewer, SLOT(invertSelection()));
// There could be a Batch submenu if we had any more items to put there
// QMenu *batchSubMenu = new QMenu(tr("Batch"));
// batchSubMenuAction = new QAction(tr("Batch"), this);
// batchSubMenuAction->setMenu(batchSubMenu);
m_batchTransformAction = MAKE_ACTION_NOSC(tr("Rotate and Crop images"), "batchTransform");
connect(action, SIGNAL(triggered()), this, SLOT(batchTransform()));
// batchSubMenu->addAction(batchTransformAction);
MAKE_ACTION(tr("Filter by Name"), "filterImagesFocus", "Ctrl+F");
connect(action, SIGNAL(triggered()), this, SLOT(filterImagesFocus()));
MAKE_ACTION(tr("Edit Current Path"), "setPathFocus", "Ctrl+L");
connect(action, SIGNAL(triggered()), this, SLOT(setPathFocus()));
m_imageInfoAction = MAKE_ACTION_NOSC(tr("Image Info"), "imageinfo");
action->setCheckable(true);
connect(action, &QAction::triggered, [this,action]() {
if (action->isChecked()) {
m_infoViewer->read(imageViewer->fullImagePath);
imageViewer->setFeedback(m_infoViewer->html(), false);
} else {
imageViewer->setFeedback("", false);
}
});