From 9afacfd536532daac49619db07c49653bf9efb7d Mon Sep 17 00:00:00 2001 From: Masayuki Satoh Date: Sat, 23 Aug 2014 02:05:58 +0900 Subject: [PATCH] Ver0.07 --- README.md | 14 +- common.h | 84 ++++++----- filetablemodel.cpp | 24 +-- filetableview.cpp | 207 ++++++++++++++++++++++---- filetableview.h | 6 +- folderpanel.cpp | 33 ++-- folderpanel.ui | 3 + main.cpp | 98 ++++++++++++ mainwindow.cpp | 37 +++-- mainwindow.ui | 12 ++ operationdialog.cpp | 10 ++ operationdialog.h | 2 + preferencedialog.cpp | 120 +++++++++++---- preferencedialog.h | 1 + preferencedialog.ui | 413 ++++++++++++++++++++++++++++++++++++++++++++++++++- sortdialog.cpp | 15 +- 16 files changed, 925 insertions(+), 154 deletions(-) diff --git a/README.md b/README.md index 01b2f66..1e1ebca 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,11 @@ Gefu Gefu is an Experimental File Utility. ### TODO -- 初期表示時にカーソルがハイライトされないorz -- ファイルはダブルクリックで開くようにする +- 現在のフォルダを端末で開く - コンテキストメニュー - オプション - ファンクションキー - - 各処理時の確認・完了ダイアログ表示有無 - - 上書き時の規定の動作 - - フォルダ作ったら、そこに移動 + - キーバインドカスタマイズ - ファイル検索 - 簡易テキストビューア - 簡易画像ビューア @@ -19,6 +16,13 @@ Gefu is an Experimental File Utility. - 最新版チェック、ダウンロード - SNS連携(タイムライン表示とか) ← ファイラーの機能か? +#### 2014/08/23 Ver0.07 +- ダブルクリック時、ファイルは標準の関連付けで実行するようにした。 +- 設定項目追加。 +- 「外部エディタで開く」を実装。 +- 不具合修正 + - 初期表示時にカーソルがハイライトされない問題を修正。 + #### 2014/08/22 Ver0.06 公開 - 外部および内部のドラッグ&ドロップ処理を実装。 - 一部ダイアログのレイアウト、初期サイズを調整。 diff --git a/common.h b/common.h index 62e79bb..f85b885 100644 --- a/common.h +++ b/common.h @@ -8,41 +8,55 @@ class MainWindow; extern MainWindow* getMainWnd(); extern QString FilesizeToString(quint64 size); -#define VERSION_VALUE 0.06 +#define VERSION_VALUE 0.07 #define slash QString("/") -#define QQ(x) ("\"" + (x) + "\"") +#define QQ(x) ("\"" + QString(x) + "\"") -#define IniKey_ShowHidden "Common/ShowHidden" -#define IniKey_ShowSystem "Common/ShowSystem" -#define IniKey_ConfirmExit "BootAndExit/ConfirmExit" -#define IniKey_BootSizeSpec "BootAndExit/SizeSpec" -#define IniKey_BootSizeRel "BootAndExit/SizeRel" -#define IniKey_BootSizeAbs "BootAndExit/SizeAbs" -#define IniKey_BootPosSpec "BootAndExit/PosSpec" -#define IniKey_BootPosRel "BootAndExit/PosRel" -#define IniKey_BootPosAbs "BootAndExit/PosAbs" -#define IniKey_ResetOnBoot "BootAndExit/Reset" -#define IniKey_BoxColorFg "Appearance/BoxColorFg" -#define IniKey_BoxColorBg "Appearance/BoxColorBg" -#define IniKey_BoxFont "Appearance/BoxFont" -#define IniKey_ViewFont "Appearance/ViewFont" -#define IniKey_ViewColorBgNormal "Appearance/ViewColorBgNormal" -#define IniKey_ViewColorBgMark "Appearance/ViewColorBgMark" -#define IniKey_ViewColorFgNormal "Appearance/ViewColorFgNormal" -#define IniKey_ViewColorFgMark "Appearance/ViewColorFgMark" -#define IniKey_ViewColorFgSystem "Appearance/ViewColorFgSystem" -#define IniKey_ViewColorFgHidden "Appearance/ViewColorFgHidden" -#define IniKey_ViewColorFgReadonly "Appearance/ViewColorFgReadonly" -#define IniKey_WindowGeometry "Window/Geometry" -#define iniKey_WindowState "Window/State" -#define IniSec_Left "Left" -#define IniSec_Right "Right" -#define IniKey_Dir "dir" -#define IniKey_SortBy "SortBy" -#define IniKey_OrderBy "OrderBy" -#define IniKey_PutDirs "PutDirs" -#define IniKey_IgnoreCase "IgnoreCase" +#define IniKey_ShowHidden "Common/ShowHidden" +#define IniKey_ShowSystem "Common/ShowSystem" +#define IniKey_DefaultOnCopy "Common/DefaultCopyMode" +#define IniKey_MoveAfterCreateFolder "Common/MoveAfterFolderCreation" +#define IniKey_OpenAfterCreateFile "Common/OpenAfterFileCreation" +#define IniKey_BootSizeSpec "BootAndExit/SizeSpec" +#define IniKey_BootSizeRel "BootAndExit/SizeRel" +#define IniKey_BootSizeAbs "BootAndExit/SizeAbs" +#define IniKey_BootPosSpec "BootAndExit/PosSpec" +#define IniKey_BootPosRel "BootAndExit/PosRel" +#define IniKey_BootPosAbs "BootAndExit/PosAbs" +#define IniKey_ResetOnBoot "BootAndExit/Reset" +#define IniKey_BoxColorFg "Appearance/BoxColorFg" +#define IniKey_BoxColorBg "Appearance/BoxColorBg" +#define IniKey_BoxFont "Appearance/BoxFont" +#define IniKey_ViewFont "Appearance/ViewFont" +#define IniKey_ViewColorBgNormal "Appearance/ViewColorBgNormal" +#define IniKey_ViewColorBgMark "Appearance/ViewColorBgMark" +#define IniKey_ViewColorFgNormal "Appearance/ViewColorFgNormal" +#define IniKey_ViewColorFgMark "Appearance/ViewColorFgMark" +#define IniKey_ViewColorFgSystem "Appearance/ViewColorFgSystem" +#define IniKey_ViewColorFgHidden "Appearance/ViewColorFgHidden" +#define IniKey_ViewColorFgReadonly "Appearance/ViewColorFgReadonly" +#define IniKey_ConfirmExit "Confirm/Exit" +#define IniKey_ConfirmCopy "Confirm/Copy" +#define IniKey_ConfirmMove "Confirm/Move" +#define IniKey_ConfirmDelete "Confirm/Delete" +#define IniKey_ConfirmRename "Confirm/Rename" +#define IniKey_AutoCloseCopy "AutoClose/Copy" +#define IniKey_AutoCloseMove "AutoClose/Move" +#define IniKey_AutoCloseDelete "AutoClose/Delete" +#define IniKey_AutoCloseRename "AutoClose/Rename" +#define IniKey_EditorPath "Editor/Path" +#define IniKey_EditorOption "Editor/Option" +#define IniKey_TerminalPath "Terminal/Path" +#define IniKey_TerminalOption "TerminalOption" +#define IniKey_WindowGeometry "Window/Geometry" +#define iniKey_WindowState "Window/State" +// 以下は[Left/Right]セクションのキー +#define IniKey_Dir "dir" +#define IniKey_SortBy "SortBy" +#define IniKey_OrderBy "OrderBy" +#define IniKey_PutDirs "PutDirs" +#define IniKey_IgnoreCase "IgnoreCase" #define SortByName QDir::Name #define SortByDate QDir::Time @@ -56,10 +70,4 @@ extern QString FilesizeToString(quint64 size); #define PutDirsLast QDir::DirsLast #define PutDirsDefault 0 -#define DefaultMarkBgColor QColor(0, 192, 0) -#define DefaultMarkFgColor QColor(128, 0, 0) -#define DefaultSystemColor QColor(128, 0, 128) -#define DefaultHiddenColor QColor(128, 128, 128) -#define DefaultReadonlyColor QColor(0, 128, 0) - #endif // COMMON_H diff --git a/filetablemodel.cpp b/filetablemodel.cpp index 0ba7816..a8526e7 100644 --- a/filetablemodel.cpp +++ b/filetablemodel.cpp @@ -149,6 +149,10 @@ bool FileTableModel::isDir(const QModelIndex &index) const const QString FileTableModel::absoluteFilePath(const QModelIndex &index) const { + if (!index.isValid()) { + qDebug() << "index is invalid."; + return QString(); + } return m_dir.absoluteFilePath(m_fileInfoList[index.row()].fileName()); } @@ -157,22 +161,20 @@ QFileInfo FileTableModel::fileInfo(const QModelIndex &index) const return m_fileInfoList[index.row()]; } -#define Brush(x, y, z) QBrush((x).value((y), (z)).value()); - - void FileTableModel::updateAppearance() { QSettings settings; QPalette palette(QApplication::palette("QTableView")); - m_font = settings.value(IniKey_ViewFont, QApplication::font()).value(); - m_NormalBrush = Brush(settings, IniKey_ViewColorBgNormal, palette.base()); - m_NormalTextBrush = Brush(settings, IniKey_ViewColorFgNormal, palette.text()); - m_MarkBrush = Brush(settings, IniKey_ViewColorBgMark, DefaultMarkBgColor); - m_MarkTextBrush = Brush(settings, IniKey_ViewColorFgMark, DefaultMarkFgColor); - m_SystemBrush = Brush(settings, IniKey_ViewColorFgSystem, DefaultSystemColor); - m_HiddenBrush = Brush(settings, IniKey_ViewColorFgHidden, DefaultHiddenColor); - m_ReadonlyBrush = Brush(settings, IniKey_ViewColorFgReadonly, DefaultReadonlyColor); + m_font = settings.value(IniKey_ViewFont).value(); + m_NormalBrush = QBrush(settings.value(IniKey_ViewColorBgNormal).value()); + m_NormalTextBrush = QBrush(settings.value(IniKey_ViewColorFgNormal).value()); + m_MarkBrush = QBrush(settings.value(IniKey_ViewColorBgMark).value()); + m_MarkTextBrush = QBrush(settings.value(IniKey_ViewColorFgMark).value()); + m_SystemBrush = QBrush(settings.value(IniKey_ViewColorFgSystem).value()); + m_HiddenBrush = QBrush(settings.value(IniKey_ViewColorFgHidden).value()); + m_ReadonlyBrush = QBrush(settings.value(IniKey_ViewColorFgReadonly).value()); + m_ReadonlyBrush = QBrush(settings.value(IniKey_ViewColorFgReadonly).value()); beginResetModel(); endResetModel(); diff --git a/filetableview.cpp b/filetableview.cpp index 52d2e3d..1a1fa1a 100644 --- a/filetableview.cpp +++ b/filetableview.cpp @@ -46,7 +46,7 @@ FileTableView::FileTableView(QWidget *parent) : // シグナル/スロットを設定する connect(MENU_TRRIGGERED(action_Open), this, SLOT(setPath())); connect(MENU_TRRIGGERED(action_Exec), this, SLOT(openUrl())); - connect(MENU_TRRIGGERED(action_OpenEditor), this, SLOT(XXX())); + connect(MENU_TRRIGGERED(action_OpenEditor), this, SLOT(openEditor())); connect(MENU_TRRIGGERED(action_Command), this, SLOT(kickProcess())); connect(MENU_TRRIGGERED(mark_Toggle), this, SLOT(toggleChecked())); @@ -86,7 +86,7 @@ FileTableView::FileTableView(QWidget *parent) : this, SLOT(showSystemFiles(bool))); connect(this, SIGNAL(doubleClicked(QModelIndex)), - this, SLOT(setRootIndex(QModelIndex))); + this, SLOT(onDoubleClick(QModelIndex))); // Drag & Drop setDragEnabled(true); @@ -134,6 +134,7 @@ void FileTableView::setRootPath(const QString &path, bool addHistory) } updateMenu(); + selectRow(0); getMainWnd()->statusBar()->showMessage(tr("レディ"), 5000); } } @@ -174,15 +175,67 @@ void FileTableView::setPath() setRootIndex(currentIndex()); } -void FileTableView::openUrl() +void FileTableView::openUrl(const QModelIndex &index) { CHECK_FOCUS; - QFileInfoList list = selectedItems(); - foreach (const QFileInfo &info, list) { - QString path = QDir::toNativeSeparators(info.absoluteFilePath()); + if (index.isValid()) { + FileTableModel *m = static_cast(model()); + QString path = QDir::toNativeSeparators(m->absoluteFilePath(index)); QDesktopServices::openUrl(QUrl("file:///" + path)); } + else { + QFileInfoList list = selectedItems(); + foreach (const QFileInfo &info, list) { + QString path = QDir::toNativeSeparators(info.absoluteFilePath()); + QDesktopServices::openUrl(QUrl("file:///" + path)); + } + } +} + +void FileTableView::openEditor(const QString &path) +{ + CHECK_FOCUS; + + QSettings settings; + if (settings.value(IniKey_EditorPath).toString().isEmpty()) { + QMessageBox::critical( + this, tr("エラー"), + tr("外部エディタのパスが未定義です。")); + return; + } + + QFileInfo info; + if (path.isEmpty()) { + FileTableModel *m = static_cast(model()); + info.setFile(m->absoluteFilePath(currentIndex())); + } + else { + info.setFile(path); + } + QString exe = settings.value(IniKey_EditorPath).toString(); + QString opt = settings.value(IniKey_EditorOption).toString(); + opt.replace("$B", info.completeBaseName()); + opt.replace("$E", info.suffix()); + opt.replace("$F", info.fileName()); + opt.replace("$D", info.absolutePath()); + opt.replace("$P", info.absoluteFilePath()); + + QString command; +#ifdef Q_OS_MAC + command = "open " + exe + " " + opt; +#else + command = QQ(exe) + " " + opt; +#endif + qDebug() << command; + QProcess process(this); + process.setWorkingDirectory(info.absolutePath()); + if (!process.startDetached(command)) { + QMessageBox::critical( + this, tr("エラー"), + tr("外部エディタの起動に失敗しました。
") + + command); + } } void FileTableView::kickProcess() @@ -402,7 +455,7 @@ void FileTableView::setSort() FileTableModel *m = static_cast(model()); m->setSorting(QDir::Name); // 0 - int sortBy = settings.value(side() + slash + IniKey_SortBy, 0).toInt(); + int sortBy = settings.value(side() + slash + IniKey_SortBy).toInt(); switch (sortBy) { case SortByDate: m->setSorting(m->sorting() | QDir::Time); break; case SortBySize: m->setSorting(m->sorting() | QDir::Size); break; @@ -411,19 +464,19 @@ void FileTableView::setSort() } // デフォルトだと文字列は昇順で、数値は降順…orz - int orderBy = settings.value(side() + slash + IniKey_OrderBy, 0).toInt(); + int orderBy = settings.value(side() + slash + IniKey_OrderBy).toInt(); if (((sortBy == SortByName || sortBy == SortByType) && orderBy == OrderByDesc) || ((sortBy == SortByDate || sortBy == SortBySize) && orderBy == OrderByAsc)) { m->setSorting(m->sorting() | QDir::Reversed); } - switch (settings.value(side() + slash + IniKey_PutDirs, 0).toInt()) { + switch (settings.value(side() + slash + IniKey_PutDirs).toInt()) { case PutDirsFirst: m->setSorting(m->sorting() | QDir::DirsFirst); break; case PutDirsLast: m->setSorting(m->sorting() | QDir::DirsLast); break; } - if (settings.value(side() + slash + IniKey_IgnoreCase, true).toBool()) { + if (settings.value(side() + slash + IniKey_IgnoreCase).toBool()) { m->setSorting(m->sorting() | QDir::IgnoreCase); } @@ -577,6 +630,15 @@ void FileTableView::cmdCopy() return; } + QSettings settings; + if (settings.value(IniKey_ConfirmCopy).toBool()) { + int ret = QMessageBox::question(this, tr("確認"), + tr("コピーを実行しますか?")); + if (ret != QMessageBox::Yes) { + return; + } + } + FileTableView *other = getMainWnd()->otherSideView(this); FileTableModel *mOther = static_cast(other->model()); CopyMoveWorker *worker = new CopyMoveWorker(); @@ -589,8 +651,11 @@ void FileTableView::cmdCopy() OperationDialog opDlg(this); opDlg.setWindowTitle(tr("コピー")); opDlg.setWorker(worker); + opDlg.setAutoClose(settings.value(IniKey_AutoCloseCopy).toBool()); opDlg.exec(); + + settings.setValue(IniKey_AutoCloseCopy, opDlg.autoClose()); } void FileTableView::cmdMove() @@ -602,6 +667,15 @@ void FileTableView::cmdMove() return; } + QSettings settings; + if (settings.value(IniKey_ConfirmMove).toBool()) { + int ret = QMessageBox::question(this, tr("確認"), + tr("移動を実行しますか?")); + if (ret != QMessageBox::Yes) { + return; + } + } + FileTableView *other = getMainWnd()->otherSideView(this); FileTableModel *mOther = static_cast(other->model()); CopyMoveWorker *worker = new CopyMoveWorker(); @@ -614,8 +688,11 @@ void FileTableView::cmdMove() OperationDialog opDlg(this); opDlg.setWindowTitle(tr("移動")); opDlg.setWorker(worker); + opDlg.setAutoClose(settings.value(IniKey_AutoCloseMove).toBool()); opDlg.exec(); + + settings.setValue(IniKey_AutoCloseMove, opDlg.autoClose()); } void FileTableView::cmdDelete() @@ -627,25 +704,33 @@ void FileTableView::cmdDelete() return; } - QString msg; - if (list.size() == 1) { - msg = list[0].fileName(); - } - else { - msg = tr("%1個のアイテム").arg(list.size()); + QSettings settings; + if (settings.value(IniKey_ConfirmDelete).toBool()) { + QString msg; + if (list.size() == 1) { + msg = list[0].fileName(); + } + else { + msg = tr("%1個のアイテム").arg(list.size()); + } + int ret = QMessageBox::question( + this, tr("確認"), + msg + tr("を削除しますか?")); + if (ret != QMessageBox::Yes) { + return; + } } - int ret = QMessageBox::question( - this, tr("確認"), - msg + tr("を削除します
よろしいですか?")); - if (ret == QMessageBox::Yes) { - DeleteWorker *worker = new DeleteWorker(); - worker->setDeleteList(&list); + DeleteWorker *worker = new DeleteWorker(); + worker->setDeleteList(&list); - OperationDialog opDlg(this); - opDlg.setWindowTitle(tr("削除")); - opDlg.setWorker(worker); - opDlg.exec(); - } + OperationDialog opDlg(this); + opDlg.setWindowTitle(tr("削除")); + opDlg.setWorker(worker); + opDlg.setAutoClose(settings.value(IniKey_AutoCloseDelete).toBool()); + + opDlg.exec(); + + settings.setValue(IniKey_AutoCloseDelete, opDlg.autoClose()); } void FileTableView::cmdRename() @@ -669,13 +754,26 @@ void FileTableView::cmdRename() dlg->setNames(list); int dlgResult = dlg->exec(); if (dlgResult == QDialog::Accepted && !dlg->renameMap().isEmpty()) { + QSettings settings; + if (settings.value(IniKey_ConfirmRename).toBool()) { + int ret = QMessageBox::question(this, tr("確認"), + tr("名前の変更を実行しますか?")); + if (ret != QMessageBox::Yes) { + return; + } + } + RenameWorker *worker = new RenameWorker(); worker->setRenameMap(&dlg->renameMap()); OperationDialog opDlg(this); opDlg.setWindowTitle(tr("名前を変更")); opDlg.setWorker(worker); + opDlg.setAutoClose(settings.value(IniKey_AutoCloseRename).toBool()); + opDlg.exec(); + + settings.setValue(IniKey_AutoCloseRename, opDlg.autoClose()); } } @@ -698,6 +796,11 @@ void FileTableView::newFile() } else { file.close(); + + QSettings settings; + if (settings.value(IniKey_OpenAfterCreateFile).toBool()) { + openEditor(dir.absoluteFilePath(name)); + } } } } @@ -718,6 +821,12 @@ void FileTableView::newFolder() this, tr("エラー"), tr("フォルダの作成に失敗しました。")); } + else { + QSettings settings; + if (settings.value(IniKey_MoveAfterCreateFolder).toBool()) { + setRootPath(dir.absoluteFilePath(name), true); + } + } } } @@ -733,6 +842,25 @@ void FileTableView::askOverWrite(bool *bOk, int *prevCopyMethod, int *copyMethod const QString &tgtPath) { OverWriteDialog dlg; + if (*prevCopyMethod == OverWriteDialog::Undefined) { + QSettings settings; + QString method = settings.value(IniKey_DefaultOnCopy).toString(); + if (method == "owDefOverWrite") { + *prevCopyMethod = OverWriteDialog::OverWrite; + } + else if (method == "owDefSkip") { + *prevCopyMethod = OverWriteDialog::Skip; + } + else if (method == "owDefAppendNumber") { + *prevCopyMethod = OverWriteDialog::AppendNumber; + } + else if (method == "owDefRename") { + *prevCopyMethod = OverWriteDialog::Rename; + } + else { + *prevCopyMethod = OverWriteDialog::OverWriteIfNew; + } + } dlg.setCopyMethod(*prevCopyMethod); dlg.setSameMethodChecked(*copyMethod != OverWriteDialog::Undefined); dlg.setFileInfo(srcPath, tgtPath); @@ -751,6 +879,23 @@ void FileTableView::askOverWrite(bool *bOk, int *prevCopyMethod, int *copyMethod worker->endAsking(); } +void FileTableView::onDoubleClick(const QModelIndex &index) +{ + if (!index.isValid()) { + return; + } + + FileTableModel *m = static_cast(model()); + + if (m->isDir(index)) { + setRootPath(m->absoluteFilePath(index), true); + } + else { + openUrl(index); + } + +} + void FileTableView::setRootIndex(const QModelIndex &index) { if (!index.isValid()) { @@ -801,6 +946,14 @@ void FileTableView::keyPressEvent(QKeyEvent *event) void FileTableView::focusInEvent(QFocusEvent *event) { + qDebug() << "focusInEvent();"; + if (!currentIndex().isValid()) { + FileTableModel *m = static_cast(model()); + if (m) { + setCurrentIndex(m->index(0, 0)); + } + } + updateMenu(); QTableView::focusInEvent(event); diff --git a/filetableview.h b/filetableview.h index c95ca6a..c173704 100644 --- a/filetableview.h +++ b/filetableview.h @@ -32,9 +32,10 @@ private: signals: void indexChanged(const QString &text); -public slots: +private slots: void setPath(); - void openUrl(); + void openUrl(const QModelIndex &index = QModelIndex()); + void openEditor(const QString &path = QString()); void kickProcess(); void toggleChecked(); @@ -76,6 +77,7 @@ private slots: void askOverWrite(bool *bOk, int *prevCopyMethod, int *copyMethod, QString *alias, const QString &srcPath, const QString &tgtPath); + void onDoubleClick(const QModelIndex &index); // QAbstractItemView interface public slots: diff --git a/folderpanel.cpp b/folderpanel.cpp index fac54e5..85db85b 100644 --- a/folderpanel.cpp +++ b/folderpanel.cpp @@ -64,15 +64,15 @@ void FolderPanel::setSide(const QString &side) //>>>>> フィルタ初期化 model->setFilter(QDir::NoDot | QDir::AllDirs | QDir::Files); - if (settings.value(IniKey_ShowHidden, false).toBool()) { + if (settings.value(IniKey_ShowHidden).toBool()) { model->setFilter(model->filter() | QDir::Hidden); } - if (settings.value(IniKey_ShowSystem, false).toBool()) { + if (settings.value(IniKey_ShowSystem).toBool()) { model->setFilter(model->filter() | QDir::System); } //>>>>> ソート順初期化 model->setSorting(QDir::Name); // 0 - int sortBy = settings.value(side + slash + IniKey_SortBy, SortByName).toInt(); + int sortBy = settings.value(side + slash + IniKey_SortBy).toInt(); switch (sortBy) { case SortByDate: model->setSorting(model->sorting() | QDir::Time); break; case SortBySize: model->setSorting(model->sorting() | QDir::Size); break; @@ -80,24 +80,23 @@ void FolderPanel::setSide(const QString &side) default: model->setSorting(model->sorting() | QDir::Name); break; } // デフォルトだと文字列は昇順で、数値は降順…orz - int orderBy = settings.value(side + slash + IniKey_OrderBy, OrderByAsc).toInt(); + int orderBy = settings.value(side + slash + IniKey_OrderBy).toInt(); if (((sortBy == SortByName || sortBy == SortByType) && orderBy == OrderByDesc) || ((sortBy == SortByDate || sortBy == SortBySize) && orderBy == OrderByAsc)) { model->setSorting(model->sorting() | QDir::Reversed); } // フォルダの位置 - switch (settings.value(side + slash + IniKey_PutDirs, PutDirsFirst).toInt()) { + switch (settings.value(side + slash + IniKey_PutDirs).toInt()) { case PutDirsFirst: model->setSorting(model->sorting() | QDir::DirsFirst); break; case PutDirsLast: model->setSorting(model->sorting() | QDir::DirsLast); break; } // 大文字小文字の区別 - if (settings.value(side + slash + IniKey_IgnoreCase, true).toBool()) { + if (settings.value(side + slash + IniKey_IgnoreCase).toBool()) { model->setSorting(model->sorting() | QDir::IgnoreCase); } //>>>>> 監視フォルダ初期化 - QString key = side + slash + IniKey_Dir; - QString path = settings.value(key, QDir::homePath()).toString(); + QString path = settings.value(side + slash + IniKey_Dir).toString(); model->updateAppearance(); ui->fileTable->setModel(model); @@ -110,22 +109,18 @@ void FolderPanel::updateAppearance() QPalette palette; QFont font; - font = ui->locationField->font(); - font = settings.value(IniKey_BoxFont, font).value(); + font = settings.value(IniKey_BoxFont).value(); palette = ui->locationField->palette(); - palette.setColor( - QPalette::Base, - settings.value(IniKey_BoxColorBg, palette.base()).value()); - palette.setColor( - QPalette::Text, - settings.value(IniKey_BoxColorFg, palette.text()).value()); + palette.setColor(QPalette::Base, + settings.value(IniKey_BoxColorBg).value()); + palette.setColor(QPalette::Text, + settings.value(IniKey_BoxColorFg).value()); ui->locationField->setFont(font); ui->locationField->setPalette(palette); palette = ui->fileTable->palette(); - palette.setColor( - QPalette::Base, - settings.value(IniKey_ViewColorBgNormal, palette.base()).value()); + palette.setColor(QPalette::Base, + settings.value(IniKey_ViewColorBgNormal).value()); ui->fileTable->setPalette(palette); FileTableModel *model = static_cast(ui->fileTable->model()); diff --git a/folderpanel.ui b/folderpanel.ui index fc653b8..0c6772b 100644 --- a/folderpanel.ui +++ b/folderpanel.ui @@ -48,6 +48,9 @@ + + Qt::StrongFocus + Qt::ScrollBarAlwaysOn diff --git a/main.cpp b/main.cpp index c2049bb..9357b5a 100644 --- a/main.cpp +++ b/main.cpp @@ -1,7 +1,9 @@ #include "common.h" #include "mainwindow.h" + #include #include +#include int main(int argc, char *argv[]) { @@ -20,6 +22,102 @@ int main(int argc, char *argv[]) settings.clear(); } + // 各オプションのデフォルト値を設定する + //>>>>> 起動と終了 + if (settings.value(IniKey_ConfirmExit, "").toString().isEmpty()) + settings.setValue(IniKey_ConfirmExit, true); + if (settings.value(IniKey_BootSizeSpec, "").toString().isEmpty()) { + settings.setValue(IniKey_BootSizeSpec, "sizeLast"); + settings.setValue(IniKey_BootSizeAbs, QSize(800,600)); + settings.setValue(IniKey_BootSizeRel, QSize(50,50)); + } + if (settings.value(IniKey_BootPosSpec, "").toString().isEmpty()) { + settings.setValue(IniKey_BootPosSpec, "posLast"); + settings.setValue(IniKey_BootPosAbs, QPoint(0, 0)); + settings.setValue(IniKey_BootPosRel, QPoint(0, 0)); + } + //>>>>> 色とフォント + if (settings.value(IniKey_BoxFont, "").toString().isEmpty()) { + settings.setValue(IniKey_BoxFont, a.font()); + settings.setValue(IniKey_BoxColorBg, QPalette().base().color()); + settings.setValue(IniKey_BoxColorFg, QPalette().text().color()); + } + if (settings.value(IniKey_ViewFont, "").toString().isEmpty()) { + settings.setValue(IniKey_ViewFont, a.font()); + settings.setValue(IniKey_ViewColorBgMark, QColor(0,192,0)); + settings.setValue(IniKey_ViewColorBgNormal, QPalette().base().color()); + settings.setValue(IniKey_ViewColorFgHidden, QColor(128,128,128)); + settings.setValue(IniKey_ViewColorFgMark, QColor(128,0,0)); + settings.setValue(IniKey_ViewColorFgNormal, QPalette().text().color()); + settings.setValue(IniKey_ViewColorFgReadonly, QColor(0,128,0)); + settings.setValue(IniKey_ViewColorFgSystem, QColor(128,0,128)); + } + //>>>>> + if (settings.value(IniKey_AutoCloseCopy, "").toString().isEmpty()) { + settings.setValue(IniKey_AutoCloseCopy, false); + settings.setValue(IniKey_AutoCloseDelete, false); + settings.setValue(IniKey_AutoCloseMove, false); + settings.setValue(IniKey_AutoCloseRename, false); + } + if (settings.value(IniKey_ConfirmCopy, "").toString().isEmpty()) { + settings.setValue(IniKey_ConfirmCopy, true); + settings.setValue(IniKey_ConfirmDelete, true); + settings.setValue(IniKey_ConfirmMove, true); + settings.setValue(IniKey_ConfirmRename, true); + } + if (settings.value(IniKey_DefaultOnCopy, "").toString().isEmpty()) + settings.setValue(IniKey_DefaultOnCopy, "owDefIfNew"); + if (settings.value(IniKey_MoveAfterCreateFolder, "").toString().isEmpty()) + settings.setValue(IniKey_MoveAfterCreateFolder, false); + if (settings.value(IniKey_OpenAfterCreateFile, "").toString().isEmpty()) + settings.setValue(IniKey_OpenAfterCreateFile, false); + //>>>>> + if (settings.value(IniKey_EditorPath, "").toString().isEmpty()) { +#if defined(Q_OS_WIN) + settings.setValue(IniKey_EditorPath, "notepad.exe"); +#elif defined(Q_OS_MAC) + settings.setValue(IniKey_EditorPath, "-t"); +#else + settings.setValue(IniKey_EditorPath, "gedit"); +#endif + settings.setValue(IniKey_EditorOption, QQ("$P")); + } + if (settings.value(IniKey_TerminalPath, "").toString().isEmpty()) { +#if defined(Q_OS_WIN) + settings.setValue(IniKey_TerminalPath, "cmd.exe"); + settings.setValue(IniKey_TerminalOption, "/k cd " + QQ("$D")); +#elif defined(Q_OS_MAC) + settings.setValue(IniKey_TerminalPath, "/Applications/Utilities/Terminal.app"); + settings.setValue(IniKey_TerminalOption, "-c cd " + QQ("$D")); +#else + settings.setValue(IniKey_TerminalPath, "gnome-terminal"); + settings.setValue(IniKey_TerminalOption, "-c cd " + QQ("$D")); +#endif + } + //>>>>> 隠しファイルの表示 + if (settings.value(IniKey_ShowHidden, "").toString().isEmpty()) + settings.setValue(IniKey_ShowHidden, false); + //>>>>> システムファイルの表示 + if (settings.value(IniKey_ShowSystem, "").toString().isEmpty()) + settings.setValue(IniKey_ShowSystem, false); + //>>>>> 最後のフォルダとソート方法 + QString side = "Left/"; + if (settings.value(side + IniKey_Dir, "").toString().isEmpty()) { + settings.setValue(side + IniKey_Dir, QDir::homePath()); + settings.setValue(side + IniKey_SortBy, SortByName); + settings.setValue(side + IniKey_OrderBy, OrderByAsc); + settings.setValue(side + IniKey_PutDirs, PutDirsFirst); + settings.setValue(side + IniKey_IgnoreCase, true); + } + side = "Right/"; + if (settings.value(side + IniKey_Dir, "").toString().isEmpty()) { + settings.setValue(side + IniKey_Dir, QDir::homePath()); + settings.setValue(side + IniKey_SortBy, SortByName); + settings.setValue(side + IniKey_OrderBy, OrderByAsc); + settings.setValue(side + IniKey_PutDirs, PutDirsFirst); + settings.setValue(side + IniKey_IgnoreCase, true); + } + MainWindow w; w.show(); diff --git a/mainwindow.cpp b/mainwindow.cpp index d5343ad..741a032 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -22,13 +22,20 @@ MainWindow::MainWindow(QWidget *parent) : ui->RPanel->updateAppearance(); QSettings settings; - // メニュー項目のチェック状態を初期化する - if (settings.value(IniKey_ShowHidden, false).toBool()) { + // メニュー項目の状態を初期化する + if (settings.value(IniKey_ShowHidden).toBool()) { ui->view_Hidden->setChecked(true); } - if (settings.value(IniKey_ShowSystem, false).toBool()) { + if (settings.value(IniKey_ShowSystem).toBool()) { ui->view_System->setChecked(true); } + bool enabled; + enabled = !settings.value(IniKey_EditorPath).toString().isEmpty(); + ui->action_OpenEditor->setEnabled(enabled); + + enabled = settings.value(IniKey_TerminalPath).toString().isEmpty(); + ui->action_OpenTerminal->setEnabled(enabled); + // 追加のショートカットキーを設定する QList shortcuts; shortcuts = ui->action_Open->shortcuts(); @@ -63,11 +70,13 @@ MainWindow::MainWindow(QWidget *parent) : QPoint point = this->geometry().topLeft(); QSize size = this->geometry().size(); //>>>> 前回の位置・サイズ・状態を復元する - restoreGeometry(settings.value(IniKey_WindowGeometry).toByteArray()); - restoreState(settings.value(iniKey_WindowState).toByteArray()); + if (!settings.value(IniKey_WindowGeometry, "").toString().isEmpty()) { + restoreGeometry(settings.value(IniKey_WindowGeometry).toByteArray()); + restoreState(settings.value(iniKey_WindowState).toByteArray()); + } //>>>> INIファイルの設定から復元する //>>> サイズ - strValue = settings.value(IniKey_BootSizeSpec, "").toString(); + strValue = settings.value(IniKey_BootSizeSpec).toString(); if (strValue == "sizeAbsolute") { size = settings.value(IniKey_BootSizeAbs).toSize(); } @@ -80,7 +89,7 @@ MainWindow::MainWindow(QWidget *parent) : size = this->geometry().size(); } //>>> 位置 - strValue = settings.value(IniKey_BootPosSpec, "").toString(); + strValue = settings.value(IniKey_BootPosSpec).toString(); if (strValue == "posAbsolute") { point = settings.value(IniKey_BootPosAbs).toPoint(); } @@ -125,6 +134,14 @@ void MainWindow::onActionSetting() if (dlg.exec() == QDialog::Accepted) { ui->LPanel->updateAppearance(); ui->RPanel->updateAppearance(); + + QSettings settings; + bool enabled; + enabled = !settings.value(IniKey_EditorPath).toString().isEmpty(); + ui->action_OpenEditor->setEnabled(enabled); + + enabled = settings.value(IniKey_TerminalPath).toString().isEmpty(); + ui->action_OpenTerminal->setEnabled(enabled); } } @@ -133,7 +150,7 @@ void MainWindow::toggleShowHiddenFiles() // キーボードがトリガーの場合、メニュー項目のチェック状態は // 変わらない(Mac)ので、QSettingsを使う QSettings settings; - bool show = !settings.value(IniKey_ShowHidden, false).toBool(); + bool show = !settings.value(IniKey_ShowHidden).toBool(); settings.setValue(IniKey_ShowHidden, show); ui->view_Hidden->setChecked(show); @@ -146,7 +163,7 @@ void MainWindow::toggleShowSystemFiles() // キーボードがトリガーの場合、メニュー項目のチェック状態は // 変わらない(Mac)ので、QSettingsを使う QSettings settings; - bool show = !settings.value(IniKey_ShowSystem, false).toBool(); + bool show = !settings.value(IniKey_ShowSystem).toBool(); settings.setValue(IniKey_ShowSystem, show); ui->view_System->setChecked(show); @@ -182,7 +199,7 @@ void MainWindow::closeEvent(QCloseEvent *event) { QSettings settings; - if (settings.value(IniKey_ConfirmExit, true).toBool()) { + if (settings.value(IniKey_ConfirmExit).toBool()) { QMessageBox msgBox; QCheckBox *checkBox = new QCheckBox(); checkBox->setText(tr("次回以降は確認しない")); diff --git a/mainwindow.ui b/mainwindow.ui index 5975556..ba7020a 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -252,6 +252,7 @@ + @@ -839,6 +840,17 @@ L + + + ターミナルで開く + + + ターミナルで開く + + + > + + diff --git a/operationdialog.cpp b/operationdialog.cpp index 75268ba..6c2d60b 100644 --- a/operationdialog.cpp +++ b/operationdialog.cpp @@ -20,6 +20,16 @@ OperationDialog::~OperationDialog() delete ui; } +void OperationDialog::setAutoClose(bool yes) +{ + ui->chkAutoClose->setChecked(yes); +} + +bool OperationDialog::autoClose() const +{ + return ui->chkAutoClose->isChecked(); +} + void OperationDialog::showEvent(QShowEvent *) { ui->textEdit->setVisible(false); diff --git a/operationdialog.h b/operationdialog.h index 7d4d0bf..5821c77 100644 --- a/operationdialog.h +++ b/operationdialog.h @@ -19,6 +19,8 @@ public: void setWorker(IWorker *worker) { m_worker = worker; } + void setAutoClose(bool yes); + bool autoClose() const; protected: void showEvent(QShowEvent *); diff --git a/preferencedialog.cpp b/preferencedialog.cpp index 6eba542..3ac0073 100644 --- a/preferencedialog.cpp +++ b/preferencedialog.cpp @@ -8,8 +8,7 @@ #include #include #include - - +#include PreferenceDialog::PreferenceDialog(QWidget *parent) : QDialog(parent), @@ -21,8 +20,6 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) : ui->setupUi(this); ui->tabWidget->setCurrentIndex(0); - ui->tabWidget->setTabText(0, "起動と終了"); - ui->tabWidget->setTabText(1, "色とフォント"); ui->sampleEdit->setText(QDir::homePath()); ui->sampleTable->setModel(&m_model); ui->sampleTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); @@ -54,6 +51,9 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) : connect(ui->viewFontBold, SIGNAL(clicked()), this, SLOT(changeFont())); connect(ui->viewFontSize, SIGNAL(valueChanged(int)), this, SLOT(changeFont())); + connect(ui->termBrowse, SIGNAL(clicked()), this, SLOT(browseApp())); + connect(ui->editorBrowse, SIGNAL(clicked()), this, SLOT(browseApp())); + QSettings settings; QString strValue; QSize size; @@ -65,9 +65,9 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) : //>>>>> 起動と終了 // 終了時の確認ダイアログ - ui->confirmExit->setChecked(settings.value(IniKey_ConfirmExit, true).toBool()); + ui->confirmExit->setChecked(settings.value(IniKey_ConfirmExit).toBool()); // 起動時のサイズ - strValue = settings.value(IniKey_BootSizeSpec, "sizeLast").toString(); + strValue = settings.value(IniKey_BootSizeSpec).toString(); if (strValue.isEmpty()) { ui->bootSize->setChecked(false); } @@ -79,14 +79,14 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) : } radioBtn->setChecked(true); } - size = settings.value(IniKey_BootSizeAbs, QSize(800, 600)).toSize(); + size = settings.value(IniKey_BootSizeAbs).toSize(); ui->absoluteWidth->setValue(size.width()); ui->absoluteHeight->setValue(size.height()); - size = settings.value(IniKey_BootSizeRel, QSize(50, 50)).toSize(); + size = settings.value(IniKey_BootSizeRel).toSize(); ui->relativeWidth->setValue(size.width()); ui->relativeHeight->setValue(size.height()); // 起動時の位置 - strValue = settings.value(IniKey_BootPosSpec, "posLast").toString(); + strValue = settings.value(IniKey_BootPosSpec).toString(); if (strValue.isEmpty()) { ui->bootPos->setChecked(false); } @@ -98,27 +98,26 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) : } radioBtn->setChecked(true); } - point = settings.value(IniKey_BootPosAbs, QPoint(0, 0)).toPoint(); + point = settings.value(IniKey_BootPosAbs).toPoint(); ui->absoluteLeft->setValue(point.x()); ui->absoluteTop->setValue(point.y()); - point = settings.value(IniKey_BootPosRel, QPoint(0, 0)).toPoint(); + point = settings.value(IniKey_BootPosRel).toPoint(); ui->relativeLeft->setValue(point.x()); ui->relativeTop->setValue(point.y()); // 起動時の設定削除 - ui->resetOnBoot->setChecked(settings.value(IniKey_ResetOnBoot, false).toBool()); + ui->resetOnBoot->setChecked(settings.value(IniKey_ResetOnBoot).toBool()); //>>>>> 色とフォント //>>>> アドレスボックス palette = QPalette(); // 背景色 - color = settings.value(IniKey_BoxColorBg, QPalette().base().color()).value(); + color = settings.value(IniKey_BoxColorBg).value(); palette.setColor(QPalette::Base, color); // 文字色 - color = settings.value(IniKey_BoxColorFg, QPalette().text().color()).value(); + color = settings.value(IniKey_BoxColorFg).value(); palette.setColor(QPalette::Text, color); // フォント - QFont defaultFont = ui->sampleEdit->font(); - font = settings.value(IniKey_BoxFont, defaultFont).value(); + font = settings.value(IniKey_BoxFont).value(); ui->boxFont->setCurrentText(font.family()); ui->boxFontBold->setChecked(font.bold()); ui->boxFontSize->setValue(font.pointSize()); @@ -127,30 +126,61 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) : ui->sampleEdit->setFont(font); //>>>> ファイルビュー // 背景色 - color = settings.value(IniKey_ViewColorBgMark, DefaultMarkBgColor).value(); + color = settings.value(IniKey_ViewColorBgMark).value(); m_colorMap["clrBgMark"] = color; - color = settings.value(IniKey_ViewColorBgNormal, QPalette().base().color()).value(); + color = settings.value(IniKey_ViewColorBgNormal).value(); m_colorMap["clrBgNormal"] = color; // 文字色 - color = settings.value(IniKey_ViewColorFgHidden, DefaultHiddenColor).value(); + color = settings.value(IniKey_ViewColorFgHidden).value(); m_colorMap["clrFgHidden"] = color; - color = settings.value(IniKey_ViewColorFgMark, DefaultMarkFgColor).value(); + color = settings.value(IniKey_ViewColorFgMark).value(); m_colorMap["clrFgMark"] = color; - color = settings.value(IniKey_ViewColorFgNormal, QPalette().text().color()).value(); + color = settings.value(IniKey_ViewColorFgNormal).value(); m_colorMap["clrFgNormal"] = color; - color = settings.value(IniKey_ViewColorFgReadonly, DefaultReadonlyColor).value(); + color = settings.value(IniKey_ViewColorFgReadonly).value(); m_colorMap["clrFgReadonly"] = color; - color = settings.value(IniKey_ViewColorFgSystem, DefaultSystemColor).value(); + color = settings.value(IniKey_ViewColorFgSystem).value(); m_colorMap["clrFgSystem"] = color; // フォント - defaultFont = ui->sampleTable->font(); - font = settings.value(IniKey_ViewFont, defaultFont).value(); + font = settings.value(IniKey_ViewFont).value(); ui->viewFont->setCurrentText(font.family()); ui->viewFontBold->setChecked(font.bold()); ui->viewFontSize->setValue(font.pointSize()); // サンプル表示 m_model.setFont(font); m_model.update(); + + //>>>>> ファイル操作 + // 確認ダイアログの表示 + ui->confirmCopy->setChecked(settings.value(IniKey_ConfirmCopy).toBool()); + ui->confirmDelete->setChecked(settings.value(IniKey_ConfirmDelete).toBool()); + ui->confirmMove->setChecked(settings.value(IniKey_ConfirmMove).toBool()); + ui->confirmRename->setChecked(settings.value(IniKey_ConfirmRename).toBool()); + // 完了ダイアログの自動クローズ + ui->autoCloseCopy->setChecked(settings.value(IniKey_AutoCloseCopy).toBool()); + ui->autoCloseDelete->setChecked(settings.value(IniKey_AutoCloseDelete).toBool()); + ui->autoCloseMove->setChecked(settings.value(IniKey_AutoCloseMove).toBool()); + ui->autoCloseRename->setChecked(settings.value(IniKey_AutoCloseRename).toBool()); + // 上書き時の既定動作 + strValue = settings.value(IniKey_DefaultOnCopy).toString(); + if (strValue.isEmpty()) { + strValue = "owDefIfNew"; + } + radioBtn = findChild(strValue); + if (radioBtn == NULL) { + radioBtn = ui->owDefIfNew; + } + radioBtn->setChecked(true); + ui->moveAfterCreate->setChecked(settings.value(IniKey_MoveAfterCreateFolder).toBool()); + ui->openAfterCreate->setChecked(settings.value(IniKey_OpenAfterCreateFile).toBool()); + + //>>>>> パス設定 + // エディタ + ui->editorOpt->setText(settings.value(IniKey_EditorOption).toString()); + ui->editorPath->setText(settings.value(IniKey_EditorPath).toString()); + // ターミナル + ui->termOpt->setText(settings.value(IniKey_TerminalOption).toString()); + ui->termPath->setText(settings.value(IniKey_TerminalPath).toString()); } PreferenceDialog::~PreferenceDialog() @@ -267,6 +297,21 @@ void PreferenceDialog::selectViewColor() m_model.update(); } +void PreferenceDialog::browseApp() +{ + QString path = QFileDialog::getOpenFileName( + this, tr("アプリケーションを選択"), "", + tr("実行ファイル (*.exe *.com *.bat *.pif);;すべてのファイル (*)")); + if (!path.isEmpty()) { + if (sender() == ui->editorBrowse) { + ui->editorPath->setText(path); + } + else if (sender() == ui->termBrowse) { + ui->termPath->setText(path); + } + } +} + void PreferenceDialog::accept() { QSettings settings; @@ -324,5 +369,30 @@ void PreferenceDialog::accept() settings.setValue(IniKey_ViewColorFgSystem, m_colorMap["clrFgSystem"]); settings.setValue(IniKey_ViewFont, m_model.font()); + //>>>>> ファイル操作 + settings.setValue(IniKey_ConfirmCopy, ui->confirmCopy->isChecked()); + settings.setValue(IniKey_ConfirmDelete, ui->confirmDelete->isChecked()); + settings.setValue(IniKey_ConfirmMove, ui->confirmMove->isChecked()); + settings.setValue(IniKey_ConfirmRename, ui->confirmRename->isChecked()); + + settings.setValue(IniKey_AutoCloseCopy, ui->autoCloseCopy->isChecked()); + settings.setValue(IniKey_AutoCloseDelete, ui->autoCloseDelete->isChecked()); + settings.setValue(IniKey_AutoCloseMove, ui->autoCloseMove->isChecked()); + settings.setValue(IniKey_AutoCloseRename, ui->autoCloseRename->isChecked()); + + selected = ui->overwriteOptions->checkedButton(); + settings.setValue(IniKey_DefaultOnCopy, selected->objectName()); + + settings.setValue(IniKey_MoveAfterCreateFolder, ui->moveAfterCreate->isChecked()); + settings.setValue(IniKey_OpenAfterCreateFile, ui->openAfterCreate->isChecked()); + + //>>>>> パス設定 + settings.setValue(IniKey_EditorOption, ui->editorOpt->text().trimmed()); + settings.setValue(IniKey_EditorPath, ui->editorPath->text().trimmed()); + + settings.setValue(IniKey_TerminalOption, ui->termOpt->text().trimmed()); + settings.setValue(IniKey_TerminalPath, ui->termPath->text().trimmed()); + + QDialog::accept(); } diff --git a/preferencedialog.h b/preferencedialog.h index 867abaf..3a7a191 100644 --- a/preferencedialog.h +++ b/preferencedialog.h @@ -28,6 +28,7 @@ private slots: void setControlsEnabled(bool enabled); void selectBoxColor(); void selectViewColor(); + void browseApp(); // QDialog interface public slots: diff --git a/preferencedialog.ui b/preferencedialog.ui index d6f515e..480e4c9 100644 --- a/preferencedialog.ui +++ b/preferencedialog.ui @@ -6,7 +6,7 @@ 0 0 - 589 + 631 527 @@ -26,11 +26,11 @@ Qt::StrongFocus - 1 + 2 - Tab 1 + 起動と終了 @@ -600,7 +600,7 @@ - Tab 2 + 色とフォント @@ -877,7 +877,7 @@ - 100 + 200 0 @@ -912,6 +912,407 @@ + + + ファイル操作 + + + + + + 操作の開始時、確認ダイアログを表示する + + + + + + Qt::StrongFocus + + + コピー + + + + + + + Qt::StrongFocus + + + 移動 + + + + + + + Qt::StrongFocus + + + 削除 + + + + + + + Qt::StrongFocus + + + 名前変更 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 操作の成功時、進捗ダイアログを自動で閉じる + + + + + + Qt::StrongFocus + + + コピー + + + + + + + Qt::StrongFocus + + + 移動 + + + + + + + Qt::StrongFocus + + + 削除 + + + + + + + Qt::StrongFocus + + + 名前変更 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 同名ファイル存在時の既定の動作 + + + + + + Qt::StrongFocus + + + 上書き + + + overwriteOptions + + + + + + + Qt::StrongFocus + + + 新しければ上書き + + + overwriteOptions + + + + + + + Qt::StrongFocus + + + スキップ + + + overwriteOptions + + + + + + + Qt::StrongFocus + + + ファイル名末尾に数字を付与 + + + overwriteOptions + + + + + + + Qt::StrongFocus + + + 名前を変更 + + + overwriteOptions + + + + + + + + + + Qt::StrongFocus + + + フォルダ作成後は、そのフォルダに移動する + + + + + + + Qt::StrongFocus + + + ファイル作成後は、そのファイルをエディタで開く + + + + + + + Qt::Vertical + + + + 20 + 102 + + + + + + + + + パス設定 + + + + + + 0 + + + + + -1 + + + + + 外部エディタ: + + + + + + + + + + 参照 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + オプション引数: + + + + + + + + + + + + + + 0 + + + + + -1 + + + + + コマンドライン端末: + + + + + + + + + + 参照 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + オプション引数: + + + + + + + + + + + + + + + Courier + + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Courier'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'.Lucida Grande UI';">オプション引数に使える文字</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'.Lucida Grande UI';">$B ... ファイル名から拡張子を除いた部分</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'.Lucida Grande UI';">$E ... 拡張子</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'.Lucida Grande UI';">$F ... ファイル名($B.$Eと同じ)</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'.Lucida Grande UI';">$D ... フォルダ名</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'.Lucida Grande UI';">$P ... フルパス($D/$Fと同じ)</span></p></body></html> + + + + + + + Qt::Vertical + + + + 20 + 121 + + + + + + verticalSpacer_4 + + optExplain + @@ -930,7 +1331,6 @@ - tabWidget confirmExit bootSize sizeAbsolute @@ -1004,6 +1404,7 @@ + diff --git a/sortdialog.cpp b/sortdialog.cpp index e2b1a2b..fd3b967 100644 --- a/sortdialog.cpp +++ b/sortdialog.cpp @@ -22,9 +22,7 @@ void SortDialog::setRightOrLeft(const QString &s) QSettings settings; m_RightOrLeft = s; - int sortBy = settings.value( - m_RightOrLeft + slash + IniKey_SortBy, - SortByName).toInt(); + int sortBy = settings.value(m_RightOrLeft + slash + IniKey_SortBy).toInt(); if (sortBy == SortByType) { ui->sortByType->setChecked(true); } @@ -38,9 +36,7 @@ void SortDialog::setRightOrLeft(const QString &s) ui->sortByName->setChecked(true); } - int orderBy = settings.value( - m_RightOrLeft + slash + IniKey_OrderBy, - OrderByAsc).toInt(); + int orderBy = settings.value(m_RightOrLeft + slash + IniKey_OrderBy).toInt(); if (orderBy == OrderByDesc) { ui->orderDesc->setChecked(true); } @@ -48,9 +44,7 @@ void SortDialog::setRightOrLeft(const QString &s) ui->orderAsc->setChecked(true); } - int putDirs = settings.value( - m_RightOrLeft + slash + IniKey_PutDirs, - PutDirsFirst).toInt(); + int putDirs = settings.value(m_RightOrLeft + slash + IniKey_PutDirs).toInt(); if (putDirs == PutDirsDefault) { ui->dirsDefault->setChecked(true); } @@ -61,8 +55,7 @@ void SortDialog::setRightOrLeft(const QString &s) ui->dirsFirst->setChecked(true); } - bool ignoreCase = settings.value( - m_RightOrLeft + slash + IniKey_IgnoreCase, true).toBool(); + bool ignoreCase = settings.value(m_RightOrLeft + slash + IniKey_IgnoreCase).toBool(); ui->ignoreCase->setChecked(ignoreCase); } -- 2.11.0