OSDN Git Service

テキストビューアを試し実装
authorMasayuki Satoh <miyabi.satoh@gmail.com>
Sat, 23 Aug 2014 11:50:29 +0000 (20:50 +0900)
committerMasayuki Satoh <miyabi.satoh@gmail.com>
Sat, 23 Aug 2014 11:50:29 +0000 (20:50 +0900)
13 files changed:
Gefu.pro
README.md
filetablemodel.cpp
filetablemodel.h
filetableview.cpp
filetableview.h
folderpanel.ui
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
simpletextview.cpp [new file with mode: 0644]
simpletextview.h [new file with mode: 0644]

index 9d6b7fa..bbe11af 100644 (file)
--- a/Gefu.pro
+++ b/Gefu.pro
@@ -33,7 +33,8 @@ SOURCES += main.cpp\
     historydialog.cpp \
     preferencedialog.cpp \
     clickablelabel.cpp \
-    colorsamplemodel.cpp
+    colorsamplemodel.cpp \
+    simpletextview.cpp
 
 HEADERS  += mainwindow.h \
     folderpanel.h \
@@ -55,7 +56,8 @@ HEADERS  += mainwindow.h \
     historydialog.h \
     preferencedialog.h \
     clickablelabel.h \
-    colorsamplemodel.h
+    colorsamplemodel.h \
+    simpletextview.h
 
 FORMS    += mainwindow.ui \
     folderpanel.ui \
index 14b9a53..71f6a44 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Gefu
 Gefu is an Experimental File Utility.
 
 ### TODO
-- コンテキストメニュー
+- コンテキストメニュー ← 必要?
 - オプション
     - ファンクションキー
     - キーバインドカスタマイズ
@@ -15,6 +15,15 @@ Gefu is an Experimental File Utility.
 - 簡易FTPクライアント
 - SNS連携(タイムライン表示とか) ← ファイラーの機能か?
 
+#### 2014/08/23 Ver0.09
+- 左右矢印キーに機能割り当て
+    - 左ペインで左矢印/右ペインで右矢印 → 親フォルダに移動
+    - 左ペインで右矢印/右ペインで左矢印 → 反対側のペインにフォーカス
+- ファイル名をクリップボードにコピーを実装。
+- フォルダ名をクリップボードにコピーを実装。
+- 不具合修正
+    - Windows版で初回起動時、タイトルバーが画面外に出ていた。→ デフォルト位置・サイズ変更。
+
 #### 2014/08/23 Ver0.08 公開
 - 「ターミナルで開く」を実装。
 - Shift+ダブルクリックで、ファイルを外部エディタで開くようにした。
index 04b8148..06d4424 100644 (file)
@@ -149,23 +149,42 @@ void FileTableModel::setCheckStateAll(Qt::CheckState state)
     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
index d90d587..f21ea6e 100644 (file)
@@ -30,10 +30,12 @@ public:
     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
index 3fcdebe..ce2cf51 100644 (file)
@@ -26,6 +26,8 @@
 #include <QMimeData>\r
 #include <QDrag>\r
 #include <QApplication>\r
+#include <QClipboard>\r
+#include <QShortcut>\r
 \r
 #define CHECK_FOCUS {                   \\r
         if (!hasFocus()) { return; }    \\r
@@ -44,7 +46,7 @@ FileTableView::FileTableView(QWidget *parent) :
     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
@@ -81,11 +83,15 @@ FileTableView::FileTableView(QWidget *parent) :
     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
@@ -94,6 +100,11 @@ FileTableView::FileTableView(QWidget *parent) :
     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
@@ -170,11 +181,22 @@ void FileTableView::updateMenu()
     }\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
@@ -183,7 +205,7 @@ void FileTableView::openUrl(const QModelIndex &index)
 \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
@@ -210,7 +232,7 @@ void FileTableView::openEditor(const QString &path)
     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
@@ -256,7 +278,7 @@ void FileTableView::openTerminal(const QString &path)
     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
@@ -645,9 +667,10 @@ void FileTableView::jumpToParent()
 \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
@@ -912,6 +935,34 @@ void FileTableView::newFolder()
     }\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
@@ -969,16 +1020,16 @@ void FileTableView::onDoubleClick(const QModelIndex &index)
 \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
@@ -986,6 +1037,17 @@ void FileTableView::onDoubleClick(const QModelIndex &index)
 \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
@@ -994,8 +1056,8 @@ void FileTableView::setRootIndex(const QModelIndex &index)
 \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
@@ -1028,6 +1090,17 @@ void FileTableView::keyPressEvent(QKeyEvent *event)
         }\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
@@ -1036,7 +1109,6 @@ void FileTableView::keyPressEvent(QKeyEvent *event)
 \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
@@ -1053,8 +1125,10 @@ void FileTableView::currentChanged(const QModelIndex &current, const QModelIndex
 {\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
index 513db97..d3ed0e5 100644 (file)
@@ -32,9 +32,10 @@ private:
 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
@@ -73,6 +74,8 @@ private slots:
     void cmdRename();\r
     void newFile();\r
     void newFolder();\r
+    void copyFilenameToClipboard();\r
+    void copyFullpathToClipboard();\r
 \r
     void XXX();\r
 \r
@@ -81,6 +84,7 @@ private slots:
                       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
index 0c6772b..cf22040 100644 (file)
@@ -20,6 +20,9 @@
    <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
index 4007631..c3282c7 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -34,12 +34,12 @@ int main(int argc, char *argv[])
     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
index b5df12f..7c7bac9 100644 (file)
@@ -15,7 +15,8 @@
 \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
@@ -61,12 +62,13 @@ MainWindow::MainWindow(QWidget *parent) :
     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
@@ -122,6 +124,9 @@ MainWindow::MainWindow(QWidget *parent) :
     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
@@ -143,7 +148,24 @@ FileTableView *MainWindow::otherSideView(const FileTableView *view) const
     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
@@ -244,7 +266,16 @@ void MainWindow::checkUpdateFinishedSilent(QNetworkReply *reply)
     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
index 4cb6eec..7b29346 100644 (file)
@@ -26,19 +26,22 @@ signals:
     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
index 6b25603..e8d44b2 100644 (file)
@@ -6,15 +6,15 @@
    <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
@@ -58,6 +58,9 @@
      </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
diff --git a/simpletextview.cpp b/simpletextview.cpp
new file mode 100644 (file)
index 0000000..465a443
--- /dev/null
@@ -0,0 +1,43 @@
+#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);
+}
diff --git a/simpletextview.h b/simpletextview.h
new file mode 100644 (file)
index 0000000..2fefd7b
--- /dev/null
@@ -0,0 +1,23 @@
+#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