From 96f2dd4fe3abf800b675ec4da1968f6a5ca6d121 Mon Sep 17 00:00:00 2001 From: Masayuki Satoh Date: Fri, 29 Aug 2014 11:49:20 +0900 Subject: [PATCH] Ver0.17 --- Gefu.pro | 9 ++- README.md | 6 ++ ReadMe.txt | 26 ++++--- bookmarkdialog.cpp | 214 +++++++++++++++++++++++++++++++++++++++++++++++++++++ bookmarkdialog.h | 39 ++++++++++ bookmarkdialog.ui | 173 +++++++++++++++++++++++++++++++++++++++++++ common.h | 4 +- folderpanel.cpp | 73 +++++++++++++++--- folderpanel.h | 5 ++ folderpanel.ui | 33 +++++++-- folderview.cpp | 9 ++- folderview.h | 6 +- installer-full.nsi | 4 +- installer.nsi | 4 +- keybind.txt | 17 +++-- mainwindow.cpp | 163 +++++++++++++++++++++++----------------- mainwindow.h | 10 +-- mainwindow.ui | 27 +++++++ version.h | 2 +- 19 files changed, 702 insertions(+), 122 deletions(-) create mode 100644 bookmarkdialog.cpp create mode 100644 bookmarkdialog.h create mode 100644 bookmarkdialog.ui diff --git a/Gefu.pro b/Gefu.pro index b6dc477..e9c4f08 100644 --- a/Gefu.pro +++ b/Gefu.pro @@ -42,7 +42,8 @@ SOURCES += main.cpp\ locationbox.cpp \ simpleimageview.cpp \ anyview.cpp \ - folderpanel.cpp + folderpanel.cpp \ + bookmarkdialog.cpp HEADERS += mainwindow.h \ renamesingledialog.h \ @@ -68,7 +69,8 @@ HEADERS += mainwindow.h \ version.h \ simpleimageview.h \ anyview.h \ - folderpanel.h + folderpanel.h \ + bookmarkdialog.h FORMS += mainwindow.ui \ renamesingledialog.ui \ @@ -79,7 +81,8 @@ FORMS += mainwindow.ui \ historydialog.ui \ preferencedialog.ui \ anyview.ui \ - folderpanel.ui + folderpanel.ui \ + bookmarkdialog.ui RESOURCES += \ resource.qrc diff --git a/README.md b/README.md index a07eceb..8fed84a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,12 @@ Gefu is an Experimental File Utility. * 簡易FTPクライアント * SNS連携(タイムライン表示とか) ← ファイラーの機能か? +#### 2014/08/29 Ver0.17 + * コンテキストメニューにファイル操作系アクションを追加。 + * ブックマーク機能を実装。 + * 不具合修正 + * 検索ボックスでのEnterキーイベントが2回処理されていたのを修正。 + #### 2014/08/28 Ver0.16 * 設定ファイルの格納先を変更。 * アップデート確認先のURLを変更。 diff --git a/ReadMe.txt b/ReadMe.txt index 595c75a..85818f1 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -38,9 +38,8 @@ ◇ インストール ◇ Windows - 1. GefuXXX.zip をダウンロード、展開します。 - 2. Gefu_QtDLL.zip をダウンロード、展開します。 - 3. 展開された Gefu.exe とQtライブラリ(*.dll)を同じフォルダに格納します。 + 1. GefuXXX_full_setup.exe をダウンロード、実行します。 + 2. インストールウィザードの指示に従ってください。 Mac 1. GefuXXX.app.zip をダウンロード、展開します。 @@ -48,9 +47,8 @@ ◇ アップデート ◇ Windows - 1. GefuXXX.zip をダウンロード、展開します。 - 2. Gefu.exe が起動している場合は、終了します。 - 3. 展開された Gefu.exe を、既存の Gefu.exe に上書きします。 + 1. GefuXXX_Setuo.exe をダウンロード、実行します。 + 2. インストールウィザードの指示に従ってください。 Mac 1. GefuXXX.app.zip をダウンロード、展開します。 @@ -59,14 +57,13 @@ ◇ アンインストール ◇ Windows - 1. Gefu.exe と Qtライブラリ(*.dll)を削除します。 - 2. 設定ファイルまで削除したい場合は、以下のファイルを削除します。 - %APPDATA%¥miyabi¥Gefu.ini + 1. スタートメニューからGefu → Uninstallをクリックします。 + 2. 画面の指示に従ってください。 Mac 1. Gefu.app を削除します。 2. 設定ファイルまで削除したい場合は、以下のファイルを削除します。 - ~/.config/rakusaba.jp/Gefu.ini + ~/.config/sourceforge.jp/Gefu.ini ◇ 使い方 ◇ 基本的には、WindowsのエクスプローラやMacのFinderと同じ感覚で使ってください。 @@ -79,6 +76,8 @@ 導入方法などを解説しています。 Wiki ... http://sourceforge.jp/projects/gefu/wiki/FrontPage 各種ドキュメントを閲覧できます。 + Gefuの作業部屋 ... http://masayuki_satoh.b.sourceforge.jp/ + 開発ブログです。 ◇ 免責事項 ◇ - Gefu(げふぅ)はオープンソース・フリーソフトウェアです。 @@ -92,10 +91,17 @@ ◇ 連絡先 ◇ Web: https://sourceforge.jp/projects/gefu/ http://gefu.sourceforge.jp/ + http://masayuki_satoh.b.sourceforge.jp/ Mail: miyabi.satoh@gmail.com Twitter: https://twitter.com/miyabi_satoh ◇ 履歴 ◇ +#### 2014/08/29 Ver0.17 + * コンテキストメニューにファイル操作系アクションを追加。 + * ブックマーク機能を実装。 + * 不具合修正 + * 検索ボックスでのEnterキーイベントが2回処理されていたのを修正。 + #### 2014/08/28 Ver0.16 * 設定ファイルの格納先を変更。 * アップデート確認先のURLを変更。 diff --git a/bookmarkdialog.cpp b/bookmarkdialog.cpp new file mode 100644 index 0000000..447a3cf --- /dev/null +++ b/bookmarkdialog.cpp @@ -0,0 +1,214 @@ +#include "common.h" +#include "bookmarkdialog.h" +#include "ui_bookmarkdialog.h" + +#include +#include +#include +#include +#include +//#include + +BookmarkDialog::BookmarkDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::BookmarkDialog), + m_isReadOnly(false) +{ + ui->setupUi(this); + resize(parent->width() * 0.8, height()); + + ui->tableWidget->setColumnCount(2); +} + +BookmarkDialog::~BookmarkDialog() +{ + delete ui; +} + +void BookmarkDialog::setEditMode(bool edit) +{ + ui->buttonAdd->setVisible(edit); + ui->buttonDelete->setVisible(edit); + ui->buttonDown->setVisible(edit); + ui->buttonUp->setVisible(edit); + + m_isReadOnly = !edit; + if (m_isReadOnly) { + setWindowTitle(tr("ブックマークを開く")); + } + + QSettings settings; + for (int i = 0; ; i++) { + QString name = settings.value(IniKey_BookmarkEntryName(i), "").toString(); + if (name.isEmpty()) { + break; + } + + QString path = settings.value(IniKey_BookmarkEntryPath(i)).toString(); + insertData(i, name, path); + } + ui->tableWidget->resizeColumnsToContents(); + ui->tableWidget->resizeRowsToContents(); +} + +int BookmarkDialog::selectedIndex() const +{ + return ui->tableWidget->currentRow(); +} + +void BookmarkDialog::insertData(int row, const QString &name, const QString &path) +{ + ui->tableWidget->insertRow(row); + + QTableWidgetItem *iName = new QTableWidgetItem(name); + if (m_isReadOnly) { + iName->setFlags(iName->flags() ^ Qt::ItemIsEditable); + } + ui->tableWidget->setItem(row, 0, iName); + + QTableWidgetItem *iPath = new QTableWidgetItem(path); + iPath->setFlags(iPath->flags() ^ Qt::ItemIsEditable); + ui->tableWidget->setItem(row, 1, iPath); +} + +void BookmarkDialog::moveSelectedRows(bool up) +{ + qDebug() << "BookmarkDialog::moveSelectedRows();" << up; + + QList selected = ui->tableWidget->selectedItems(); + if (selected.isEmpty()) { + qDebug() << "Not selected."; + return; + } + + QVector before; + QVector after; + + for (int i = 0; i < ui->tableWidget->rowCount(); i++) { + QString name = ui->tableWidget->item(i, 0)->data(Qt::DisplayRole).toString(); + QString path = ui->tableWidget->item(i, 1)->data(Qt::DisplayRole).toString(); + before << name + "¥t" + path; + } + qDebug() << "set before" << before; + + after.resize(before.size()); + + QVector newRows; + foreach (QTableWidgetItem *item, selected) { + if (item->column() != 0) { + int newRow = (up) ? item->row() - 1 : item->row() + 1; + if (newRow < 0) { + return; + } + else if (newRow >= ui->tableWidget->rowCount()) { + return; + } + + after[newRow] = before[item->row()]; + before[item->row()] = QString::null; + newRows << newRow; + } + } + + qDebug() << "set after(1)" << after; + int n = 0; + for (int i = 0; i < ui->tableWidget->rowCount(); i++) { + if (!before[i].isEmpty()) { + while (!after[n].isEmpty()) { + n++; + } + after[n] = before[i]; + } + } + qDebug() << "set after(2)" << after; + + while (ui->tableWidget->rowCount() > 0) { + ui->tableWidget->removeRow(0); + } + + n = 0; + foreach (const QString &val, after) { + QStringList list = val.split("¥t"); + insertData(n, list[0], list[1]); + n++; + } + + ui->tableWidget->resizeColumnsToContents(); + ui->tableWidget->resizeRowsToContents(); + + foreach (int i, newRows) { + for (n = 0; n < 2; n++) { + QModelIndex index = ui->tableWidget->model()->index(i, n); + ui->tableWidget->selectionModel()->select(index, QItemSelectionModel::Select); + } + } + +} + +void BookmarkDialog::accept() +{ + QSettings settings; + QModelIndex index; + int i; + for (i = 0; i < ui->tableWidget->rowCount(); i++) { + index = ui->tableWidget->model()->index(i, 0); + QString name = ui->tableWidget->model()->data(index).toString(); + if (name.isEmpty()) { + ui->tableWidget->setCurrentCell(i, 0); + QMessageBox::critical(this, tr("エラー"), tr("名前が未入力です。")); + return; + } + + index = ui->tableWidget->model()->index(i, 1); + QString path = ui->tableWidget->model()->data(index).toString(); + + settings.setValue(IniKey_BookmarkEntryName(i), name); + settings.setValue(IniKey_BookmarkEntryPath(i), path); + } + while (!settings.value(IniKey_BookmarkEntryName(i), "").toString().isEmpty()) { + settings.remove(IniKey_BookmarkEntryName(i)); + settings.remove(IniKey_BookmarkEntryPath(i)); + i++; + } + + QDialog::accept(); +} + +void BookmarkDialog::on_buttonDelete_clicked() +{ + foreach (const QTableWidgetItem *item, ui->tableWidget->selectedItems()) { + if (item->column() == 0) { + ui->tableWidget->removeRow(item->row()); + } + } +} + +void BookmarkDialog::on_buttonUp_clicked() +{ + moveSelectedRows(true); +} + +void BookmarkDialog::on_buttonDown_clicked() +{ + moveSelectedRows(false); +} + +void BookmarkDialog::on_buttonAdd_clicked() +{ + static QString initPath = QDir::homePath(); + + QString path = QFileDialog::getExistingDirectory( + this, tr("フォルダを選択"), initPath); + if (!path.isEmpty()) { + QFileInfo info(path); + QString name(info.fileName()); + if (name.isEmpty()) { + name = "root"; + } + insertData(ui->tableWidget->rowCount(), name, path); + initPath = path; + + ui->tableWidget->resizeColumnsToContents(); + ui->tableWidget->resizeRowsToContents(); + } +} diff --git a/bookmarkdialog.h b/bookmarkdialog.h new file mode 100644 index 0000000..de2bdb2 --- /dev/null +++ b/bookmarkdialog.h @@ -0,0 +1,39 @@ +#ifndef BOOKMARKDIALOG_H +#define BOOKMARKDIALOG_H + +#include + +namespace Ui { +class BookmarkDialog; +} + +class BookmarkDialog : public QDialog +{ + Q_OBJECT + +public: + explicit BookmarkDialog(QWidget *parent = 0); + ~BookmarkDialog(); + + void setEditMode(bool edit); + int selectedIndex() const; + +private: + Ui::BookmarkDialog *ui; + bool m_isReadOnly; + + void insertData(int row, const QString &name, const QString &path); + void moveSelectedRows(bool up); + + // QDialog interface +public slots: + void accept(); + +private slots: + void on_buttonDelete_clicked(); + void on_buttonUp_clicked(); + void on_buttonDown_clicked(); + void on_buttonAdd_clicked(); +}; + +#endif // BOOKMARKDIALOG_H diff --git a/bookmarkdialog.ui b/bookmarkdialog.ui new file mode 100644 index 0000000..24f5556 --- /dev/null +++ b/bookmarkdialog.ui @@ -0,0 +1,173 @@ + + + BookmarkDialog + + + + 0 + 0 + 360 + 267 + + + + ブックマークを編集 + + + + + + + + false + + + QAbstractItemView::ExtendedSelection + + + QAbstractItemView::SelectRows + + + Qt::ElideMiddle + + + false + + + false + + + + 表示名 + + + + + パス + + + + + + + + + + Qt::StrongFocus + + + ↑ + + + + + + + Qt::StrongFocus + + + ↓ + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 40 + + + + + + + + 追加 + + + + + + + Qt::StrongFocus + + + 削除 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Qt::StrongFocus + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + BookmarkDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + BookmarkDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/common.h b/common.h index 9829d8f..282d098 100644 --- a/common.h +++ b/common.h @@ -6,8 +6,6 @@ typedef QMap StringMap; class QObject; class QKeyEvent; -//class MainWindow; -//extern MainWindow* getMainWnd(); extern QString FilesizeToString(quint64 size); extern QString ViewerIgnoreExt(); extern QString KeyEventToSequence(const QKeyEvent *event); @@ -23,6 +21,8 @@ extern void Sleep(int msec); #define IniKey_MoveAfterCreateFolder "Common/MoveAfterFolderCreation" #define IniKey_OpenAfterCreateFile "Common/OpenAfterFileCreation" #define IniKey_CheckUpdates "Common/CheckUpdates" +#define IniKey_BookmarkEntryName(x) QString("Bookmark/Name%1").arg(x) +#define IniKey_BookmarkEntryPath(x) QString("Bookmark/Path%1").arg(x) #define IniKey_BootSizeSpec "BootAndExit/SizeSpec" #define IniKey_BootSizeRel "BootAndExit/SizeRel" #define IniKey_BootSizeAbs "BootAndExit/SizeAbs" diff --git a/folderpanel.cpp b/folderpanel.cpp index 18841de..becb113 100644 --- a/folderpanel.cpp +++ b/folderpanel.cpp @@ -6,10 +6,13 @@ #include "ui_folderpanel.h" #include +#include +#include FolderPanel::FolderPanel(QWidget *parent) : QWidget(parent), - ui(new Ui::FolderPanel) + ui(new Ui::FolderPanel), + m_mainWnd(NULL) { ui->setupUi(this); } @@ -22,20 +25,19 @@ FolderPanel::~FolderPanel() void FolderPanel::initialize(MainWindow *mainWnd) { qDebug() << "FolderPanel::initialize();"; + m_mainWnd = mainWnd; // シグナル&スロット - connect(ui->folderView, SIGNAL(dataChanged()), this, SLOT(dataChange())); + connect(ui->searchBox, SIGNAL(textEdited(QString)), this, SLOT(searchItem(QString))); connect(ui->folderView, SIGNAL(doubleClicked(QModelIndex)), mainWnd, SLOT(open(QModelIndex))); connect(ui->folderView, SIGNAL(dropAccepted(QFileInfoList)), mainWnd, SLOT(dropAccept(QFileInfoList))); connect(ui->folderView, SIGNAL(currentChanged(QFileInfo)), mainWnd, SLOT(currentChange(QFileInfo))); - connect(ui->folderView, SIGNAL(itemFound()), mainWnd, SLOT(itemFound())); - connect(ui->folderView, SIGNAL(itemNotFound()), mainWnd, SLOT(itemNotFound())); - connect(ui->folderView, SIGNAL(retrieveFinished()), mainWnd, SLOT(retrieveFinish())); connect(ui->folderView, SIGNAL(requestContextMenu(QContextMenuEvent*)), mainWnd, SLOT(showContextMenu(QContextMenuEvent*))); - connect(ui->folderView, SIGNAL(retrieveStarted(QString)), mainWnd, SLOT(retrieveStart(QString))); connect(ui->folderView, SIGNAL(retrieveStarted(QString)), ui->locationBox, SLOT(setText(QString))); - connect(ui->searchBox, SIGNAL(textEdited(QString)), mainWnd, SLOT(searchItem(QString))); - connect(ui->searchBox, SIGNAL(returnPressed()), mainWnd, SLOT(returnPressInSearchBox())); + connect(ui->folderView, SIGNAL(dataChanged()), this, SLOT(dataChange())); + connect(ui->folderView, SIGNAL(itemFound()), this, SLOT(itemFound())); + connect(ui->folderView, SIGNAL(itemNotFound()), this, SLOT(itemNotFound())); + connect(ui->bookmarkBtn, SIGNAL(clicked()), this, SLOT(addBookmark())); // 初期状態では検索ボックスは非表示 ui->searchBox->setVisible(false); @@ -44,7 +46,7 @@ void FolderPanel::initialize(MainWindow *mainWnd) ui->locationBox->initialize(); // フォルダビューを初期化する - ui->folderView->initialize(); + ui->folderView->initialize(mainWnd); } LocationBox *FolderPanel::locationBox() const @@ -123,6 +125,59 @@ void FolderPanel::dataChange() } } +void FolderPanel::addBookmark() +{ + qDebug() << "FolderPanel::addBookmark();"; + + QSettings settings; + int i = 0; + while (!settings.value(IniKey_BookmarkEntryName(i), "").toString().isEmpty()) { + i++; + } + + QFileInfo info(ui->folderView->dir()); + QString name = info.fileName(); + if (name.isEmpty()) { + name = "root"; + } + settings.setValue(IniKey_BookmarkEntryName(i), name); + settings.setValue(IniKey_BookmarkEntryPath(i), info.absoluteFilePath()); + + m_mainWnd->statusBar()->showMessage(tr("%1をブックマークに追加しました").arg(name)); +} + +void FolderPanel::itemFound() +{ + qDebug() << "FolderPanel::itemFound"; + + QPalette pal = ui->searchBox->palette(); + pal.setColor(QPalette::Text, QPalette().text().color()); + ui->searchBox->setPalette(pal); +} + +void FolderPanel::itemNotFound() +{ + qDebug() << "FolderPanel::itemNotFound"; + + QPalette pal = ui->searchBox->palette(); + pal.setColor(QPalette::Text, Qt::red); + ui->searchBox->setPalette(pal); +} + +void FolderPanel::searchItem(const QString &text) +{ + qDebug() << "FolderPanel::searchItem" << text; + + if (text.right(1) == "/") { + // '/'が入力されたら、検索終了 + ui->searchBox->setText(text.left(text.length() - 1)); + ui->folderView->setFocus(); + } + else { + ui->folderView->searchItem(ui->searchBox->text()); + } +} + void FolderPanel::focusInEvent(QFocusEvent *) { qDebug() << "FolderPanel::focusInEvent();"; diff --git a/folderpanel.h b/folderpanel.h index d094b3d..cddd1fe 100644 --- a/folderpanel.h +++ b/folderpanel.h @@ -33,11 +33,16 @@ public: private: Ui::FolderPanel *ui; + MainWindow *m_mainWnd; void showNameFilters(); public slots: void dataChange(); + void addBookmark(); + void itemFound(); + void itemNotFound(); + void searchItem(const QString& text); // QWidget interface protected: diff --git a/folderpanel.ui b/folderpanel.ui index a3df706..5009f1a 100644 --- a/folderpanel.ui +++ b/folderpanel.ui @@ -30,11 +30,32 @@ 0 - - - Qt::ClickFocus + + + 0 - + + + + Qt::ClickFocus + + + + + + + Qt::ClickFocus + + + ... + + + + :/images/Favourites.png:/images/Favourites.png + + + + @@ -112,6 +133,8 @@
locationbox.h
- + + + diff --git a/folderview.cpp b/folderview.cpp index 105331d..394c2ec 100644 --- a/folderview.cpp +++ b/folderview.cpp @@ -10,6 +10,7 @@ #include #include #include +#include QString FilesizeToString(quint64 size) { @@ -27,6 +28,7 @@ QString FilesizeToString(quint64 size) FolderView::FolderView(QWidget *parent) : QTableView(parent), + m_mainWnd(NULL), m_model(), m_dragStartPos(), m_dragging(false) @@ -52,10 +54,12 @@ QString FolderView::side() const } } -void FolderView::initialize() +void FolderView::initialize(MainWindow *mainWnd) { qDebug() << side() << "initialize"; + m_mainWnd = mainWnd; + setColumnWidth(0, 30); // ソート順を初期化する @@ -306,6 +310,7 @@ void FolderView::setPath(const QString &path, bool addHistory) Q_ASSERT(QFileInfo(path).isDir()); + m_mainWnd->statusBar()->showMessage(tr("ファイルリストを取得しています...")); emit retrieveStarted(path); setUpdatesEnabled(false); @@ -317,7 +322,7 @@ void FolderView::setPath(const QString &path, bool addHistory) m_history.add(path); } - emit retrieveFinished(); + m_mainWnd->statusBar()->showMessage(tr("レディ")); } void FolderView::setFilter(QDir::Filters filter, bool enable) diff --git a/folderview.h b/folderview.h index 5775739..cc22009 100644 --- a/folderview.h +++ b/folderview.h @@ -5,6 +5,7 @@ #include "history.h" #include +class MainWindow; class FolderView : public QTableView { @@ -15,7 +16,7 @@ public: QString side() const; // actions - void initialize(); + void initialize(MainWindow *mainWnd); void updateAppearance(); void refresh(); @@ -31,7 +32,6 @@ public: bool historyBack(); bool historyForward(); - // getter QFileInfo currentItem() const; QString dir() const { return m_model.absolutePath(); } @@ -48,6 +48,7 @@ public: void setSorting(); private: + MainWindow *m_mainWnd; FileTableModel m_model; History m_history; QPoint m_dragStartPos; @@ -60,7 +61,6 @@ signals: void itemFound(); void itemNotFound(); void retrieveStarted(const QString &path); - void retrieveFinished(); void requestContextMenu(QContextMenuEvent *event); // void keyPressed(QKeyEvent *event); diff --git a/installer-full.nsi b/installer-full.nsi index c4ba791..49de10f 100644 --- a/installer-full.nsi +++ b/installer-full.nsi @@ -2,7 +2,7 @@ ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "Gefu" -!define PRODUCT_VERSION "0.16" +!define PRODUCT_VERSION "0.17" !define PRODUCT_PUBLISHER "@miyabi_satoh" !define PRODUCT_WEB_SITE "http://gefu.sourceforge.jp/" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Gefu.exe" @@ -51,7 +51,7 @@ var ICONS_GROUP ; MUI end ------ Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -OutFile "Gefu016_full_setup.exe" +OutFile "Gefu017_full_setup.exe" InstallDir "$PROGRAMFILES\Gefu" InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails show diff --git a/installer.nsi b/installer.nsi index ac94a2d..e6aa11f 100644 --- a/installer.nsi +++ b/installer.nsi @@ -2,7 +2,7 @@ ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "Gefu" -!define PRODUCT_VERSION "0.16" +!define PRODUCT_VERSION "0.17" !define PRODUCT_PUBLISHER "@miyabi_satoh" !define PRODUCT_WEB_SITE "http://gefu.sourceforge.jp/" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Gefu.exe" @@ -51,7 +51,7 @@ var ICONS_GROUP ; MUI end ------ Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -OutFile "Gefu016_Setup.exe" +OutFile "Gefu017_Setup.exe" InstallDir "$PROGRAMFILES\Gefu" InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails show diff --git a/keybind.txt b/keybind.txt index 07a0744..07aa33d 100644 --- a/keybind.txt +++ b/keybind.txt @@ -2,6 +2,7 @@ = フォルダビュー ||キー ||装飾なし ||Shift ||Alt ||Ctrl(Command) ||覚え方 || ||A ||すべてのファイルをマーク ||すべてマーク || || ||All || +||B ||ブックマークを表示 ||ブックマークを編集 || || ||Bookmark || ||C ||ファイル名をクリップボードにコピー ||フルパスをクリップボードにコピー || ||隣のペインにアイテムをコピー ||Copy || ||D || || || ||選択アイテムを削除 ||Delete || ||E ||外部エディタで開く || || ||ファイルを作成 ||Edit, newの「E」 || @@ -33,10 +34,10 @@ ||/ ||ファイル検索開始/終了 || || || || || ||+ ||フォントサイズを大きく || || || || || ||- ||フォントサイズを小さく || || || || || -||↑ ||カーソルを上に移動 ||隣ペインのカーソルを上に移動 ||隣ペインのカーソルを先頭に移動 || -||↓ ||カーソルを下に移動 ||隣ペインのカーソルを下に移動 ||隣ペインのカーソルを末尾に移動 || -||← ||親フォルダに移動/隣のペインに移動 || -||→ ||親フォルダに移動/隣のペインに移動 || +||↑ ||カーソルを上に移動 ||隣ペインのカーソルを上に移動 ||隣ペインのカーソルを先頭に移動 || || || +||↓ ||カーソルを下に移動 ||隣ペインのカーソルを下に移動 ||隣ペインのカーソルを末尾に移動 || || || +||← ||親フォルダに移動/隣のペインに移動 || || || || || +||→ ||親フォルダに移動/隣のペインに移動 || || || || || = テキストビュー ||キー ||装飾なし ||Shift ||Alt ||Ctrl(Command) ||覚え方 || ||C ||ファイル名をクリップボードにコピー ||フルパスをクリップボードにコピー || ||選択範囲をクリップボードにコピー ||Copy || @@ -55,7 +56,7 @@ ||BACKSPACE ||フォルダビューに戻る || || || || || ||+ ||フォントサイズを大きく || || || || || ||- ||フォントサイズを小さく || || || || || -||↑ ||カーソルを上に移動 ||隣ペインのカーソルを上に移動 ||隣ペインのカーソルを先頭に移動 || -||↓ ||カーソルを下に移動 ||隣ペインのカーソルを下に移動 ||隣ペインのカーソルを末尾に移動 || -||← ||PageUp || -||→ ||PageDown || +||↑ ||カーソルを上に移動 ||隣ペインのカーソルを上に移動 ||隣ペインのカーソルを先頭に移動 || || || +||↓ ||カーソルを下に移動 ||隣ペインのカーソルを下に移動 ||隣ペインのカーソルを末尾に移動 || || || +||← ||PageUp || || || || || +||→ ||PageDown || || || || || diff --git a/mainwindow.cpp b/mainwindow.cpp index 4deb1c0..6955335 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -17,6 +17,7 @@ #include "simpleimageview.h" #include "mainwindow.h" #include "ui_mainwindow.h" +#include "bookmarkdialog.h" #include #include @@ -81,6 +82,9 @@ MainWindow::MainWindow(QWidget *parent) : } QSettings settings; + // ブックマークメニューを初期化する + initBookmark(); + // メニュー項目の状態を初期化する ui->view_Hidden->setChecked(settings.value(IniKey_ShowHidden).toBool()); ui->view_System->setChecked(settings.value(IniKey_ShowSystem).toBool()); @@ -272,30 +276,6 @@ void MainWindow::historyForward() } } -void MainWindow::itemFound() -{ - qDebug() << "MainWindow::itemFound"; - - SearchBox *box = sender()->parent()->findChild("searchBox"); - Q_CHECK_PTR(box); - - QPalette pal = box->palette(); - pal.setColor(QPalette::Text, QPalette().text().color()); - box->setPalette(pal); -} - -void MainWindow::itemNotFound() -{ - qDebug() << "MainWindow::itemNotFound"; - - SearchBox *box = sender()->parent()->findChild("searchBox"); - Q_CHECK_PTR(box); - - QPalette pal = box->palette(); - pal.setColor(QPalette::Text, Qt::red); - box->setPalette(pal); -} - void MainWindow::markAll() { qDebug() << "MainWindow::markAll();"; @@ -430,26 +410,12 @@ void MainWindow::rightKeyPress() } } -void MainWindow::returnPressInSearchBox() -{ - qDebug() << "MainWindow::returnPressInSearchBox"; - - if (QApplication::keyboardModifiers() & Qt::ShiftModifier) { - emit ui->action_SearchPrev->triggered(); - } - else { - emit ui->action_SearchNext->triggered(); - } -} - void MainWindow::showFileInfo(const QString &str) { qDebug() << "MainWindow::showFileInfo();" << str; QLabel *label = ui->statusBar->findChild("Right"); Q_CHECK_PTR(label); -// label->resize(QFontMetrics(label->font()).boundingRect(str).width(), -// label->height()); label->setText(str); } @@ -742,8 +708,6 @@ void MainWindow::open(const QModelIndex &index) ui->splitter->setVisible(false); setViewMode(ModeFullView); - // focusChangeでupdateActionsされるので不要 -// updateActions(); } else { ui->pane3->setVisible(false); @@ -823,6 +787,21 @@ void MainWindow::openTerminal() } } +void MainWindow::openBookmark() +{ + qDebug() << "MainWindow::openBookmark();"; + + FolderView *view = static_cast(qApp->focusWidget()); + Q_CHECK_PTR(view); + + QAction *action = qobject_cast(sender()); + Q_CHECK_PTR(action); + + QSettings settings; + int i = action->data().toInt(); + view->setPath(settings.value(IniKey_BookmarkEntryPath(i)).toString(), true); +} + void MainWindow::refresh() { qDebug() << "MainWindow::refresh();"; @@ -885,30 +864,43 @@ void MainWindow::renameItems() settings.setValue(IniKey_AutoCloseRename, opDlg.autoClose()); } -void MainWindow::retrieveFinish() +void MainWindow::shellExecute() { - qDebug() << "MainWindow::retrieveFinish();"; + qDebug() << "MainWindow::shellExecute"; - ui->statusBar->showMessage(tr("レディ"), 5000); + FolderView *view = static_cast(qApp->focusWidget()); + Q_CHECK_PTR(view); + + foreach (const QFileInfo &info, view->selectedItems()) { + QString path = QDir::toNativeSeparators(info.absoluteFilePath()); + QDesktopServices::openUrl(QUrl("file:///" + path)); + } } -void MainWindow::retrieveStart(const QString &path) +void MainWindow::showBookmarkDialog() { - qDebug() << "MainWindow::retrieveStart();" << path; + FolderView *view = static_cast(qApp->focusWidget()); + Q_CHECK_PTR(view); - ui->statusBar->showMessage(tr("ファイルリストを取得しています...")); + BookmarkDialog dlg(this); + dlg.setEditMode(false); + if (dlg.exec() == QDialog::Accepted) { + int n = dlg.selectedIndex(); + + QSettings settings; + view->setPath(settings.value(IniKey_BookmarkEntryPath(n)).toString(), true); + } } -void MainWindow::shellExecute() +void MainWindow::editBookmark() { - qDebug() << "MainWindow::shellExecute"; + qDebug() << "MainWindow::showBookmarkDialog();"; - FolderView *view = static_cast(qApp->focusWidget()); - Q_CHECK_PTR(view); + BookmarkDialog dlg(this); + dlg.setEditMode(true); - foreach (const QFileInfo &info, view->selectedItems()) { - QString path = QDir::toNativeSeparators(info.absoluteFilePath()); - QDesktopServices::openUrl(QUrl("file:///" + path)); + if (dlg.exec() == QDialog::Accepted) { + initBookmark(); } } @@ -1025,25 +1017,25 @@ void MainWindow::switchHalfMode(bool checked) updateActions(); } -void MainWindow::searchItem(const QString &text) -{ - qDebug() << "MainWindow::searchItem" << text; +//void MainWindow::searchItem(const QString &text) +//{ +// qDebug() << "MainWindow::searchItem" << text; - SearchBox *box = qobject_cast(qApp->focusWidget()); - Q_CHECK_PTR(box); +// SearchBox *box = qobject_cast(qApp->focusWidget()); +// Q_CHECK_PTR(box); - if (text.right(1) == "/") { - // '/'が入力されたら、検索終了 - box->setText(text.left(text.length() - 1)); - ui->action_Search->setChecked(false); - } - else { - FolderPanel *fp = qobject_cast(box->parent()); - Q_CHECK_PTR(fp); +// if (text.right(1) == "/") { +// // '/'が入力されたら、検索終了 +// box->setText(text.left(text.length() - 1)); +// ui->action_Search->setChecked(false); +// } +// else { +// FolderPanel *fp = qobject_cast(box->parent()); +// Q_CHECK_PTR(fp); - fp->folderView()->searchItem(box->text()); - } -} +// fp->folderView()->searchItem(box->text()); +// } +//} void MainWindow::searchNext() { @@ -1149,6 +1141,27 @@ void MainWindow::changeFontSize(int diff) } } +void MainWindow::initBookmark() +{ + QSettings settings; + QFileIconProvider iconProvider; + + ui->menu_Bookmark->clear(); + ui->menu_Bookmark->addAction(ui->bookmark_Edit); + ui->menu_Bookmark->addSeparator(); + int i = 0; + while (!settings.value(IniKey_BookmarkEntryName(i), "").toString().isEmpty()) { + QString path = settings.value(IniKey_BookmarkEntryPath(i)).toString(); + QAction *action = new QAction(this); + action->setText(settings.value(IniKey_BookmarkEntryName(i)).toString()); + action->setData(i); + action->setIcon(iconProvider.icon(QFileInfo(path))); + ui->menu_Bookmark->addAction(action); + connect(action, SIGNAL(triggered()), this, SLOT(openBookmark())); + i++; + } +} + void MainWindow::setPathFromOther() { qDebug() << "MainWindow::setPathFromOther();"; @@ -1301,8 +1314,15 @@ void MainWindow::showContextMenu(QContextMenuEvent *event) menu.addAction(ui->action_OpenEditor); menu.addAction(ui->action_OpenTerminal); menu.addSeparator(); + menu.addAction(ui->cmd_Copy); + menu.addAction(ui->cmd_Move); + menu.addSeparator(); + menu.addAction(ui->cmd_Delete); + menu.addSeparator(); menu.addAction(ui->copy_Filename); menu.addAction(ui->copy_Fullpath); + menu.addSeparator(); + menu.addAction(ui->cmd_Rename); } else { menu.addAction(ui->move_Back); @@ -1312,6 +1332,9 @@ void MainWindow::showContextMenu(QContextMenuEvent *event) menu.addAction(ui->move_Home); menu.addAction(ui->move_Root); menu.addAction(ui->move_Jump); + menu.addSeparator(); + menu.addAction(ui->cmd_NewFile); + menu.addAction(ui->cmd_NewFolder); } menu.exec(event->globalPos()); @@ -1437,6 +1460,8 @@ void MainWindow::initActionConnections() connect(ui->view_Swap, SIGNAL(triggered()), this, SLOT(swapView())); connect(ui->view_System, SIGNAL(toggled(bool)), this, SLOT(toggleShowSystemFiles(bool))); connect(ui->view_ToOther, SIGNAL(triggered()), this, SLOT(setPathToOther())); + connect(ui->bookmark_Edit, SIGNAL(triggered()), this, SLOT(editBookmark())); + connect(ui->bookmark_Show, SIGNAL(triggered()), this, SLOT(showBookmarkDialog())); } void MainWindow::replaceVars(QString &str, const QFileInfo info) diff --git a/mainwindow.h b/mainwindow.h index 28a4ae1..a620d39 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -39,7 +39,6 @@ public slots: void focusChange(QWidget * old, QWidget * now); void leftKeyPress(); void rightKeyPress(); - void returnPressInSearchBox(); void showFileInfo(const QString &str); void about(); @@ -55,11 +54,10 @@ public slots: void cursorDown(); void cursorUp(); void deleteItems(); + void editBookmark(); void executeCommand(); void historyBack(); void historyForward(); - void itemFound(); - void itemNotFound(); void markAll(); void markAllFiles(); void markAllOff(); @@ -69,11 +67,9 @@ public slots: void open(const QModelIndex &index = QModelIndex()); void openEditor(const QString &path = QString()); void openTerminal(); + void openBookmark(); void refresh(); void renameItems(); - void retrieveFinish(); - void retrieveStart(const QString &path); - void searchItem(const QString& text); void searchNext(); void searchPrev(); void setCursorToBegin(); @@ -86,6 +82,7 @@ public slots: void setPathToParent(); void setPathToRoot(); void shellExecute(); + void showBookmarkDialog(); void showFilterDialog(); void showHistoryDialog(); void showPreferenceDialog(); @@ -123,6 +120,7 @@ private: void showNameFilters(FolderView *view); void copyItems(const QFileInfoList &list, const QString &tgtDir); void changeFontSize(int diff); + void initBookmark(); // getter FolderView* otherSideFolderView(const FolderView *view) const; diff --git a/mainwindow.ui b/mainwindow.ui index 4df8562..6e3d95a 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -233,10 +233,18 @@
+ + + ブックマーク + + + + + @@ -960,6 +968,25 @@ P + + + ブックマークを編集... + + + ブックマークを編集... + + + Shift+B + + + + + ブックマークを表示 + + + B + + diff --git a/version.h b/version.h index 284046e..e6f4c91 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #ifndef VERSION_H #define VERSION_H -#define VERSION_VALUE 0.16 +#define VERSION_VALUE 0.17 #endif // VERSION_H -- 2.11.0