Skip to content

Commit

Permalink
improve behavior for tool windows and scroll bars, add 2 menus, 2 bug…
Browse files Browse the repository at this point in the history
…fixed

- improve behavior
    - tool windows such as Catalog/Folder Window
    - If scroll bars are required only for width or height of an image, only the scroll bars that are required are displayed.
    - can Scroll images with cursor keys when to show scrollbars
- add 'Don't update history'
- add 'Show full path of the volume'
- bugfixed: The left end was not displayed when the image is larger than the screen
- bugfixed: prevent to crash on incorrect file
  • Loading branch information
kanryu committed Sep 20, 2017
1 parent 8b6ff79 commit 57605f8
Show file tree
Hide file tree
Showing 15 changed files with 323 additions and 176 deletions.
10 changes: 5 additions & 5 deletions QuickViewer/QuickViewer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contains(DEFINES, QV_WITHOUT_OPENGL) {
QT += opengl opengl-private
}

VERSION = 0.9.7
VERSION = 0.9.8

TARGET = QuickViewer
TEMPLATE = app
Expand Down Expand Up @@ -110,7 +110,6 @@ SOURCES += \
src/renamedialog.cpp \
src/widgets/flowlayout.cpp \
src/widgets/pageslider.cpp \
src/widgets/shortcutbutton.cpp \
src/qlanguageselector/qlanguageselector.cpp \
src/qnamedpipe/qnamedpipe.cpp \
src/qfullscreenframe/qinnerframe.cpp \
Expand All @@ -120,7 +119,8 @@ SOURCES += \
src/qactionmanager/keyconfigdialog.cpp \
src/qactionmanager/mouseconfigdialog.cpp \
src/qactionmanager/qactionmanager.cpp \
src/qactionmanager/qmousesequence.cpp
src/qactionmanager/qmousesequence.cpp \
src/qactionmanager/shortcutbutton.cpp \


HEADERS += \
Expand Down Expand Up @@ -149,7 +149,6 @@ HEADERS += \
src/stdafx.h \
src/widgets/flowlayout.h \
src/widgets/pageslider.h \
src/widgets/shortcutbutton.h \
src/qlanguageselector/qlanguageselector.h \
src/qnamedpipe/qnamedpipe.h \
src/qfullscreenframe/qinnerframe.h \
Expand All @@ -159,7 +158,8 @@ HEADERS += \
src/qactionmanager/keyconfigdialog.h \
src/qactionmanager/mouseconfigdialog.h \
src/qactionmanager/qactionmanager.h \
src/qactionmanager/qmousesequence.h
src/qactionmanager/qmousesequence.h \
src/qactionmanager/shortcutbutton.h \

win32 {
INCLUDEPATH += ../AssociateFilesWithQuickViewer
Expand Down
Binary file added QuickViewer/icons/child_separate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
155 changes: 91 additions & 64 deletions QuickViewer/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ MainWindow::MainWindow(QWidget *parent)

ui->actionAutoLoaded->setChecked(qApp->AutoLoaded());
ui->actionShowFullpathOfVolume->setChecked(qApp->ShowFullpathOfVolume());
ui->actionSavingHistory->setChecked(qApp->SavingHistory());
ui->actionSavingHistory->setChecked(qApp->DontSavingHistory());

ui->actionDontEnlargeSmallImagesOnFitting->setChecked(qApp->DontEnlargeSmallImagesOnFitting());
ui->actionRestoreWindowState->setChecked(qApp->RestoreWindowState());
ui->actionBeginAsFullscreen->setChecked(qApp->BeginAsFullscreen());
ui->actionShowFullscreenSignage->setChecked(qApp->ShowFullscreenSignage());
ui->actionShowPanelSeparateWindow->setChecked(qApp->ShowPanelSeparateWindow());
// ui->actionShowFullscreenTitleBar->setChecked(qApp->ShowFullscreenTitleBar());

// Languages
Expand Down Expand Up @@ -462,7 +463,7 @@ void MainWindow::onActionExit_triggered()

void MainWindow::onSavingHistory_triggered(bool enable)
{
qApp->setSavingHistory(enable);
qApp->setDontSavingHistory(enable);
}

void MainWindow::onShowFullpathOfVolume_triggered(bool enable)
Expand Down Expand Up @@ -570,6 +571,82 @@ void MainWindow::resetShortCut(const QString name, const QString shortcuttext, b
a->setShortcuts(seqlist);
}

void MainWindow::createCatalogWindow(bool docked)
{
if(m_catalogWindow)
onCatalogWindow_closed();
if(docked) {
if(m_folderWindow && m_folderWindow->parent())
onFolderWindow_closed();
if(m_exifDialog && m_exifDialog->parent())
onExifDialog_closed();
m_catalogWindow = new CatalogWindow(nullptr, ui);
m_catalogWindow->setThumbnailManager(m_thumbManager);
connect(m_catalogWindow, SIGNAL(closed()), this, SLOT(onCatalogWindow_closed()));
connect(m_catalogWindow, SIGNAL(openVolume(QString)), this, SLOT(onCatalogWindow_openVolume(QString)));
ui->catalogSplitter->insertWidget(0, m_catalogWindow);
auto sizes = ui->catalogSplitter->sizes();
int sum = sizes[0]+sizes[1];
sizes[0] = 200;
sizes[1] = sum-sizes[0];
ui->catalogSplitter->setSizes(sizes);
m_catalogWindow->setAsInnerWidget();
} else {
m_catalogWindow = new CatalogWindow(nullptr, ui);
m_catalogWindow->setThumbnailManager(m_thumbManager);
connect(m_catalogWindow, SIGNAL(closed()), this, SLOT(onCatalogWindow_closed()));
connect(m_catalogWindow, SIGNAL(openVolume(QString)), this, SLOT(onCatalogWindow_openVolume(QString)));
m_catalogWindow->setAsToplevelWindow();
QRect self = geometry();
m_catalogWindow->setGeometry(self.left()-100, self.top()+100, self.width(), self.height());
m_catalogWindow->show();
}
}

void MainWindow::createFolderWindow(bool docked)
{
QString oldpath;
if(m_folderWindow) {
oldpath = m_folderWindow->currentPath();
onFolderWindow_closed();
}
if(oldpath.isEmpty()) {
oldpath = m_pageManager.volumePath();
if(oldpath.isEmpty())
oldpath = qApp->HomeFolderPath();
}
if(docked) {
if(m_catalogWindow && m_catalogWindow->parent())
onCatalogWindow_closed();
if(m_exifDialog && m_exifDialog->parent())
onExifDialog_closed();
m_folderWindow = new FolderWindow(nullptr, ui);
m_folderWindow->setFolderPath(oldpath, false);
connect(m_folderWindow, SIGNAL(closed()), this, SLOT(onFolderWindow_closed()));
connect(m_folderWindow, SIGNAL(openVolume(QString)), this, SLOT(onFolderWindow_openVolume(QString)));
connect(&m_pageManager, SIGNAL(volumeChanged(QString)), m_folderWindow, SLOT(onPageManager_volumeChanged(QString)));
ui->catalogSplitter->insertWidget(0, m_folderWindow);
auto sizes = ui->catalogSplitter->sizes();
int sum = sizes[0]+sizes[1];
sizes[0] = 200;
sizes[1] = sum-sizes[0];
ui->catalogSplitter->setSizes(sizes);
m_folderWindow->setAsInnerWidget();
return;
} else {
// close child widget, and recreate as independent window
m_folderWindow = new FolderWindow(nullptr, ui);
QRect self = geometry();
m_folderWindow->setGeometry(self.left()-100, self.top()+100, self.width(), self.height());
m_folderWindow->setAsToplevelWindow();
m_folderWindow->setFolderPath(oldpath, false);
connect(m_folderWindow, SIGNAL(closed()), this, SLOT(onFolderWindow_closed()));
connect(m_folderWindow, SIGNAL(openVolume(QString)), this, SLOT(onFolderWindow_openVolume(QString)));
connect(&m_pageManager, SIGNAL(volumeChanged(QString)), m_folderWindow, SLOT(onPageManager_volumeChanged(QString)));
m_folderWindow->show();
}
}

void MainWindow::onActionFullscreen_triggered()
{
qDebug() << "on_fullscreen_triggered";
Expand Down Expand Up @@ -674,7 +751,7 @@ void MainWindow::onPageManager_volumeChanged(QString path)
on_pageNolongerNeeded_triggered();
return;
}
if(qApp->SavingHistory())
if(!qApp->DontSavingHistory())
qApp->addHistory(path);
if(!isFullScreen() && qApp->ShowSliderBar())
ui->pageFrame->show();
Expand Down Expand Up @@ -777,42 +854,10 @@ void MainWindow::resizeEvent(QResizeEvent *e)
void MainWindow::onActionShowFolder_triggered()
{
if(m_folderWindow) {
bool isChild = m_folderWindow->parent();
QString oldpath = m_folderWindow->currentPath();
onFolderWindow_closed();
if(isChild) {
// close child widget, and recreate as independent window
m_folderWindow = new FolderWindow(nullptr, ui);
QRect self = geometry();
m_folderWindow->setGeometry(self.left()-100, self.top()+100, self.width(), self.height());
m_folderWindow->setAsToplevelWindow();
m_folderWindow->setFolderPath(oldpath, false);
connect(m_folderWindow, SIGNAL(closed()), this, SLOT(onFolderWindow_closed()));
connect(m_folderWindow, SIGNAL(openVolume(QString)), this, SLOT(onFolderWindow_openVolume(QString)));
connect(&m_pageManager, SIGNAL(volumeChanged(QString)), m_folderWindow, SLOT(onPageManager_volumeChanged(QString)));
m_folderWindow->show();
}
return;
}
if(m_catalogWindow && m_catalogWindow->parent())
onCatalogWindow_closed();
if(m_exifDialog && m_exifDialog->parent())
onExifDialog_closed();
m_folderWindow = new FolderWindow(nullptr, ui);
QString path = m_pageManager.volumePath();
if(path.isEmpty())
path = qApp->HomeFolderPath();
m_folderWindow->setFolderPath(path, false);
connect(m_folderWindow, SIGNAL(closed()), this, SLOT(onFolderWindow_closed()));
connect(m_folderWindow, SIGNAL(openVolume(QString)), this, SLOT(onFolderWindow_openVolume(QString)));
connect(&m_pageManager, SIGNAL(volumeChanged(QString)), m_folderWindow, SLOT(onPageManager_volumeChanged(QString)));
ui->catalogSplitter->insertWidget(0, m_folderWindow);
auto sizes = ui->catalogSplitter->sizes();
int sum = sizes[0]+sizes[1];
sizes[0] = 200;
sizes[1] = sum-sizes[0];
ui->catalogSplitter->setSizes(sizes);
m_folderWindow->setAsInnerWidget();
createFolderWindow(!qApp->ShowPanelSeparateWindow());
}

void MainWindow::onFolderWindow_closed()
Expand Down Expand Up @@ -845,37 +890,10 @@ void MainWindow::onActionShowReadProgress_triggered(bool enabled)
void MainWindow::onActionShowCatalog_triggered()
{
if(m_catalogWindow) {
bool isChild = m_catalogWindow->parent();
onCatalogWindow_closed();
if(isChild) {
m_catalogWindow = new CatalogWindow(nullptr, ui);
m_catalogWindow->setThumbnailManager(m_thumbManager);
connect(m_catalogWindow, SIGNAL(closed()), this, SLOT(onCatalogWindow_closed()));
connect(m_catalogWindow, SIGNAL(openVolume(QString)), this, SLOT(onCatalogWindow_openVolume(QString)));
m_catalogWindow->setAsToplevelWindow();
QRect self = geometry();
m_catalogWindow->setGeometry(self.left()-100, self.top()+100, self.width(), self.height());
m_catalogWindow->show();
}
return;
}
if(m_folderWindow && m_folderWindow->parent())
onFolderWindow_closed();
if(m_exifDialog && m_exifDialog->parent())
onExifDialog_closed();
m_catalogWindow = new CatalogWindow(nullptr, ui);
m_catalogWindow->setThumbnailManager(m_thumbManager);
connect(m_catalogWindow, SIGNAL(closed()), this, SLOT(onCatalogWindow_closed()));
connect(m_catalogWindow, SIGNAL(openVolume(QString)), this, SLOT(onCatalogWindow_openVolume(QString)));
ui->catalogSplitter->insertWidget(0, m_catalogWindow);
auto sizes = ui->catalogSplitter->sizes();
int sum = sizes[0]+sizes[1];
sizes[0] = 200;
sizes[1] = sum-sizes[0];
ui->catalogSplitter->setSizes(sizes);
m_catalogWindow->setAsInnerWidget();
// m_catalogWindow->resize(180, m_catalogWindow->height());
// m_catalogWindow->show();
createCatalogWindow(!qApp->ShowPanelSeparateWindow());
}

void MainWindow::onCatalogWindow_closed()
Expand Down Expand Up @@ -1118,6 +1136,15 @@ void MainWindow::onActionShowFullscreenSignage_triggered(bool enable)
qApp->setShowFullscreenSignage(enable);
}

void MainWindow::onActionShowPanelSeparateWindow_triggered(bool enable)
{
qApp->setShowPanelSeparateWindow(enable);
if(m_folderWindow)
createFolderWindow(!qApp->ShowPanelSeparateWindow());
if(m_catalogWindow)
createCatalogWindow(!qApp->ShowPanelSeparateWindow());
}

//void MainWindow::onActionShowFullscreenTitleBar_triggered(bool enable)
//{
// qApp->setShowFullscreenTitleBar(enable);
Expand Down
3 changes: 3 additions & 0 deletions QuickViewer/src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class MainWindow : public QMainWindow
bool isFolderSearching();
void resetVolumeCaption();
void resetShortCut(const QString name, const QString shortcuttext, bool removed);
void createCatalogWindow(bool docked);
void createFolderWindow(bool docked);

protected:
void dragEnterEvent(QDragEnterEvent *e) override;
Expand Down Expand Up @@ -107,6 +109,7 @@ public slots:
void onActionBeginAsFullscreen_triggered(bool enable);
void onActionShowFullscreenSignage_triggered(bool enable);
// void onActionShowFullscreenTitleBar_triggered(bool enable);
void onActionShowPanelSeparateWindow_triggered(bool enable);
void on_windowTop();

// SlideShow
Expand Down
32 changes: 32 additions & 0 deletions QuickViewer/src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@
<addaction name="separator"/>
<addaction name="actionFullscreen"/>
<addaction name="actionShowFullscreenSignage"/>
<addaction name="separator"/>
<addaction name="actionShowFullpathOfVolume"/>
<addaction name="actionShowPanelSeparateWindow"/>
<addaction name="actionStayOnTop"/>
</widget>
<widget class="QMenu" name="menuHelp">
Expand Down Expand Up @@ -406,6 +408,7 @@
<addaction name="actionFitting"/>
<addaction name="actionDualView"/>
<addaction name="separator"/>
<addaction name="actionShowPanelSeparateWindow"/>
<addaction name="actionStayOnTop"/>
</widget>
<widget class="QStatusBar" name="statusBar"/>
Expand Down Expand Up @@ -1038,6 +1041,18 @@
<string extracomment="Flag to display by switching the full path or volume name of the volume to the title bar">Show full path of the volume</string>
</property>
</action>
<action name="actionShowPanelSeparateWindow">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../toolbar.qrc">
<normaloff>:/icons/child_separate</normaloff>:/icons/child_separate</iconset>
</property>
<property name="text">
<string extracomment="Flag separating the catalog and folder windows into independent windows">Undock into separate window</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
Expand Down Expand Up @@ -2348,6 +2363,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>actionShowPanelSeparateWindow</sender>
<signal>triggered(bool)</signal>
<receiver>MainWindow</receiver>
<slot>onActionShowPanelSeparateWindow_triggered(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>392</x>
<y>294</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>on_nextPage_triggered()</slot>
Expand Down Expand Up @@ -2416,5 +2447,6 @@
<slot>onActionRegistAssocs_triggered()</slot>
<slot>onSavingHistory_triggered(bool)</slot>
<slot>onShowFullpathOfVolume_triggered(bool)</slot>
<slot>onActionShowPanelSeparateWindow_triggered(bool)</slot>
</slots>
</ui>
6 changes: 4 additions & 2 deletions QuickViewer/src/models/qvapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ void QVApplication::loadSettings()
m_useDirect2D = m_settings.value("UseDirect2D", false).toBool();
m_useFastDCTForJPEG = m_settings.value("UseFastDCTForJPEG", true).toBool();
m_showFullpathOfVolume = m_settings.value("ShowFullpathOfVolume", true).toBool();
m_showPanelSeparateWindow = m_settings.value("ShowPanelSeparateWindow", false).toBool();
m_settings.endGroup();

m_settings.beginGroup("WindowState");
Expand All @@ -322,7 +323,7 @@ void QVApplication::loadSettings()
m_maxBookmarkCount = m_settings.value("MaxBookmarkCount", 20).toInt();
m_prohibitMultipleRunning = m_settings.value("ProhibitMultipleRunning", false).toBool();
m_lastViewPath = m_settings.value("LastViewPath", "").toString();
m_savingHistory = m_settings.value("SavingHistory", true).toBool();
m_dontSavingHistory = m_settings.value("DontSavingHistory", false).toBool();
m_settings.endGroup();

m_settings.beginGroup("Folder");
Expand Down Expand Up @@ -417,6 +418,7 @@ void QVApplication::saveSettings()
m_settings.setValue("UseDirect2D", m_useDirect2D);
m_settings.setValue("UseFastDCTForJPEG", m_useFastDCTForJPEG);
m_settings.setValue("ShowFullpathOfVolume", m_showFullpathOfVolume);
m_settings.setValue("ShowPanelSeparateWindow", m_showPanelSeparateWindow);
m_settings.endGroup();

m_settings.beginGroup("WindowState");
Expand All @@ -434,7 +436,7 @@ void QVApplication::saveSettings()
m_settings.setValue("Bookmarks", QVariant::fromValue(m_bookmarks));
m_settings.setValue("ProhibitMultipleRunning", m_prohibitMultipleRunning);
m_settings.setValue("LastViewPath", m_lastViewPath);
m_settings.setValue("SavingHistory", m_savingHistory);
m_settings.setValue("DontSavingHistory", m_dontSavingHistory);
m_settings.endGroup();

m_settings.beginGroup("Folder");
Expand Down
Loading

0 comments on commit 57605f8

Please sign in to comment.