Skip to content

Commit

Permalink
rename from "favorite" to "bookmark".(refs #78)
Browse files Browse the repository at this point in the history
  • Loading branch information
haraki committed Jun 13, 2019
1 parent 9aedebf commit fcec37e
Show file tree
Hide file tree
Showing 21 changed files with 187 additions and 187 deletions.
6 changes: 3 additions & 3 deletions doublefolderpanel.cpp
Expand Up @@ -14,7 +14,7 @@
#include "settings.h"
#include "fileoperationdialog.h"
#include "fileattributesdialog.h"
#include "selectstoragefavoritedialog.h"
#include "selectstoragebookmarkdialog.h"
#include "file.h"

namespace Farman
Expand Down Expand Up @@ -317,15 +317,15 @@ bool DoubleFolderPanel::eventFilter(QObject *watched, QEvent *e)
return ret;
}

void DoubleFolderPanel::onSelectStorageFavorite()
void DoubleFolderPanel::onSelectStorageBookmark()
{
FolderForm* activeForm = getActiveFolderForm();
if(activeForm == Q_NULLPTR)
{
return;
}

SelectStorageFavoriteDialog dialog(parentWidget());
SelectStorageBookmarkDialog dialog(parentWidget());
if(dialog.exec() != QDialog::Accepted)
{
return;
Expand Down
2 changes: 1 addition & 1 deletion doublefolderpanel.h
Expand Up @@ -36,7 +36,7 @@ class DoubleFolderPanel : public QWidget
FolderForm* getLeftFolderForm();
FolderForm* getRightFolderForm();

void onSelectStorageFavorite();
void onSelectStorageBookmark();
void onSetPaneMode(PaneMode paneMode);
void onChangeSortSettings();
void onChangeFilterSettings();
Expand Down
10 changes: 5 additions & 5 deletions farman.pro
Expand Up @@ -28,10 +28,10 @@ SOURCES += main.cpp\
folderviewstyleditemdelegate.cpp \
foldermodel.cpp \
doublefolderpanel.cpp \
selectstoragefavoritedialog.cpp \
selectstoragebookmarkdialog.cpp \
sortdialog.cpp \
filterdialog.cpp \
storagefavoriteinfomodel.cpp \
storagebookmarkinfomodel.cpp \
workingdialog.cpp \
worker.cpp \
copyworker.cpp \
Expand Down Expand Up @@ -59,8 +59,8 @@ HEADERS += mainwindow.h \
foldermodel.h \
folderview.h \
doublefolderpanel.h \
selectstoragefavoritedialog.h \
storagefavoriteinfomodel.h \
selectstoragebookmarkdialog.h \
storagebookmarkinfomodel.h \
types.h \
sortdialog.h \
filterdialog.h \
Expand Down Expand Up @@ -88,7 +88,7 @@ HEADERS += mainwindow.h \
FORMS += mainwindow.ui \
folderform.ui \
doublefolderpanel.ui \
selectstoragefavoritedialog.ui \
selectstoragebookmarkdialog.ui \
sortdialog.ui \
filterdialog.ui \
workingdialog.ui \
Expand Down
20 changes: 10 additions & 10 deletions folderform.cpp
Expand Up @@ -301,13 +301,13 @@ void FolderForm::onDirectoryLoaded(const QString& path)
ui->folderView->setCursor(currentRootIndex);
}

if(Settings::getInstance()->searchFavoriteDirPath(path) >= 0)
if(Settings::getInstance()->searchBookmarkDirPath(path) >= 0)
{
ui->favoriteToolButton->setChecked(true);
ui->bookmarkToolButton->setChecked(true);
}
else
{
ui->favoriteToolButton->setChecked(false);
ui->bookmarkToolButton->setChecked(false);
}
}

Expand Down Expand Up @@ -395,24 +395,24 @@ int FolderForm::onSelectDir()
return setPath(dirPath);
}

int FolderForm::onFavoriteDir(bool marked)
int FolderForm::onBookmarkDir(bool marked)
{
const QModelIndex currentDirIndex = ui->folderView->rootIndex();
const QString currentPath = m_folderModel->filePath(currentDirIndex);
int index = Settings::getInstance()->searchFavoriteDirPath(currentPath);
int index = Settings::getInstance()->searchBookmarkDirPath(currentPath);

if(marked)
{
if(index < 0)
{
Settings::getInstance()->insertFavoriteDirPath(currentPath);
Settings::getInstance()->insertBookmarkDirPath(currentPath);
}
}
else
{
if(index >= 0)
{
Settings::getInstance()->removeFavoriteDirPath(index);
Settings::getInstance()->removeBookmarkDirPath(index);
}
}

Expand Down Expand Up @@ -451,11 +451,11 @@ void FolderForm::on_selectFolderButton_clicked()
onSelectDir();
}

void FolderForm::on_favoriteToolButton_toggled(bool checked)
void FolderForm::on_bookmarkToolButton_toggled(bool checked)
{
qDebug() << "FolderForm::on_favoriteToolButton_toggled() : " << checked;
qDebug() << "FolderForm::on_bookmarkToolButton_toggled() : " << checked;

onFavoriteDir(checked);
onBookmarkDir(checked);
}

void FolderForm::emitCurrentChanged(const QFileInfo& newFileInfo, const QFileInfo& oldFileInfo)
Expand Down
4 changes: 2 additions & 2 deletions folderform.h
Expand Up @@ -67,7 +67,7 @@ class FolderForm : public QWidget
int onGoToChildDir();
int onGoToParentDir();
int onSelectDir();
int onFavoriteDir(bool marked);
int onBookmarkDir(bool marked);

void refresh(bool clearSelected = false);

Expand All @@ -83,7 +83,7 @@ protected Q_SLOTS:

private Q_SLOTS:
void on_selectFolderButton_clicked();
void on_favoriteToolButton_toggled(bool checked);
void on_bookmarkToolButton_toggled(bool checked);

void emitCurrentChanged(const QFileInfo& newFileInfo, const QFileInfo& oldFileInfo);
void emitFocusChanged(bool inFocus);
Expand Down
6 changes: 3 additions & 3 deletions folderform.ui
Expand Up @@ -35,14 +35,14 @@
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="favoriteToolButton">
<widget class="QToolButton" name="bookmarkToolButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/images/favorite_off.svg</normaloff>
<normalon>:/images/favorite_on.svg</normalon>:/images/favorite_off.svg</iconset>
<normaloff>:/images/bookmark_off.svg</normaloff>
<normalon>:/images/bookmark_on.svg</normalon>:/images/bookmark_off.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
Expand Down
File renamed without changes
File renamed without changes
6 changes: 3 additions & 3 deletions mainwindow.cpp
Expand Up @@ -372,14 +372,14 @@ void MainWindow::on_actionSelectFolder_triggered()
activeFolderForm->onSelectDir();
}

void MainWindow::on_actionSelectStorageFavorite_triggered()
void MainWindow::on_actionSelectStorageBookmark_triggered()
{
qDebug() << "MainWindow::on_actionSelectStorageFavorite_triggered()";
qDebug() << "MainWindow::on_actionSelectStorageBookmark_triggered()";

DoubleFolderPanel* doubleFolderPanel = ui->mainWidget->findChild<DoubleFolderPanel*>("DoubleFolderPanel");
if(doubleFolderPanel != Q_NULLPTR)
{
doubleFolderPanel->onSelectStorageFavorite();
doubleFolderPanel->onSelectStorageBookmark();
}
}

Expand Down
2 changes: 1 addition & 1 deletion mainwindow.h
Expand Up @@ -71,7 +71,7 @@ private Q_SLOTS:
void on_actionOpenWithTextEditor_triggered();
void on_actionCreateNewFile_triggered();
void on_actionSelectFolder_triggered();
void on_actionSelectStorageFavorite_triggered();
void on_actionSelectStorageBookmark_triggered();
void on_actionQuit_triggered();
void on_actionSinglePane_triggered();
void on_actionDualPane_triggered();
Expand Down
10 changes: 5 additions & 5 deletions mainwindow.ui
Expand Up @@ -102,7 +102,7 @@
<addaction name="actionCreateNewFile"/>
<addaction name="separator"/>
<addaction name="actionSelectFolder"/>
<addaction name="actionSelectStorageFavorite"/>
<addaction name="actionSelectStorageBookmark"/>
<addaction name="separator"/>
<addaction name="actionQuit"/>
</widget>
Expand Down Expand Up @@ -369,15 +369,15 @@
<string>N</string>
</property>
</action>
<action name="actionSelectStorageFavorite">
<action name="actionSelectStorageBookmark">
<property name="text">
<string>Select Storage / Favorite folder...</string>
<string>Select Storage / Bookmark folder...</string>
</property>
<property name="iconText">
<string>Select Storage / Favorite folder</string>
<string>Select Storage / Bookmark folder</string>
</property>
<property name="toolTip">
<string>Select Storage / Favorite folder</string>
<string>Select Storage / Bookmark folder</string>
</property>
<property name="shortcut">
<string>L</string>
Expand Down
4 changes: 2 additions & 2 deletions resources.qrc
@@ -1,6 +1,6 @@
<RCC>
<qresource prefix="/">
<file>images/favorite_off.svg</file>
<file>images/favorite_on.svg</file>
<file>images/bookmark_off.svg</file>
<file>images/bookmark_on.svg</file>
</qresource>
</RCC>
36 changes: 36 additions & 0 deletions selectstoragebookmarkdialog.cpp
@@ -0,0 +1,36 @@
#include <QStorageInfo>
#include "selectstoragebookmarkdialog.h"
#include "ui_selectstoragebookmarkdialog.h"

namespace Farman
{

SelectStorageBookmarkDialog::SelectStorageBookmarkDialog(QWidget *parent/* = Q_NULLPTR*/) :
QDialog(parent),
ui(new Ui::SelectStorageBookmarkDialog)
{
ui->setupUi(this);

m_sfInfoModel = new StorageBookmarkInfoModel();

ui->storagesBookmarksTableView->setModel(m_sfInfoModel);
ui->storagesBookmarksTableView->setCurrentIndex(m_sfInfoModel->index(0));

ui->storagesBookmarksTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
}

SelectStorageBookmarkDialog::~SelectStorageBookmarkDialog()
{
delete m_sfInfoModel;

delete ui;
}

void SelectStorageBookmarkDialog::accept()
{
m_selectedPath = m_sfInfoModel->data(ui->storagesBookmarksTableView->currentIndex(), StorageBookmarkInfoModel::PathRole).toString();

QDialog::accept();
}

} // namespace Farman
38 changes: 38 additions & 0 deletions selectstoragebookmarkdialog.h
@@ -0,0 +1,38 @@
#ifndef SELECTSTORAGEBOOKMARKDIALOG_H
#define SELECTSTORAGEBOOKMARKDIALOG_H

#include <QDialog>
#include "storagebookmarkinfomodel.h"

namespace Ui {
class SelectStorageBookmarkDialog;
}

namespace Farman
{

class SelectStorageBookmarkDialog : public QDialog
{
Q_OBJECT

public:
explicit SelectStorageBookmarkDialog(QWidget *parent = Q_NULLPTR);
~SelectStorageBookmarkDialog();

const QString& getSelectedPath() { return m_selectedPath; }

void accept();

private:
void initialize();

Ui::SelectStorageBookmarkDialog *ui;

StorageBookmarkInfoModel *m_sfInfoModel;

QString m_selectedPath;
};

} // namespace Farman

#endif // SELECTSTORAGEBOOKMARKDIALOG_H
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SelectStorageFavoriteDialog</class>
<widget class="QDialog" name="SelectStorageFavoriteDialog">
<class>SelectStorageBookmarkDialog</class>
<widget class="QDialog" name="SelectStorageBookmarkDialog">
<property name="geometry">
<rect>
<x>0</x>
Expand All @@ -11,11 +11,11 @@
</rect>
</property>
<property name="windowTitle">
<string>Select Storage / Favorite folder</string>
<string>Select Storage / Bookmark folder</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableView" name="storagesFavoritesTableView">
<widget class="QTableView" name="storagesBookmarksTableView">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
Expand Down Expand Up @@ -56,7 +56,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SelectStorageFavoriteDialog</receiver>
<receiver>SelectStorageBookmarkDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
Expand All @@ -72,7 +72,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SelectStorageFavoriteDialog</receiver>
<receiver>SelectStorageBookmarkDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
Expand Down
36 changes: 0 additions & 36 deletions selectstoragefavoritedialog.cpp

This file was deleted.

0 comments on commit fcec37e

Please sign in to comment.