Skip to content
Permalink
Browse files

rename from "favorite" to "bookmark".(refs #78)

  • Loading branch information...
haraki committed Jun 13, 2019
1 parent 3afe58e commit 65b9948d9cd5f2e90bb00faebf889d8a3b0adc5d
@@ -14,7 +14,7 @@
#include "settings.h"
#include "fileoperationdialog.h"
#include "fileattributesdialog.h"
#include "selectstoragefavoritedialog.h"
#include "selectstoragebookmarkdialog.h"
#include "file.h"

namespace Farman
@@ -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;
@@ -36,7 +36,7 @@ class DoubleFolderPanel : public QWidget
FolderForm* getLeftFolderForm();
FolderForm* getRightFolderForm();

void onSelectStorageFavorite();
void onSelectStorageBookmark();
void onSetPaneMode(PaneMode paneMode);
void onChangeSortSettings();
void onChangeFilterSettings();
@@ -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 \
@@ -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 \
@@ -88,7 +88,7 @@ HEADERS += mainwindow.h \
FORMS += mainwindow.ui \
folderform.ui \
doublefolderpanel.ui \
selectstoragefavoritedialog.ui \
selectstoragebookmarkdialog.ui \
sortdialog.ui \
filterdialog.ui \
workingdialog.ui \
@@ -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);
}
}

@@ -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);
}
}

@@ -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)
@@ -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);

@@ -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);
@@ -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>
File renamed without changes.
File renamed without changes.
@@ -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();
}
}

@@ -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();
@@ -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>
@@ -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>
@@ -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>
@@ -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
@@ -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>
@@ -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>
@@ -56,7 +56,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SelectStorageFavoriteDialog</receiver>
<receiver>SelectStorageBookmarkDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@@ -72,7 +72,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SelectStorageFavoriteDialog</receiver>
<receiver>SelectStorageBookmarkDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

This file was deleted.

0 comments on commit 65b9948

Please sign in to comment.
You can’t perform that action at this time.