diff --git a/QuickViewer/QuickViewer.pro b/QuickViewer/QuickViewer.pro index 790cb8dd..e4296737 100644 --- a/QuickViewer/QuickViewer.pro +++ b/QuickViewer/QuickViewer.pro @@ -8,7 +8,7 @@ QT += core gui opengl concurrent opengl-private sql greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -VERSION = 0.7.6 +VERSION = 0.7.7 TARGET = QuickViewer TEMPLATE = app @@ -139,7 +139,8 @@ SOURCES += \ src/main.cpp \ src/mainwindow.cpp \ src/mainwindowforwindows.cpp \ - src/optionsdialog.cpp + src/optionsdialog.cpp \ + src/renamedialog.cpp HEADERS += \ src/qv_init.h \ @@ -195,7 +196,8 @@ HEADERS += \ src/mainwindowforwindows.h \ src/qv_init.h \ src/stdafx.h \ - src/optionsdialog.h + src/optionsdialog.h \ + src/renamedialog.h win32 { SOURCES += src/mainwindowforwindows.cpp @@ -215,7 +217,8 @@ FORMS += \ src/catalog/catalogwindow.ui \ src/catalog/createdb.ui \ src/folderview/folderwindow.ui \ - src/optionsdialog.ui + src/optionsdialog.ui \ + src/renamedialog.ui RESOURCES += \ toolbar.qrc diff --git a/QuickViewer/src/imageview.cpp b/QuickViewer/src/imageview.cpp index 3d256248..9233ff77 100644 --- a/QuickViewer/src/imageview.cpp +++ b/QuickViewer/src/imageview.cpp @@ -31,7 +31,7 @@ ImageView::ImageView(QWidget *parent) setRenderer(OpenGL); setMouseTracking(true); - + resetBackgroundColor(); } @@ -94,6 +94,24 @@ void ImageView::toggleSlideShow() m_slideshowTimer->start(qApp->SlideShowWait()); } +void ImageView::resetBackgroundColor() +{ +// QColor bg = qApp->BackgroundColor(); +// setStyleSheet(QString("background-color:") + bg.name(QColor::HexArgb)); + if(!qApp->UseCheckeredPattern()) { + setBackgroundBrush(QBrush(qApp->BackgroundColor(), Qt::SolidPattern)); + return; + } + QPixmap pix(16, 16); + pix.fill(qApp->BackgroundColor()); + QPainter paint(&pix); + QBrush brush2(qApp->BackgroundColor2(), Qt::SolidPattern); + paint.fillRect(QRect(0, 0, 8, 8), brush2); + paint.fillRect(QRect(8, 8, 8, 8), brush2); + QBrush brush(pix); + setBackgroundBrush(brush); +} + void ImageView::on_volumeChanged_triggered(QString path) { m_pageRotations = QVector(m_pageManager->size()); @@ -166,11 +184,11 @@ void ImageView::readyForPaint() { repaint(); } -void ImageView::paintEvent(QPaintEvent *event) -{ -// readyForPaint(); - QGraphicsView::paintEvent(event); -} +//void ImageView::paintEvent(QPaintEvent *event) +//{ +//// readyForPaint(); +// QGraphicsView::paintEvent(event); +//} void ImageView::resizeEvent(QResizeEvent *event) { diff --git a/QuickViewer/src/imageview.h b/QuickViewer/src/imageview.h index 8d35253f..07e3de08 100644 --- a/QuickViewer/src/imageview.h +++ b/QuickViewer/src/imageview.h @@ -57,6 +57,7 @@ class ImageView : public QGraphicsView bool isSlideShow() const { return m_slideshowTimer != nullptr; } void toggleSlideShow(); void setWillFullscreen(bool fullscreen) { m_isFullScreen = fullscreen; } + void resetBackgroundColor(); signals: /** @@ -72,7 +73,7 @@ class ImageView : public QGraphicsView void mouseMoveEvent(QMouseEvent *event); // void mousePressEvent(QMouseEvent *event); // void mouseReleaseEvent(QMouseEvent *event); - void paintEvent(QPaintEvent *event) override; +// void paintEvent(QPaintEvent *event) override; void resizeEvent(QResizeEvent *event) override; // void dragEnterEvent(QDragEnterEvent *event) { event->accept(); qDebug() << "ImageView::dragEnterEvent"; } // void dropEvent( QDropEvent *e ) {qDebug() << "ImageView::dropEvent";} diff --git a/QuickViewer/src/mainwindow.cpp b/QuickViewer/src/mainwindow.cpp index 8c31617d..64c0c6c0 100644 --- a/QuickViewer/src/mainwindow.cpp +++ b/QuickViewer/src/mainwindow.cpp @@ -11,6 +11,7 @@ #include "optionsdialog.h" #include "catalogwindow.h" #include "folderwindow.h" +#include "renamedialog.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) @@ -848,9 +849,16 @@ void MainWindow::on_openKeyConfig_triggered() void MainWindow::on_openOptionsDialog_triggered() { OptionsDialog dialog(this); - int result = dialog.exec(); - if(result == QDialog::Accepted) { + QColor back = qApp->BackgroundColor(); + QColor back2 = qApp->BackgroundColor2(); + bool checkered = qApp->UseCheckeredPattern(); + if(dialog.exec() == QDialog::Accepted) { dialog.reflectResults(); + if(back != qApp->BackgroundColor() + || back2 != qApp->BackgroundColor2() + || checkered != qApp->UseCheckeredPattern()) { + ui->graphicsView->resetBackgroundColor(); + } } } @@ -888,6 +896,16 @@ void MainWindow::on_mailAttachment_triggered() setMailAttachment(path); } +void MainWindow::on_renameImageFile_triggered() +{ + if(!m_pageManager.isFolder() || m_pageManager.currentPageCount() == 0) + return; + RenameDialog dialog(this, m_pageManager.realVolumePath(), m_pageManager.currentPageName()); + if(dialog.exec() == QDialog::Accepted) { + m_pageManager.loadVolume(QDir(m_pageManager.realVolumePath()).absoluteFilePath(dialog.newName())); + } +} + void MainWindow::on_deletePage_triggered() { if(m_pageManager.currentPageCount() <= 0 || !m_pageManager.isFolder()) diff --git a/QuickViewer/src/mainwindow.h b/QuickViewer/src/mainwindow.h index 177e6d90..128353b9 100644 --- a/QuickViewer/src/mainwindow.h +++ b/QuickViewer/src/mainwindow.h @@ -111,6 +111,7 @@ public slots: void on_deletePage_triggered(); void on_exitApplicationOrFullscreen_triggered(); void on_mailAttachment_triggered(); + void on_renameImageFile_triggered(); // Shaders void on_shaderNearestNeighbor_triggered(); diff --git a/QuickViewer/src/mainwindow.ui b/QuickViewer/src/mainwindow.ui index 45cc131e..fe9cc6af 100644 --- a/QuickViewer/src/mainwindow.ui +++ b/QuickViewer/src/mainwindow.ui @@ -97,15 +97,6 @@ 0 - - - - 0 - 0 - 0 - - - QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing @@ -322,6 +313,7 @@ + @@ -980,6 +972,11 @@ &Options Config + + + Rename the image + + @@ -2098,6 +2095,22 @@ + + actionRenameImageFile + triggered() + MainWindow + on_renameImageFile_triggered() + + + -1 + -1 + + + 350 + 294 + + + on_file_changed(QString) @@ -2154,5 +2167,6 @@ on_openVolumeWithProgress_triggered(bool) on_showReadProgress_triggered(bool) on_openOptionsDialog_triggered() + on_renameImageFile_triggered() diff --git a/QuickViewer/src/models/filevolume.cpp b/QuickViewer/src/models/filevolume.cpp index 01214755..d80e3ca7 100644 --- a/QuickViewer/src/models/filevolume.cpp +++ b/QuickViewer/src/models/filevolume.cpp @@ -18,6 +18,7 @@ IFileVolume::IFileVolume(QObject *parent, IFileLoader* loader, PageManager* page , m_cacheMode(CacheMode::Normal) , m_pageManager(pageManager) , m_imageCache(20) + , m_openedWithSpecifiedImageFile(false) { m_filelist = m_loader->contents(); } @@ -146,6 +147,7 @@ static IFileVolume* CreateVolumeImpl(QObject* parent, QString path, PageManager* QString dirpath = dir.canonicalPath(); IFileVolume* fvd = new IFileVolume(parent, qApp->ShowSubfolders() ? new FileLoaderSubDirectory(parent, path) : new FileLoaderDirectory(parent, dirpath), pageManager); fvd->findImageByName(path.mid(dirpath.length()+1)); + fvd->setOpenedWithSpecifiedImageFile(true); return fvd; } return nullptr; diff --git a/QuickViewer/src/models/filevolume.h b/QuickViewer/src/models/filevolume.h index 1b9cbf96..96cb9430 100644 --- a/QuickViewer/src/models/filevolume.h +++ b/QuickViewer/src/models/filevolume.h @@ -79,6 +79,7 @@ class IFileVolume : public QObject const ImageContent currentImage() { return m_cacheMode == NoAsync ? m_currentCacheSync : m_currentCache.result(); } QString volumePath() { return m_loader->volumePath(); } + QString realVolumePath() { return m_loader->realVolumePath(); } bool nextPage(); bool prevPage(); @@ -112,7 +113,8 @@ class IFileVolume : public QObject // QString getIndexedImageName(int idx) { return m_filelist[idx]; } // QString currentImageName() const { return m_filelist[m_cnt]; } const ImageContent getIndexedImageContent(int idx); - + bool openedWithSpecifiedImageFile() { return m_openedWithSpecifiedImageFile; } + void setOpenedWithSpecifiedImageFile(bool openedWithSpecifiedImageFile) { m_openedWithSpecifiedImageFile = openedWithSpecifiedImageFile; } protected: /** @@ -132,6 +134,7 @@ class IFileVolume : public QObject IFileLoader* m_loader; CacheMode m_cacheMode; PageManager* m_pageManager; + bool m_openedWithSpecifiedImageFile; }; diff --git a/QuickViewer/src/models/pagemanager.cpp b/QuickViewer/src/models/pagemanager.cpp index 24303491..48279e20 100644 --- a/QuickViewer/src/models/pagemanager.cpp +++ b/QuickViewer/src/models/pagemanager.cpp @@ -69,7 +69,7 @@ void PageManager::nextVolume() } else { addVolumeCache(path, true); } - if(matchCount >= PRE_LOAD_VOLUMES) + if(matchCount >= qApp->MaxVolumesCache()*3/2-1) break; } } @@ -105,7 +105,7 @@ void PageManager::prevVolume() } else { addVolumeCache(path, true); } - if(matchCount >= PRE_LOAD_VOLUMES) + if(matchCount >= qApp->MaxVolumesCache()*3/2-1) break; } } @@ -134,6 +134,7 @@ IFileVolume* PageManager::addVolumeCache(QString path, bool onlyCover) // change page by progress.ini QString volumepath = QDir::fromNativeSeparators(newer->volumePath()); if(qApp->OpenVolumeWithProgress() + && !newer->openedWithSpecifiedImageFile() && qApp->bookshelfManager()->contains(volumepath)) { BookProgress book = qApp->bookshelfManager()->at(volumepath); newer->findPageByIndex(book.Current); diff --git a/QuickViewer/src/models/pagemanager.h b/QuickViewer/src/models/pagemanager.h index 6e135e79..1df3bed3 100644 --- a/QuickViewer/src/models/pagemanager.h +++ b/QuickViewer/src/models/pagemanager.h @@ -50,6 +50,7 @@ class PageManager : public QObject int idx = m_fileVolume->size()-1==m_currentPage ? m_currentPage-1 : m_currentPage+1; return QDir::toNativeSeparators(m_fileVolume->getPathByIndex(idx)); } + QString currentPageName() { return m_pages[0].Path; } /** * @brief currentPageNumAsString: for the label text on PageBar @@ -64,6 +65,7 @@ class PageManager : public QObject */ QString currentPageStatusAsString() const; QString volumePath(){ return m_fileVolume ? m_fileVolume->volumePath() : ""; } + QString realVolumePath() { return m_fileVolume ? m_fileVolume->realVolumePath() : ""; } bool isArchive() { if(!m_fileVolume) return false; return m_fileVolume->isArchive(); diff --git a/QuickViewer/src/models/qvapplication.cpp b/QuickViewer/src/models/qvapplication.cpp index 5ffd0aab..1187644c 100644 --- a/QuickViewer/src/models/qvapplication.cpp +++ b/QuickViewer/src/models/qvapplication.cpp @@ -48,6 +48,7 @@ void QVApplication::registDefaultKeyMap() m_keyConfigDefauls["actionZoomIn"] = QKeySequence("K, Num++"); m_keyConfigDefauls["actionZoomOut"] = QKeySequence("J, Num+-"); + m_keyConfigDefauls["actionRenameImageFile"] = QKeySequence("F2"); m_keyConfigDefauls["actionShowFolder"] = QKeySequence("F4"); m_keyConfigDefauls["actionShowCatalog"] = QKeySequence("Ctrl+/, F6"); m_keyConfigDefauls["actionSlideShow"] = QKeySequence("F7"); @@ -138,6 +139,7 @@ void QVApplication::registActions(Ui::MainWindow *ui) registAction("actionCopyFile", ui->actionCopyFile); registAction("actionDeletePage", ui->actionDeletePage); registAction("actionMailAttachment", ui->actionMailAttachment); + registAction("actionRenameImageFile", ui->actionRenameImageFile); // Shader registAction("actionShaderNearestNeighbor", ui->actionShaderNearestNeighbor); @@ -148,6 +150,7 @@ void QVApplication::registActions(Ui::MainWindow *ui) // Help registAction("actionOpenKeyConfig", ui->actionOpenKeyConfig); + registAction("actionOpenOptionsDialog", ui->actionOpenOptionsDialog); registAction("actionCheckVersion", ui->actionCheckVersion); registAction("actionProjectWeb", ui->actionProjectWeb); registAction("actionAppVersion", ui->actionAppVersion); @@ -243,6 +246,9 @@ void QVApplication::loadSettings() #else m_maxVolumesCache = m_settings.value("MaxVolumesCache", 1).toInt(); #endif + m_backgroundColor = QColor(m_settings.value("BackgroundColor", "0x797979").toString().toUInt(nullptr, 16)); + m_backgroundColor2 = QColor(m_settings.value("BackgroundColor2", "0x5e5e5e").toString().toUInt(nullptr, 16)); + m_useCheckeredPattern = m_settings.value("UseCheckeredPattern", true).toBool(); m_settings.endGroup(); m_settings.beginGroup("WindowState"); @@ -294,11 +300,7 @@ void QVApplication::loadSettings() m_settings.endGroup(); m_settings.beginGroup("Shader"); -#ifdef Q_OS_WIN - QString effectstring = m_settings.value("Effect", "BilinearAndCpuBicubic").toString(); -#else QString effectstring = m_settings.value("Effect", "Bilinear").toString(); -#endif m_effect = ShaderManager::stringToShaderEffect(effectstring); m_bicubicShaderPath = m_settings.value("BicubicShaderPath", "shaders/bicubic.frag").toString(); m_lanczosShaderPath = m_settings.value("LanczosShaderPath", "shaders/lanczos.frag").toString(); @@ -325,6 +327,12 @@ void QVApplication::saveSettings() m_settings.setValue("ShowSubfolders", m_showSubfolders); m_settings.setValue("SlideShowWait", m_slideShowWait); m_settings.setValue("MaxVolumesCache", m_maxVolumesCache); + QString rgbstring; + rgbstring.setNum(m_backgroundColor.rgb(), 16); + m_settings.setValue("BackgroundColor", rgbstring); + rgbstring.setNum(m_backgroundColor2.rgb(), 16); + m_settings.setValue("BackgroundColor2", rgbstring); + m_settings.setValue("UseCheckeredPattern", m_useCheckeredPattern); m_settings.endGroup(); m_settings.beginGroup("WindowState"); diff --git a/QuickViewer/src/models/qvapplication.h b/QuickViewer/src/models/qvapplication.h index 1d46f980..378f8cb1 100644 --- a/QuickViewer/src/models/qvapplication.h +++ b/QuickViewer/src/models/qvapplication.h @@ -37,6 +37,9 @@ class QVApplication : public QApplication Q_PROPERTY(int SlideShowWait READ SlideShowWait WRITE setSlideShowWait) Q_PROPERTY(int MaxVolumesCache READ MaxVolumesCache WRITE setMaxVolumesCache) Q_PROPERTY(bool Fitting READ Fitting WRITE setFitting) + Q_PROPERTY(QColor BackgroundColor READ BackgroundColor WRITE setBackgroundColor) + Q_PROPERTY(QColor BackgroundColor2 READ BackgroundColor2 WRITE setBackgroundColor2) + Q_PROPERTY(bool UseCheckeredPattern READ UseCheckeredPattern WRITE setUseCheckeredPattern) // DuapView Q_PROPERTY(bool DualView READ DualView WRITE setDualView) @@ -104,6 +107,12 @@ class QVApplication : public QApplication void setSlideShowWait (int slideShowWait) { m_slideShowWait = slideShowWait; } int MaxVolumesCache() { return m_maxVolumesCache; } void setMaxVolumesCache (int maxVolumesCache) { m_maxVolumesCache = maxVolumesCache; } + QColor BackgroundColor() { return m_backgroundColor; } + void setBackgroundColor (QColor backgroundColor) { m_backgroundColor = backgroundColor; } + QColor BackgroundColor2() { return m_backgroundColor2; } + void setBackgroundColor2 (QColor backgroundColor) { m_backgroundColor2 = backgroundColor; } + bool UseCheckeredPattern() { return m_useCheckeredPattern; } + void setUseCheckeredPattern (bool useCheckeredPattern) { m_useCheckeredPattern = useCheckeredPattern; } // Show Bars @@ -280,6 +289,9 @@ class QVApplication : public QApplication bool m_showSubfolders; int m_slideShowWait; int m_maxVolumesCache; + QColor m_backgroundColor; + QColor m_backgroundColor2; + bool m_useCheckeredPattern; // ToolBars bool m_showToolBar; diff --git a/QuickViewer/src/optionsdialog.cpp b/QuickViewer/src/optionsdialog.cpp index 4cb63023..46233e3e 100644 --- a/QuickViewer/src/optionsdialog.cpp +++ b/QuickViewer/src/optionsdialog.cpp @@ -8,8 +8,19 @@ OptionsDialog::OptionsDialog(QWidget *parent) { ui->setupUi(this); - ui->spinSlideshow->setValue(qApp->SlideShowWait()); - ui->spinVolumes->setValue(qApp->MaxVolumesCache()); + m_slideShowWait = qApp->SlideShowWait(); + m_maxVolumesCache = qApp->MaxVolumesCache(); + m_backgroundColor = qApp->BackgroundColor(); + m_backgroundColor2 = qApp->BackgroundColor2(); + m_useCheckeredPattern = qApp->UseCheckeredPattern(); + + ui->spinSlideshow->setValue(m_slideShowWait); + ui->spinVolumes->setValue(m_maxVolumesCache); + ui->checkBoxCheckeredPattern->setChecked(m_useCheckeredPattern); + + resetColorButton(ui->btnColorSelect, m_backgroundColor); + resetColorButton(ui->btnColorSelect2, m_backgroundColor2); + resetColorBox(); } OptionsDialog::~OptionsDialog() @@ -21,4 +32,69 @@ void OptionsDialog::reflectResults() { qApp->setSlideShowWait(ui->spinSlideshow->value()); qApp->setMaxVolumesCache(ui->spinVolumes->value()); + qApp->setBackgroundColor(m_backgroundColor); + qApp->setBackgroundColor2(m_backgroundColor2); + qApp->setUseCheckeredPattern(m_useCheckeredPattern); +} + +void OptionsDialog::resetColorButton(QPushButton* btn, QColor color) +{ + QPixmap pix(16, 16); + pix.fill(color); + QIcon icon(pix); + btn->setIcon(icon); +} + +void OptionsDialog::resetColorBox() +{ + QPixmap pattern(48, 48); + QBrush brush; + if(!m_useCheckeredPattern) { + brush = QBrush(m_backgroundColor, Qt::SolidPattern); + + ui->labelColor2->setEnabled(false); + ui->btnColorSelect2->setEnabled(false); + } else { + QPixmap pix(16, 16); + pix.fill(m_backgroundColor); + QPainter paint(&pix); + QBrush brush2(m_backgroundColor2, Qt::SolidPattern); + paint.fillRect(QRect(0, 0, 8, 8), brush2); + paint.fillRect(QRect(8, 8, 8, 8), brush2); + brush = QBrush(pix); + + ui->labelColor2->setEnabled(true); + ui->btnColorSelect2->setEnabled(true); + } + QPainter paint(&pattern); + paint.fillRect(QRect(0, 0, 48, 48), brush); + ui->labelBgSample->setPixmap(pattern); +} + +void OptionsDialog::on_changeColor_triggered() +{ + QColorDialog dialog(this); + dialog.setCurrentColor(m_backgroundColor); + if(dialog.exec() == QDialog::Accepted) { + m_backgroundColor = dialog.currentColor(); + resetColorButton(ui->btnColorSelect, m_backgroundColor); + resetColorBox(); + } +} + +void OptionsDialog::on_changeColor2_triggered() +{ + QColorDialog dialog(this); + dialog.setCurrentColor(m_backgroundColor2); + if(dialog.exec() == QDialog::Accepted) { + m_backgroundColor2 = dialog.currentColor(); + resetColorButton(ui->btnColorSelect2, m_backgroundColor2); + resetColorBox(); + } +} + +void OptionsDialog::on_useCheckeredPattern_triggered(bool enabled) +{ + m_useCheckeredPattern = enabled; + resetColorBox(); } diff --git a/QuickViewer/src/optionsdialog.h b/QuickViewer/src/optionsdialog.h index 9380ba15..c221b09a 100644 --- a/QuickViewer/src/optionsdialog.h +++ b/QuickViewer/src/optionsdialog.h @@ -10,14 +10,27 @@ class OptionsDialog; class OptionsDialog : public QDialog { + Q_OBJECT public: OptionsDialog(QWidget *parent); ~OptionsDialog(); - void reflectResults(); + void resetColorButton(QPushButton* btn, QColor color); + void resetColorBox(); + +public slots: + void on_changeColor_triggered(); + void on_changeColor2_triggered(); + void on_useCheckeredPattern_triggered(bool enabled); private: Ui::OptionsDialog *ui; + + int m_slideShowWait; + int m_maxVolumesCache; + QColor m_backgroundColor; + QColor m_backgroundColor2; + bool m_useCheckeredPattern; }; #endif // OPTIONSDIALOG_H diff --git a/QuickViewer/src/optionsdialog.ui b/QuickViewer/src/optionsdialog.ui index fe37bf19..7df18e3a 100644 --- a/QuickViewer/src/optionsdialog.ui +++ b/QuickViewer/src/optionsdialog.ui @@ -7,12 +7,20 @@ 0 0 497 - 300 + 239 Options + + QGroupBox { + border: 1px solid gray; + border-radius: 3px; + padding: 5px; +} + + true @@ -20,7 +28,7 @@ - + 0 0 @@ -31,7 +39,7 @@ QFrame::Raised - + @@ -41,14 +49,26 @@ - Number of volumes managed simultaneously + Number of volumes managed simultaneously (Restart is required) - - - - <html><head/><body>Wait until the next image is switched in the slide show(millisecond)<br />(Enabled after re-run)</body></html> + + + + Increasing the value increases the display time of one image + + + 1000 + + + 20000 + + + 500 + + + 5000 @@ -65,26 +85,135 @@ - - - - Increasing the value increases the display time of one image - - - 1000 - - - 20000 - - - 500 + + + + SlideShow Delay (millisecond) - - 5000 + + + + + + BackgroundColor + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + 0 + + + + Color1 + + + + + + + + 24 + 24 + + + + + + + + 16 + 16 + + + + + + + + Use checkered pattern + + + + + + + Color2 + + + + + + + + 24 + 24 + + + + + + + + 16 + 16 + + + + + + + + + + + + 48 + 48 + + + + + 48 + 48 + + + + QFrame::Box + + + + + + + + + + + 413 + 98 + 56 + 145 + + + + + + @@ -133,5 +262,58 @@ + + btnColorSelect + clicked() + OptionsDialog + on_changeColor_triggered() + + + 402 + 83 + + + 248 + 149 + + + + + btnColorSelect2 + clicked() + OptionsDialog + on_changeColor2_triggered() + + + 218 + 154 + + + 248 + 119 + + + + + checkBoxCheckeredPattern + clicked(bool) + OptionsDialog + on_useCheckeredPattern_triggered(bool) + + + 122 + 128 + + + 248 + 119 + + + + + on_changeColor_triggered() + on_changeColor2_triggered() + on_useCheckeredPattern_triggered(bool) + diff --git a/QuickViewer/src/renamedialog.cpp b/QuickViewer/src/renamedialog.cpp new file mode 100644 index 00000000..393ae76d --- /dev/null +++ b/QuickViewer/src/renamedialog.cpp @@ -0,0 +1,42 @@ +#include "renamedialog.h" +#include "ui_renamedialog.h" + +RenameDialog::RenameDialog(QWidget *parent, QString path, QString filename) + : QDialog(parent) + , ui(new Ui::RenameDialog) +{ + ui->setupUi(this); + m_path = QDir::toNativeSeparators(path); + m_filename = filename; + ui->editFilename->setText(m_filename); + ui->labelErrorMessage->setVisible(false); +} + +QString RenameDialog::newName() +{ + return ui->editFilename->text(); +} + +void RenameDialog::on_textChanged_triggered(QString text) +{ +// QDir dir(m_path); +// QFileInfo info(QDir::toNativeSeparators(dir.absoluteFilePath(text))); +// info.exists(); + if(text.isEmpty()) { + ui->labelErrorMessage->setText(tr("Filename can't be empty.")); + ui->labelErrorMessage->setVisible(true); + } else { + ui->labelErrorMessage->setVisible(false); + } +} + +void RenameDialog::on_tryChangingFilenameAndAccept_triggered() +{ + QDir dir(m_path); + if(dir.rename(m_filename, ui->editFilename->text())) { + accept(); + return; + } + ui->labelErrorMessage->setText(tr("Rename failed. Does the same file name exist?")); + ui->labelErrorMessage->setVisible(true); +} diff --git a/QuickViewer/src/renamedialog.h b/QuickViewer/src/renamedialog.h new file mode 100644 index 00000000..d447ff89 --- /dev/null +++ b/QuickViewer/src/renamedialog.h @@ -0,0 +1,28 @@ +#ifndef RENAMEDIALOG_H +#define RENAMEDIALOG_H + +#include + +namespace Ui { +class RenameDialog; +} + +class RenameDialog : public QDialog +{ + Q_OBJECT +public: + RenameDialog(QWidget* parent, QString path, QString filename); + QString newName(); + +public slots: + void on_textChanged_triggered(QString text); + void on_tryChangingFilenameAndAccept_triggered(); + +private: + Ui::RenameDialog *ui; + + QString m_path; + QString m_filename; +}; + +#endif // RENAMEDIALOG_H diff --git a/QuickViewer/src/renamedialog.ui b/QuickViewer/src/renamedialog.ui new file mode 100644 index 00000000..2bd6a6cb --- /dev/null +++ b/QuickViewer/src/renamedialog.ui @@ -0,0 +1,107 @@ + + + RenameDialog + + + + 0 + 0 + 400 + 103 + + + + RenameDialog + + + + + + EditFilename + + + + + + + + + + color: red; + + + ErrorMessage + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + RenameDialog + on_tryChangingFilenameAndAccept_triggered() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + RenameDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + editFilename + textChanged(QString) + RenameDialog + on_textChanged_triggered(QString) + + + 199 + 36 + + + 199 + 42 + + + + + + on_textChanged_triggered(QString) + on_tryChangingFilenameAndAccept_triggered() + + diff --git a/QuickViewer/translations/quickviewer_es.ts b/QuickViewer/translations/quickviewer_es.ts index c2eaee1b..c168c2c8 100644 --- a/QuickViewer/translations/quickviewer_es.ts +++ b/QuickViewer/translations/quickviewer_es.ts @@ -562,475 +562,480 @@ - + &File - + &History - + &View - + &Help - + &Navigation - - + + LoadBookmark - + &Shader - + ContextMenu - + &Catalog - + F&older - + E&xit - + &NextPage - + NextPage - + &PrevPage - + PrevPage - + Zoom&In - + ZoomIn - + Zoom&Out - + ZoomOut - + &Fitting - + Fitting - + &Spread Viewing - - + + Spread Viewing - + &Fullscreen - + &About QuickViewer - + &Auto load last used - + Bound on the &right side book - + &Open Image Folder - + &Always open wide images as one view - + &LastPage - + &FirstPage - + ShowStatus&Bar - + Show&PageBar - + Open &Explorer - + Exif &Information - + &Key Config - + Check &Version by your browser - + N&extVolume - + P&revVolume - + Next only &one page - + Prev only o&ne page - + ExitApplicationOrFullscreen - + Show&ToolBar - + Always open &first images as one view - + Show&MenuBar - + &Clear History - + Stay On &Top - + &Copy Image to clipboard - + Move Image to &Recycle Bin - + &Bilinear interpolation (fast) - + Bi&cubic interpolation (slow) - + &Lanczos interpolation (very slow) - + &Nearest Neighbor interpolation (coarse) - + &Maximize or Normal - + &Restore Window State on next run - + FastForward - + FastBackward - + Copy File to clipboard - + &Rotate - + &SlideShow - + SaveBookmark - + ManageBookmarks - + clearBookmarks - + &Project WebPage by your browser - + Show&Catalog - + ShowCatalog - + Remove (Options) from Book Title - + Remove (Options) from book title when searching - - + + CatalogViewIcon - - + + CatalogViewIconNoText - - + + CatalogViewList - + ShowTagBar - + Sh&ow/Hide MainMenuBar - + Run your &mailer with an attachment - + Run your mailer with an attachment - + Show large &grid for long titles - + Show&Folder - + CPU Bicubic after GPU Bilinear(standard) - + CPU Bicubic interpolation - + ShowSubfolders - - + + ShowImages in sub folders - + Open volume with progress - + ShowReadProgress - + &Options Config - + + Rename the image + + + + any folder or archive is not loaded. - - + + Can't be opened. Is there no images? - + All Files( *.*);;Images (*.jpg *.jpeg *.png *.tif *.tiff *.ico);;Archives( *.zip *.7z *.rar) - + Open a image or archive - - + + Confirmation - + Do you really want to clear the main menu? - + Press F8(default), or Show a context menu on the title bar, <br />and select <strong>'Show/Hide MainMenuBar'</strong> - + Are you sure you delete the image? - + Bookmark Saved. @@ -1154,22 +1159,42 @@ - - Number of volumes managed simultaneously + + Number of volumes managed simultaneously (Restart is required) - - <html><head/><body>Wait until the next image is switched in the slide show(millisecond)<br />(Enabled after re-run)</body></html> + + SlideShow Delay (millisecond) - + + BackgroundColor + + + + + Color1 + + + + + Use checkered pattern + + + + + Color2 + + + + Increasing it makes NextVolume / PrevVolume more comfortable but increases memory consumption. 1 is appropriate for 32 bit version. - + Increasing the value increases the display time of one image @@ -1226,6 +1251,29 @@ + + RenameDialog + + + RenameDialog + + + + + EditFilename + + + + + Filename can't be empty. + + + + + Rename failed. Does the same file name exist? + + + ShortcutButton diff --git a/QuickViewer/translations/quickviewer_ja.qm b/QuickViewer/translations/quickviewer_ja.qm index 5145d8f0..fa4466e9 100644 Binary files a/QuickViewer/translations/quickviewer_ja.qm and b/QuickViewer/translations/quickviewer_ja.qm differ diff --git a/QuickViewer/translations/quickviewer_ja.ts b/QuickViewer/translations/quickviewer_ja.ts index 1cc97322..ce923d15 100644 --- a/QuickViewer/translations/quickviewer_ja.ts +++ b/QuickViewer/translations/quickviewer_ja.ts @@ -1052,6 +1052,10 @@ &Options Config オプション設定(&O) + + Rename the image + ファイル名を変更する + MainWindowForWindows @@ -1163,11 +1167,11 @@ Number of volumes managed simultaneously - 同時に管理するボリュームの最大数 + 同時に管理するボリュームの最大数 <html><head/><body>Wait until the next image is switched in the slide show(millisecond)<br />(Enabled after re-run)</body></html> - <html><head/><body>スライドショーで次の画像に切り替えるまでのウェイト(ミリ秒)<br />(次回実行時に有効)</body></html> + <html><head/><body>スライドショーで次の画像に切り替えるまでのウェイト(ミリ秒)<br />(次回実行時に有効)</body></html> Increasing it makes NextVolume / PrevVolume more comfortable but increases memory consumption. 1 is appropriate for 32 bit version. @@ -1177,6 +1181,30 @@ Increasing the value increases the display time of one image 数を大きくすると画像1枚あたりの表示時間が長くなります + + Number of volumes managed simultaneously (Restart is required) + 同時に管理するボリュームの最大数 (再起動後有効) + + + SlideShow Delay (millisecond) + スライドショーのウェイト (ミリ秒) + + + BackgroundColor + 背景パターンの変更 + + + Color1 + 背景色1 + + + Use checkered pattern + 市松模様にする + + + Color2 + 背景色2 + PageContent @@ -1222,6 +1250,25 @@ + + RenameDialog + + RenameDialog + ファイル名変更ダイアログ + + + EditFilename + ファイル名の編集 + + + Filename can't be empty. + ファイル名は必ず必要です。 + + + Rename failed. Does the same file name exist? + ファイル名を変更できません。同じ名前のファイルがありませんか? + + ShortcutButton