historydialog.cpp \
preferencedialog.cpp \
clickablelabel.cpp \
- colorsamplemodel.cpp
+ colorsamplemodel.cpp \
+ simpletextview.cpp
HEADERS += mainwindow.h \
folderpanel.h \
historydialog.h \
preferencedialog.h \
clickablelabel.h \
- colorsamplemodel.h
+ colorsamplemodel.h \
+ simpletextview.h
FORMS += mainwindow.ui \
folderpanel.ui \
Gefu is an Experimental File Utility.
### TODO
-- コンテキストメニュー
+- コンテキストメニュー ← 必要?
- オプション
- ファンクションキー
- キーバインドカスタマイズ
- 簡易FTPクライアント
- SNS連携(タイムライン表示とか) ← ファイラーの機能か?
+#### 2014/08/23 Ver0.09
+- 左右矢印キーに機能割り当て
+ - 左ペインで左矢印/右ペインで右矢印 → 親フォルダに移動
+ - 左ペインで右矢印/右ペインで左矢印 → 反対側のペインにフォーカス
+- ファイル名をクリップボードにコピーを実装。
+- フォルダ名をクリップボードにコピーを実装。
+- 不具合修正
+ - Windows版で初回起動時、タイトルバーが画面外に出ていた。→ デフォルト位置・サイズ変更。
+
#### 2014/08/23 Ver0.08 公開
- 「ターミナルで開く」を実装。
- Shift+ダブルクリックで、ファイルを外部エディタで開くようにした。
stateChanged();\r
}\r
\r
-\r
+#if 0\r
bool FileTableModel::isDir(const QModelIndex &index) const\r
{\r
+ if (!index.isValid()) {\r
+ qDebug() << "isDir() : index is invalid.";\r
+ return QString();\r
+ }\r
return m_fileInfoList[index.row()].isDir();\r
}\r
\r
const QString FileTableModel::absoluteFilePath(const QModelIndex &index) const\r
{\r
if (!index.isValid()) {\r
- qDebug() << "index is invalid.";\r
+ qDebug() << "absoluteFilePath() : index is invalid.";\r
return QString();\r
}\r
- return m_dir.absoluteFilePath(m_fileInfoList[index.row()].fileName());\r
+// return m_dir.absoluteFilePath(m_fileInfoList[index.row()].fileName());\r
+ return m_fileInfoList[index.row()].absoluteFilePath();\r
}\r
\r
+const QString FileTableModel::fileName(const QModelIndex &index) const\r
+{\r
+ if (!index.isValid()) {\r
+ qDebug() << "fileName() : index is invalid.";\r
+ return QString();\r
+ }\r
+ return m_fileInfoList[index.row()].fileName();\r
+}\r
+#endif\r
+\r
QFileInfo FileTableModel::fileInfo(const QModelIndex &index) const\r
{\r
+ if (!index.isValid()) {\r
+ qDebug() << "fileInfo() : index is invalid.";\r
+ return QFileInfo();\r
+ }\r
return m_fileInfoList[index.row()];\r
}\r
\r
Qt::CheckState checkState(const QModelIndex &index) const;\r
void setCheckState(const QModelIndex &index, Qt::CheckState state);\r
void setCheckStateAll(Qt::CheckState state);\r
-\r
- bool isDir(const QModelIndex &index) const;\r
const QString absolutePath() const { return m_dir.absolutePath(); }\r
+#if 0\r
+ bool isDir(const QModelIndex &index) const;\r
const QString absoluteFilePath(const QModelIndex &index) const;\r
+ const QString fileName(const QModelIndex &index) const;\r
+#endif\r
QFileInfoList checkedItems() const;\r
QFileInfo fileInfo(const QModelIndex &index) const;\r
\r
#include <QMimeData>\r
#include <QDrag>\r
#include <QApplication>\r
+#include <QClipboard>\r
+#include <QShortcut>\r
\r
#define CHECK_FOCUS { \\r
if (!hasFocus()) { return; } \\r
m_dragging(false)\r
{\r
// シグナル/スロットを設定する\r
- connect(MENU_TRRIGGERED(action_Open), this, SLOT(setPath()));\r
+ connect(MENU_TRRIGGERED(action_Open), this, SLOT(openItem()));\r
connect(MENU_TRRIGGERED(action_Exec), this, SLOT(openUrl()));\r
connect(MENU_TRRIGGERED(action_OpenEditor), this, SLOT(openEditor()));\r
connect(MENU_TRRIGGERED(action_OpenTerminal), this, SLOT(openTerminal()));\r
connect(MENU_TRRIGGERED(cmd_Rename), this, SLOT(cmdRename()));\r
connect(MENU_TRRIGGERED(cmd_NewFile), this, SLOT(newFile()));\r
connect(MENU_TRRIGGERED(cmd_NewFolder), this, SLOT(newFolder()));\r
+ connect(MENU_TRRIGGERED(copy_Filename), this, SLOT(copyFilenameToClipboard()));\r
+ connect(MENU_TRRIGGERED(copy_Fullpath), this, SLOT(copyFullpathToClipboard()));\r
\r
connect(getMainWnd(), SIGNAL(showHiddenFiles(bool)),\r
this, SLOT(showHiddenFiles(bool)));\r
connect(getMainWnd(), SIGNAL(showSystemFiles(bool)),\r
this, SLOT(showSystemFiles(bool)));\r
+ connect(this, SIGNAL(openRequested(QFileInfo)),\r
+ getMainWnd(), SLOT(openRequest(QFileInfo)));\r
\r
connect(this, SIGNAL(doubleClicked(QModelIndex)),\r
this, SLOT(onDoubleClick(QModelIndex)));\r
setDragEnabled(true);\r
setAcceptDrops(true);\r
setDropIndicatorShown(true);\r
+\r
+ // Context Menu\r
+ setContextMenuPolicy(Qt::CustomContextMenu);\r
+ connect(this, SIGNAL(customContextMenuRequested(QPoint)),\r
+ this, SLOT(contextMenuRequested(QPoint)));\r
}\r
\r
FileTableView::~FileTableView()\r
}\r
}\r
\r
-void FileTableView::setPath()\r
+void FileTableView::openItem()\r
{\r
CHECK_FOCUS;\r
\r
- setRootIndex(currentIndex());\r
+ QModelIndex index = currentIndex();\r
+ if (!index.isValid()) {\r
+ return;\r
+ }\r
+\r
+ FileTableModel *m = static_cast<FileTableModel*>(model());\r
+ if (m->fileInfo(index).isDir()) {\r
+ setRootIndex(index);\r
+ }\r
+ else {\r
+ emit openRequested(m->fileInfo(index));\r
+ }\r
}\r
\r
void FileTableView::openUrl(const QModelIndex &index)\r
\r
if (index.isValid()) {\r
FileTableModel *m = static_cast<FileTableModel*>(model());\r
- QString path = QDir::toNativeSeparators(m->absoluteFilePath(index));\r
+ QString path = QDir::toNativeSeparators(m->fileInfo(index).absoluteFilePath());\r
QDesktopServices::openUrl(QUrl("file:///" + path));\r
}\r
else {\r
QFileInfo info;\r
if (path.isEmpty()) {\r
FileTableModel *m = static_cast<FileTableModel*>(model());\r
- info.setFile(m->absoluteFilePath(currentIndex()));\r
+ info.setFile(m->fileInfo(currentIndex()).absoluteFilePath());\r
}\r
else {\r
info.setFile(path);\r
QFileInfo info;\r
if (path.isEmpty()) {\r
FileTableModel *m = static_cast<FileTableModel*>(model());\r
- info.setFile(m->absoluteFilePath(currentIndex()));\r
+ info.setFile(m->fileInfo(currentIndex()).absoluteFilePath());\r
}\r
else {\r
info.setFile(path);\r
\r
FileTableModel *m = static_cast<FileTableModel*>(model());\r
QDir dir(m->absolutePath());\r
- dir.cdUp();\r
-\r
- setRootPath(dir.absolutePath(), true);\r
+ if (!dir.isRoot()) {\r
+ dir.cdUp();\r
+ setRootPath(dir.absolutePath(), true);\r
+ }\r
}\r
\r
void FileTableView::jumpToRoot()\r
}\r
}\r
\r
+void FileTableView::copyFilenameToClipboard()\r
+{\r
+ CHECK_FOCUS;\r
+\r
+ QModelIndex index = currentIndex();\r
+ if (!index.isValid()) {\r
+ return;\r
+ }\r
+\r
+ FileTableModel *m = static_cast<FileTableModel*>(model());\r
+ QClipboard *clipboard = QApplication::clipboard();\r
+ clipboard->setText(m->fileInfo(index).fileName());\r
+}\r
+\r
+void FileTableView::copyFullpathToClipboard()\r
+{\r
+ CHECK_FOCUS;\r
+\r
+ QModelIndex index = currentIndex();\r
+ if (!index.isValid()) {\r
+ return;\r
+ }\r
+\r
+ FileTableModel *m = static_cast<FileTableModel*>(model());\r
+ QClipboard *clipboard = QApplication::clipboard();\r
+ clipboard->setText(m->fileInfo(index).absoluteFilePath());\r
+}\r
+\r
void FileTableView::XXX()\r
{\r
CHECK_FOCUS;\r
\r
FileTableModel *m = static_cast<FileTableModel*>(model());\r
\r
- if (m->isDir(index)) {\r
+ if (m->fileInfo(index).isDir()) {\r
if (QApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) {\r
- openTerminal(m->absoluteFilePath(index));\r
+ openTerminal(m->fileInfo(index).absoluteFilePath());\r
}\r
else {\r
- setRootPath(m->absoluteFilePath(index), true);\r
+ setRootPath(m->fileInfo(index).absoluteFilePath(), true);\r
}\r
}\r
else if (QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier)){\r
- openEditor(m->absoluteFilePath(index));\r
+ openEditor(m->fileInfo(index).absoluteFilePath());\r
}\r
else {\r
openUrl(index);\r
\r
}\r
\r
+void FileTableView::contextMenuRequested(const QPoint &pos)\r
+{\r
+ FileTableModel *m = static_cast<FileTableModel*>(model());\r
+ QModelIndex index = indexAt(pos);\r
+ if (!index.isValid()) {\r
+ return;\r
+ }\r
+\r
+ Q_UNUSED(m);\r
+}\r
+\r
void FileTableView::setRootIndex(const QModelIndex &index)\r
{\r
if (!index.isValid()) {\r
\r
FileTableModel *m = static_cast<FileTableModel*>(model());\r
\r
- if (m->isDir(index)) {\r
- setRootPath(m->absoluteFilePath(index), true);\r
+ if (m->fileInfo(index).isDir()) {\r
+ setRootPath(m->fileInfo(index).absoluteFilePath(), true);\r
}\r
}\r
\r
}\r
}\r
\r
+ if (ksq == "Left" || ksq == "Right") {\r
+ if (side() == ksq) {\r
+ jumpToParent();\r
+ }\r
+ else {\r
+ getMainWnd()->otherSideView(this)->setFocus();\r
+ }\r
+ event->accept();\r
+ return;\r
+ }\r
+\r
if (!ksq.isEmpty() && ksq != "Down" && ksq != "Up") {\r
qDebug() << ksq;\r
}\r
\r
void FileTableView::focusInEvent(QFocusEvent *event)\r
{\r
- qDebug() << "focusInEvent();";\r
if (!currentIndex().isValid()) {\r
FileTableModel *m = static_cast<FileTableModel*>(model());\r
if (m) {\r
{\r
Q_UNUSED(previous);\r
\r
- FileTableModel *m = static_cast<FileTableModel*>(model());\r
- emit indexChanged(m->absoluteFilePath(current));\r
+ if (current.isValid()) {\r
+ FileTableModel *m = static_cast<FileTableModel*>(model());\r
+ emit indexChanged(m->fileInfo(current).absoluteFilePath());\r
+ }\r
\r
QTableView::currentChanged(current, previous);\r
}\r
signals:\r
void indexChanged(const QString &text);\r
void filterChanged();\r
+ void openRequested(const QFileInfo &info);\r
\r
private slots:\r
- void setPath();\r
+ void openItem();\r
void openUrl(const QModelIndex &index = QModelIndex());\r
void openEditor(const QString &path = QString());\r
void openTerminal(const QString &path = QString());\r
void cmdRename();\r
void newFile();\r
void newFolder();\r
+ void copyFilenameToClipboard();\r
+ void copyFullpathToClipboard();\r
\r
void XXX();\r
\r
QString *alias, const QString &srcPath,\r
const QString &tgtPath);\r
void onDoubleClick(const QModelIndex &index);\r
+ void contextMenuRequested(const QPoint & pos);\r
\r
// QAbstractItemView interface\r
public slots:\r
<string>Form</string>\r
</property>\r
<layout class="QVBoxLayout" name="verticalLayout">\r
+ <property name="spacing">\r
+ <number>0</number>\r
+ </property>\r
<property name="leftMargin">\r
<number>0</number>\r
</property>\r
if (settings.value(IniKey_ConfirmExit, "").toString().isEmpty())\r
settings.setValue(IniKey_ConfirmExit, true);\r
if (settings.value(IniKey_BootSizeSpec, "").toString().isEmpty()) {\r
- settings.setValue(IniKey_BootSizeSpec, "sizeLast");\r
+ settings.setValue(IniKey_BootSizeSpec, "sizeRelative");\r
settings.setValue(IniKey_BootSizeAbs, QSize(800,600));\r
- settings.setValue(IniKey_BootSizeRel, QSize(50,50));\r
+ settings.setValue(IniKey_BootSizeRel, QSize(75,75));\r
}\r
if (settings.value(IniKey_BootPosSpec, "").toString().isEmpty()) {\r
- settings.setValue(IniKey_BootPosSpec, "posLast");\r
+ settings.setValue(IniKey_BootPosSpec, "posCenter");\r
settings.setValue(IniKey_BootPosAbs, QPoint(0, 0));\r
settings.setValue(IniKey_BootPosRel, QPoint(0, 0));\r
}\r
\r
MainWindow::MainWindow(QWidget *parent) :\r
QMainWindow(parent),\r
- ui(new Ui::MainWindow)\r
+ ui(new Ui::MainWindow),\r
+ m_focusedView(NULL)\r
{\r
ui->setupUi(this);\r
ui->RPanel->setSide("Right");\r
ui->help_About->setShortcuts(shortcuts);\r
\r
// シグナル/スロットを設定する\r
- connect(ui->action_Setting, SIGNAL(triggered()), this, SLOT(onActionSetting()));\r
+ connect(ui->action_Setting, SIGNAL(triggered()), this, SLOT(showPreferenceDialog()));\r
connect(ui->action_Quit, SIGNAL(triggered()), this, SLOT(close()));\r
- connect(ui->help_About, SIGNAL(triggered()), this, SLOT(onHelpAbout()));\r
+ connect(ui->help_About, SIGNAL(triggered()), this, SLOT(about()));\r
connect(ui->view_Hidden, SIGNAL(triggered()), this, SLOT(toggleShowHiddenFiles()));\r
connect(ui->view_System, SIGNAL(triggered()), this, SLOT(toggleShowSystemFiles()));\r
connect(ui->check_Update, SIGNAL(triggered()), this, SLOT(checkUpdate()));\r
+ connect(ui->plainTextEdit, SIGNAL(viewFinished(QWidget*)), this, SLOT(viewFinish(QWidget*)));\r
\r
// ウィンドウタイトルを設定する\r
setWindowTitle(tr("げふぅ v%1").arg(VERSION_VALUE));\r
if (settings.value(IniKey_CheckUpdates).toBool()) {\r
checkUpdate(true);\r
}\r
+\r
+// ui->splitter->setVisible(false);\r
+ ui->plainTextEdit->setVisible(false);\r
}\r
\r
MainWindow::~MainWindow()\r
return NULL;\r
}\r
\r
-void MainWindow::onActionSetting()\r
+void MainWindow::openRequest(const QFileInfo &info)\r
+{\r
+ m_focusedView = QApplication::focusWidget();\r
+\r
+ setUpdatesEnabled(false);\r
+ ui->splitter->setVisible(false);\r
+ ui->plainTextEdit->setVisible(true);\r
+ ui->plainTextEdit->setFocus();\r
+ setUpdatesEnabled(true);\r
+\r
+ QFile file(info.absoluteFilePath());\r
+ if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {\r
+ QTextStream ts(&file);\r
+ ui->plainTextEdit->setPlainText(ts.readAll());\r
+ }\r
+}\r
+\r
+void MainWindow::showPreferenceDialog()\r
{\r
PreferenceDialog dlg(this);\r
\r
checkUpdateFinished(reply, true);\r
}\r
\r
-void MainWindow::onHelpAbout()\r
+void MainWindow::viewFinish(QWidget *sender)\r
+{\r
+ setUpdatesEnabled(false);\r
+ sender->setVisible(false);\r
+ ui->splitter->setVisible(true);\r
+ m_focusedView->setFocus();\r
+ setUpdatesEnabled(true);\r
+}\r
+\r
+void MainWindow::about()\r
{\r
QMessageBox::about(\r
this,\r
void showSystemFiles(bool show);\r
\r
public slots:\r
- void onActionSetting();\r
- void onHelpAbout();\r
\r
private slots:\r
+ void openRequest(const QFileInfo &info);\r
+ void showPreferenceDialog();\r
+ void about();\r
void toggleShowHiddenFiles();\r
void toggleShowSystemFiles();\r
void checkUpdate(bool silent = false);\r
void checkUpdateFinished(QNetworkReply *reply);\r
void checkUpdateFinished(QNetworkReply *reply, bool silent);\r
void checkUpdateFinishedSilent(QNetworkReply *reply);\r
+ void viewFinish(QWidget *sender);\r
\r
private:\r
Ui::MainWindow *ui;\r
+ QWidget *m_focusedView;\r
\r
// QWidget interface\r
protected:\r
<rect>\r
<x>0</x>\r
<y>0</y>\r
- <width>662</width>\r
- <height>324</height>\r
+ <width>665</width>\r
+ <height>337</height>\r
</rect>\r
</property>\r
<property name="windowTitle">\r
<string>MainWindow</string>\r
</property>\r
<property name="windowIcon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Gefu.png</normaloff>:/images/Gefu.png</iconset>\r
</property>\r
<widget class="QWidget" name="centralWidget">\r
</widget>\r
</item>\r
<item>\r
+ <widget class="SimpleTextView" name="plainTextEdit"/>\r
+ </item>\r
+ <item>\r
<layout class="QHBoxLayout" name="horizontalLayout">\r
<property name="spacing">\r
<number>0</number>\r
<rect>\r
<x>0</x>\r
<y>0</y>\r
- <width>662</width>\r
+ <width>665</width>\r
<height>22</height>\r
</rect>\r
</property>\r
<addaction name="separator"/>\r
<addaction name="cmd_NewFile"/>\r
<addaction name="cmd_NewFolder"/>\r
+ <addaction name="separator"/>\r
+ <addaction name="copy_Filename"/>\r
+ <addaction name="copy_Fullpath"/>\r
</widget>\r
<widget class="QMenu" name="menu_Help">\r
<property name="title">\r
</widget>\r
<action name="action_Quit">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Exit.png</normaloff>:/images/Exit.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="action_Open">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Open.png</normaloff>:/images/Open.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="action_Exec">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Play.png</normaloff>:/images/Play.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="view_FromOther">\r
<property name="icon">\r
- <iconset theme="隣のパネルと同じフォルダを表示" resource="resource.qrc">\r
+ <iconset theme="隣のパネルと同じフォルダを表示">\r
<normaloff>:/images/Synchronize.png</normaloff>:/images/Synchronize.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="mark_All">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Ok.png</normaloff>:/images/Ok.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="mark_AllFiles">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Check boxes.png</normaloff>:/images/Check boxes.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="mark_AllOff">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Cancel.png</normaloff>:/images/Cancel.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="view_Swap">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Text replace.png</normaloff>:/images/Text replace.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="action_Setting">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Settings.png</normaloff>:/images/Settings.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="move_Down">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Go down.png</normaloff>:/images/Go down.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="move_Up">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Go up.png</normaloff>:/images/Go up.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="move_Back">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Back.png</normaloff>:/images/Back.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="move_Forward">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Forward.png</normaloff>:/images/Forward.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="move_Parent">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Up.png</normaloff>:/images/Up.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="move_Root">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Monitor.png</normaloff>:/images/Monitor.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="move_Jump">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Folder.png</normaloff>:/images/Folder.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="move_Home">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Home.png</normaloff>:/images/Home.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="action_OpenEditor">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Edit page.png</normaloff>:/images/Edit page.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="action_Command">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Export.png</normaloff>:/images/Export.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="cmd_Copy">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Copy.png</normaloff>:/images/Copy.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="cmd_Move">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Paste.png</normaloff>:/images/Paste.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="cmd_Delete">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Delete.png</normaloff>:/images/Delete.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="cmd_Rename">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Rename.png</normaloff>:/images/Rename.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="cmd_NewFile">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/New file.png</normaloff>:/images/New file.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="cmd_NewFolder">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Add folder.png</normaloff>:/images/Add folder.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="help_About">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Help.png</normaloff>:/images/Help.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="view_Refresh">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Refresh.png</normaloff>:/images/Refresh.png</iconset>\r
</property>\r
<property name="text">\r
</action>\r
<action name="view_Filter">\r
<property name="icon">\r
- <iconset resource="resource.qrc">\r
+ <iconset>\r
<normaloff>:/images/Funnel.png</normaloff>:/images/Funnel.png</iconset>\r
</property>\r
<property name="text">\r
<string>V</string>\r
</property>\r
</action>\r
+ <action name="copy_Filename">\r
+ <property name="text">\r
+ <string>ファイル名をクリップボードにコピー</string>\r
+ </property>\r
+ <property name="toolTip">\r
+ <string>ファイル名をクリップボードにコピー</string>\r
+ </property>\r
+ <property name="shortcut">\r
+ <string>C</string>\r
+ </property>\r
+ </action>\r
+ <action name="copy_Fullpath">\r
+ <property name="text">\r
+ <string>フルパス名をクリップボードにコピー</string>\r
+ </property>\r
+ <property name="toolTip">\r
+ <string>フルパス名をクリップボードにコピー</string>\r
+ </property>\r
+ <property name="shortcut">\r
+ <string>Shift+C</string>\r
+ </property>\r
+ </action>\r
</widget>\r
<layoutdefault spacing="6" margin="11"/>\r
<customwidgets>\r
<header>folderpanel.h</header>\r
<container>1</container>\r
</customwidget>\r
+ <customwidget>\r
+ <class>SimpleTextView</class>\r
+ <extends>QPlainTextEdit</extends>\r
+ <header>simpletextview.h</header>\r
+ </customwidget>\r
</customwidgets>\r
- <resources>\r
- <include location="resource.qrc"/>\r
- </resources>\r
+ <resources/>\r
<connections/>\r
</ui>\r
--- /dev/null
+#include "common.h"
+#include "simpletextview.h"
+
+#include <QDebug>
+#include <QSettings>
+
+SimpleTextView::SimpleTextView(QWidget *parent) :
+ QPlainTextEdit(parent)
+{
+ setReadOnly(true);
+
+ QSettings settings;
+ QPalette palette = this->palette();
+ palette.setColor(QPalette::Base,
+ settings.value(IniKey_ViewColorBgNormal).value<QColor>());
+ palette.setColor(QPalette::Text,
+ settings.value(IniKey_ViewColorFgNormal).value<QColor>());
+ setPalette(palette);
+}
+
+
+void SimpleTextView::keyPressEvent(QKeyEvent *event)
+{
+ QString modifier = QString::null;
+ if (event->modifiers() & Qt::ShiftModifier) { modifier += "Shift+"; }
+ if (event->modifiers() & Qt::ControlModifier) { modifier += "Ctrl+"; }
+ if (event->modifiers() & Qt::AltModifier) { modifier += "Alt+"; }
+ if (event->modifiers() & Qt::MetaModifier) { modifier += "Meta+"; }
+
+ QString key = QKeySequence(event->key()).toString();
+ QString ksq = QKeySequence(modifier + key).toString();
+
+ if (ksq == "Return" || ksq == "Backspace" || ksq == "W") {
+ emit viewFinished(this);
+ event->accept();
+ return;
+ }
+
+ if (ksq != "Down" && ksq != "Up") {
+ qDebug() << ksq;
+ }
+ QPlainTextEdit::keyPressEvent(event);
+}
--- /dev/null
+#ifndef SIMPLETEXTVIEW_H
+#define SIMPLETEXTVIEW_H
+
+#include <QPlainTextEdit>
+
+class SimpleTextView : public QPlainTextEdit
+{
+ Q_OBJECT
+public:
+ explicit SimpleTextView(QWidget *parent = 0);
+
+signals:
+ void viewFinished(QWidget *sender);
+
+public slots:
+
+
+ // QWidget interface
+protected:
+ void keyPressEvent(QKeyEvent *event);
+};
+
+#endif // SIMPLETEXTVIEW_H