OSDN Git Service

Ver0.19
authorMasayuki Satoh <miyabi.satoh@gmail.com>
Sat, 30 Aug 2014 13:34:30 +0000 (22:34 +0900)
committerMasayuki Satoh <miyabi.satoh@gmail.com>
Sat, 30 Aug 2014 13:34:30 +0000 (22:34 +0900)
19 files changed:
Gefu.pro
README.md
anyview.cpp
anyview.h
common.h
filetablemodel.cpp
filetablemodel.h
folderpanel.cpp
folderpanel.h
folderview.cpp
folderview.h
locationbox.cpp
locationbox.h
mainwindow.cpp
mainwindow.h
preferencedialog.cpp
preferencedialog.ui
simpleimageview.cpp
simpletextview.cpp

index 0ee3130..435f9dd 100644 (file)
--- a/Gefu.pro
+++ b/Gefu.pro
@@ -9,15 +9,9 @@ QT       += network
 
 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
-
 TARGET = Gefu
 TEMPLATE = app
-VERSION = 0.1.6
-QMAKE_TARGET_COMPANY = gefu.sourceforge.jp
-QMAKE_TARGET_PRODUCT = Gefu
-QMAKE_TARGET_DESCRIPTION = Gefu is an Experimental File Utility.
-QMAKE_TARGET_COPYRIGHT = Copyright(c) 2014 @miyabi_satoh
-
+VERSION = 0.1.9
 
 SOURCES += main.cpp\
     mainwindow.cpp \
index f6dc8d0..f3ae1b4 100644 (file)
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ Gefu is an Experimental File Utility.
   * SNS連携(タイムライン表示とか) ← ファイラーの機能か?
 
 #### Ver0.19
+  * 非アクティブパネルの色を暗くするオプションを追加。
   * 不具合修正
     * 一部のショートカットキーが効いていなかったのを修正。
 
index 244ce8a..24dc82f 100644 (file)
@@ -101,6 +101,19 @@ SimpleTextView *AnyView::textView() const
     return ui->textView;
 }
 
+QWidget *AnyView::visibleView() const
+{
+    if (ui->folderPanel->isVisible()) {
+        return ui->folderPanel->folderView();
+    }
+    if (ui->graphicsView->isVisible()) {
+        return ui->graphicsView;
+    }
+    if (ui->textView->isVisible()) {
+        return ui->textView;
+    }
+    return NULL;
+}
 
 void AnyView::focusInEvent(QFocusEvent *)
 {
index 653fc94..2926016 100644 (file)
--- a/anyview.h
+++ b/anyview.h
@@ -33,6 +33,7 @@ public:
     FolderPanel* folderPanel() const;
     SimpleImageView* imageView() const;
     SimpleTextView* textView() const;
+    QWidget* visibleView() const;
 
 private:
     Ui::AnyView *ui;
index 282d098..c732ae8 100644 (file)
--- a/common.h
+++ b/common.h
@@ -9,6 +9,7 @@ class QKeyEvent;
 extern QString FilesizeToString(quint64 size);\r
 extern QString ViewerIgnoreExt();\r
 extern QString KeyEventToSequence(const QKeyEvent *event);\r
+extern bool IsKeyUpDown(const QKeyEvent *event);\r
 extern bool ProcessShortcut(const QString &ksq, const QObject *object);\r
 extern void Sleep(int msec);\r
 \r
@@ -41,6 +42,8 @@ extern void Sleep(int msec);
 #define IniKey_ViewColorFgSystem        "Appearance/ViewColorFgSystem"\r
 #define IniKey_ViewColorFgHidden        "Appearance/ViewColorFgHidden"\r
 #define IniKey_ViewColorFgReadonly      "Appearance/ViewColorFgReadonly"\r
+#define IniKey_EnableDarker             "Appearance/Darker"\r
+#define IniKey_Darkness                 "Appearance/Darkness"\r
 #define IniKey_ConfirmExit              "Confirm/Exit"\r
 #define IniKey_ConfirmCopy              "Confirm/Copy"\r
 #define IniKey_ConfirmMove              "Confirm/Move"\r
index ef5cfc9..da31c82 100644 (file)
@@ -26,6 +26,8 @@ FileTableModel::FileTableModel(QObject *parent) :
     m_HiddenBrush(),\r
     m_ReadonlyBrush()\r
 {\r
+    m_fsWatcher = new QFileSystemWatcher(this);\r
+\r
     // デフォルトフィルタを設定する\r
     setFilter(QDir::NoDot | QDir::AllDirs | QDir::Files);\r
 }\r
@@ -99,10 +101,6 @@ bool FileTableModel::setPath(const QString &path)
     m_checkStates.resize(m_fileInfoList.size());\r
     m_checkStates.fill(Qt::Unchecked);\r
 \r
-    if (m_fsWatcher) {\r
-        delete m_fsWatcher;\r
-    }\r
-    m_fsWatcher = new QFileSystemWatcher(this);\r
     m_fsWatcher->addPath(path);\r
     connect(m_fsWatcher, SIGNAL(directoryChanged(QString)),\r
             this, SLOT(directoryChange(QString)));\r
@@ -158,26 +156,30 @@ QFileInfo FileTableModel::fileInfo(const QModelIndex &index) const
     return m_fileInfoList[index.row()];\r
 }\r
 \r
-void FileTableModel::updateAppearance()\r
+void FileTableModel::updateAppearance(bool darker)\r
 {\r
     QSettings settings;\r
-    QPalette palette(QApplication::palette("QTableView"));\r
-\r
+    int darkness = 100;\r
+    if (darker && settings.value(IniKey_EnableDarker).toBool()) {\r
+        darkness += settings.value(IniKey_Darkness).toInt();\r
+    }\r
     m_font = settings.value(IniKey_ViewFont).value<QFont>();\r
-    m_NormalBrush = QBrush(settings.value(IniKey_ViewColorBgNormal).value<QColor>());\r
-    m_NormalTextBrush = QBrush(settings.value(IniKey_ViewColorFgNormal).value<QColor>());\r
-    m_MarkBrush = QBrush(settings.value(IniKey_ViewColorBgMark).value<QColor>());\r
-    m_MarkTextBrush = QBrush(settings.value(IniKey_ViewColorFgMark).value<QColor>());\r
-    m_SystemBrush = QBrush(settings.value(IniKey_ViewColorFgSystem).value<QColor>());\r
-    m_HiddenBrush = QBrush(settings.value(IniKey_ViewColorFgHidden).value<QColor>());\r
-    m_ReadonlyBrush = QBrush(settings.value(IniKey_ViewColorFgReadonly).value<QColor>());\r
-    m_ReadonlyBrush = QBrush(settings.value(IniKey_ViewColorFgReadonly).value<QColor>());\r
+\r
+    m_NormalBrush = QBrush(settings.value(IniKey_ViewColorBgNormal).value<QColor>().darker(darkness));\r
+    m_NormalTextBrush = QBrush(settings.value(IniKey_ViewColorFgNormal).value<QColor>().darker(darkness));\r
+    m_MarkBrush = QBrush(settings.value(IniKey_ViewColorBgMark).value<QColor>().darker(darkness));\r
+    m_MarkTextBrush = QBrush(settings.value(IniKey_ViewColorFgMark).value<QColor>().darker(darkness));\r
+    m_SystemBrush = QBrush(settings.value(IniKey_ViewColorFgSystem).value<QColor>().darker(darkness));\r
+    m_HiddenBrush = QBrush(settings.value(IniKey_ViewColorFgHidden).value<QColor>().darker(darkness));\r
+    m_ReadonlyBrush = QBrush(settings.value(IniKey_ViewColorFgReadonly).value<QColor>().darker(darkness));\r
+    m_ReadonlyBrush = QBrush(settings.value(IniKey_ViewColorFgReadonly).value<QColor>().darker(darkness));\r
 }\r
 \r
 void FileTableModel::directoryChange(const QString &path)\r
 {\r
     qDebug() << "FileTableModel::directoryChange";\r
 \r
+    m_fsWatcher->removePath(m_dir.absolutePath());\r
     setPath(path);\r
 }\r
 \r
index 3cbcfc7..b161f66 100644 (file)
@@ -35,7 +35,7 @@ public:
     QFileInfoList checkedItems() const;\r
     QFileInfo fileInfo(const QModelIndex &index) const;\r
 \r
-    void updateAppearance();\r
+    void updateAppearance(bool darker = false);\r
 \r
     QFont font() const { return m_font; }\r
 \r
index becb113..93b42c8 100644 (file)
@@ -22,7 +22,7 @@ FolderPanel::~FolderPanel()
     delete ui;
 }
 
-void FolderPanel::initialize(MainWindow *mainWnd)
+void FolderPanel::initialize(MainWindow *mainWnd, bool left)
 {
     qDebug() << "FolderPanel::initialize();";
     m_mainWnd = mainWnd;
@@ -43,10 +43,10 @@ void FolderPanel::initialize(MainWindow *mainWnd)
     ui->searchBox->setVisible(false);
 
     // ロケーションボックスを初期化する
-    ui->locationBox->initialize();
+    ui->locationBox->initialize(left);
 
     // フォルダビューを初期化する
-    ui->folderView->initialize(mainWnd);
+    ui->folderView->initialize(mainWnd, left);
 }
 
 LocationBox *FolderPanel::locationBox() const
index cddd1fe..89ea159 100644 (file)
@@ -20,7 +20,7 @@ public:
     explicit FolderPanel(QWidget *parent = 0);
     ~FolderPanel();
 
-    void initialize(MainWindow *mainWnd);
+    void initialize(MainWindow *mainWnd, bool left);
 
     // getter
     LocationBox* locationBox() const;
index 394c2ec..02931ae 100644 (file)
@@ -1,5 +1,7 @@
 #include "common.h"
 #include "mainwindow.h"
+#include "folderpanel.h"
+#include "locationbox.h"
 #include "folderview.h"
 
 #include <QDebug>
@@ -54,7 +56,7 @@ QString FolderView::side() const
     }
 }
 
-void FolderView::initialize(MainWindow *mainWnd)
+void FolderView::initialize(MainWindow *mainWnd, bool left)
 {
     qDebug() << side() << "initialize";
 
@@ -73,7 +75,7 @@ void FolderView::initialize(MainWindow *mainWnd)
     setPath(settings.value(side() + slash + IniKey_Dir).toString(), true);
 
     // 色とフォントを設定する
-    updateAppearance();
+    updateAppearance(!left);
 
     // 列のリサイズモードを設定する
     QHeaderView *header;
@@ -85,14 +87,18 @@ void FolderView::initialize(MainWindow *mainWnd)
     header->setSectionResizeMode(4, QHeaderView::ResizeToContents);
 }
 
-void FolderView::updateAppearance()
+void FolderView::updateAppearance(bool darker)
 {
     qDebug() << side() << "updateAppearance";
-    m_model.updateAppearance();
+    m_model.updateAppearance(darker);
 
     QSettings settings;
     QPalette pal = palette();
-    pal.setColor(QPalette::Base, settings.value(IniKey_ViewColorBgNormal).value<QColor>());
+    int darkness = 100;
+    if (darker && settings.value(IniKey_EnableDarker).toBool()) {
+        darkness += settings.value(IniKey_Darkness).toInt();
+    }
+    pal.setColor(QPalette::Base, settings.value(IniKey_ViewColorBgNormal).value<QColor>().darker(darkness));
     setPalette(pal);
 
     // 行の高さを設定する
@@ -387,7 +393,11 @@ void FolderView::keyPressEvent(QKeyEvent *event)
 {
     qDebug() << side() << "keyPressEvent";
 
-    QTableView::keyPressEvent(event);
+    if (IsKeyUpDown(event)) {
+        QTableView::keyPressEvent(event);
+        event->accept();
+        return;
+    }
 
     // MainWindowへ
     event->ignore();
@@ -509,3 +519,30 @@ void FolderView::contextMenuEvent(QContextMenuEvent *event)
 
     emit requestContextMenu(event);
 }
+
+
+void FolderView::focusInEvent(QFocusEvent *event)
+{
+    if (!currentIndex().isValid()) {
+        setCurrentIndex(m_model.index(0, 1));
+    }
+
+    this->updateAppearance();
+
+    FolderPanel *fp = qobject_cast<FolderPanel*>(parentWidget());
+    fp->locationBox()->updateAppearance();
+
+    QTableView::focusInEvent(event);
+}
+
+void FolderView::focusOutEvent(QFocusEvent *event)
+{
+    m_model.updateAppearance(true);
+
+    this->updateAppearance(true);
+
+    FolderPanel *fp = qobject_cast<FolderPanel*>(parentWidget());
+    fp->locationBox()->updateAppearance(true);
+
+    QTableView::focusOutEvent(event);
+}
index cc22009..8eba938 100644 (file)
@@ -16,8 +16,8 @@ public:
     QString side() const;
 
     // actions
-    void initialize(MainWindow *mainWnd);
-    void updateAppearance();
+    void initialize(MainWindow *mainWnd, bool left);
+    void updateAppearance(bool darker = false);
     void refresh();
 
     void searchItem(const QString &text);
@@ -79,6 +79,8 @@ protected:
     void dragEnterEvent(QDragEnterEvent *event);
     void dropEvent(QDropEvent *event);
     void contextMenuEvent(QContextMenuEvent *event);
+    void focusInEvent(QFocusEvent *event);
+    void focusOutEvent(QFocusEvent *event);
 };
 
 #endif // FOLDERVIEW_H
index bd46ffa..f801e94 100644 (file)
@@ -9,22 +9,26 @@ LocationBox::LocationBox(QWidget *parent) :
 {
 }
 
-void LocationBox::initialize()
+void LocationBox::initialize(bool left)
 {
     qDebug() << "LocationBox::initialize";
 
-    updateAppearance();
+    updateAppearance(!left);
 }
 
-void LocationBox::updateAppearance()
+void LocationBox::updateAppearance(bool darker)
 {
     qDebug() << "LocationBox::updateAppearance";
 
     QSettings settings;
 
     QPalette pal = palette();
-    pal.setColor(QPalette::Base, settings.value(IniKey_BoxColorBg).value<QColor>());
-    pal.setColor(QPalette::Text, settings.value(IniKey_BoxColorFg).value<QColor>());
+    int darkness = 100;
+    if (darker && settings.value(IniKey_EnableDarker).toBool()) {
+        darkness += settings.value(IniKey_Darkness).toInt();
+    }
+    pal.setColor(QPalette::Base, settings.value(IniKey_BoxColorBg).value<QColor>().darker(darkness));
+    pal.setColor(QPalette::Text, settings.value(IniKey_BoxColorFg).value<QColor>().darker(darkness));
     setPalette(pal);
 
     setFont(settings.value(IniKey_BoxFont).value<QFont>());
index 6463311..ac41b8f 100644 (file)
@@ -9,8 +9,8 @@ class LocationBox : public QLineEdit
 public:
     explicit LocationBox(QWidget *parent = 0);
 
-    void initialize();
-    void updateAppearance();
+    void initialize(bool left);
+    void updateAppearance(bool darker = false);
 
 signals:
 
index ad9473e..c3d97ab 100644 (file)
@@ -78,7 +78,7 @@ MainWindow::MainWindow(QWidget *parent) :
         fp->setObjectName(QString("folderPanel%1").arg(i));\r
         fp->folderView()->setObjectName(QString("folderView%1").arg(i));\r
 \r
-        fp->initialize(this);\r
+        fp->initialize(this, i == 1);\r
     }\r
 \r
     QSettings settings;\r
@@ -1101,6 +1101,44 @@ void MainWindow::setCursorToEnd()
     QApplication::sendEvent(QApplication::focusWidget(), &event2);\r
 }\r
 \r
+void MainWindow::setCursorToBeginOther()\r
+{\r
+    qDebug() << "MainWindow::setCursorToBeginOther();";\r
+\r
+    QKeyEvent event1 = QKeyEvent(QEvent::KeyPress, Qt::Key_Home, Qt::NoModifier);\r
+    sendEventOther(&event1);\r
+\r
+    QKeyEvent event2 = QKeyEvent(QEvent::KeyPress, Qt::Key_Home, Qt::ControlModifier);\r
+    sendEventOther(&event2);\r
+}\r
+\r
+void MainWindow::cursorDownOther()\r
+{\r
+    qDebug() << "MainWindow::cursorDownOther();";\r
+\r
+    QKeyEvent event = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier);\r
+    sendEventOther(&event);\r
+}\r
+\r
+void MainWindow::cursorUpOther()\r
+{\r
+    qDebug() << "MainWindow::cursorUpOther();";\r
+\r
+    QKeyEvent event = QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier);\r
+    sendEventOther(&event);\r
+}\r
+\r
+void MainWindow::setCursorToEndOther()\r
+{\r
+    qDebug() << "MainWindow::setCursorToEndOther();";\r
+\r
+    QKeyEvent event1 = QKeyEvent(QEvent::KeyPress, Qt::Key_End, Qt::NoModifier);\r
+    sendEventOther(&event1);\r
+\r
+    QKeyEvent event2 = QKeyEvent(QEvent::KeyPress, Qt::Key_End, Qt::ControlModifier);\r
+    sendEventOther(&event2);\r
+}\r
+\r
 void MainWindow::setFontSizeDown()\r
 {\r
     qDebug() << "MainWindow::setFontSizeDown();";\r
@@ -1179,6 +1217,43 @@ void MainWindow::initBookmark()
     }\r
 }\r
 \r
+void MainWindow::sendEventOther(QEvent *event)\r
+{\r
+    qDebug() << "MainWindow::sendEventOther();";\r
+\r
+    QWidget *widget = NULL;\r
+\r
+    if (m_viewMode & ModeBasic) {\r
+        // 検索ボックスにフォーカスがある場合も考慮して、\r
+        // FolderPanalを介してViewを取得する\r
+        FolderPanel *fp = qobject_cast<FolderPanel*>(qApp->focusWidget()->parentWidget());\r
+        Q_CHECK_PTR(fp);\r
+\r
+        widget = otherSideFolderView(fp->folderView());\r
+    }\r
+    else if (m_viewMode & ModeHalfView) {\r
+        AnyView *focusedView = qobject_cast<AnyView*>(qApp->focusWidget()->parentWidget());\r
+        if (!focusedView) {\r
+            focusedView = qobject_cast<AnyView*>(qApp->focusWidget()->parentWidget()->parentWidget());\r
+        }\r
+        Q_CHECK_PTR(focusedView);\r
+\r
+        if (focusedView == ui->pane1) {\r
+            widget = ui->pane2->visibleView();\r
+        }\r
+        else {\r
+            Q_ASSERT(focusedView == ui->pane2);\r
+            widget = ui->pane1->visibleView();\r
+        }\r
+    }\r
+    else {\r
+        return;\r
+    }\r
+\r
+    Q_CHECK_PTR(widget);\r
+    QApplication::sendEvent(widget, event);\r
+}\r
+\r
 void MainWindow::setPathFromOther()\r
 {\r
     qDebug() << "MainWindow::setPathFromOther();";\r
@@ -1281,10 +1356,13 @@ void MainWindow::showPreferenceDialog()
 \r
     PreferenceDialog dlg(this);\r
     if (dlg.exec() == QDialog::Accepted) {\r
-        ui->pane1->folderPanel()->locationBox()->updateAppearance();\r
-        ui->pane2->folderPanel()->locationBox()->updateAppearance();\r
-        ui->pane1->folderPanel()->folderView()->updateAppearance();\r
-        ui->pane2->folderPanel()->folderView()->updateAppearance();\r
+        bool dark1 = !ui->pane1->folderPanel()->folderView()->hasFocus();\r
+        bool dark2 = !ui->pane2->folderPanel()->folderView()->hasFocus();\r
+\r
+        ui->pane1->folderPanel()->locationBox()->updateAppearance(dark1);\r
+        ui->pane2->folderPanel()->locationBox()->updateAppearance(dark2);\r
+        ui->pane1->folderPanel()->folderView()->updateAppearance(dark1);\r
+        ui->pane2->folderPanel()->folderView()->updateAppearance(dark2);\r
         ui->pane1->textView()->updateAppearance();\r
         ui->pane2->textView()->updateAppearance();\r
         ui->pane3->textView()->updateAppearance();\r
@@ -1459,13 +1537,17 @@ void MainWindow::initActionConnections()
     connect(ui->move_Begin, SIGNAL(triggered()), this, SLOT(setCursorToBegin()));\r
     connect(ui->move_Down, SIGNAL(triggered()), this, SLOT(cursorDown()));\r
     connect(ui->move_End, SIGNAL(triggered()), this, SLOT(setCursorToEnd()));\r
+    connect(ui->move_Up, SIGNAL(triggered()), this, SLOT(cursorUp()));\r
+    connect(ui->move_BeginOther, SIGNAL(triggered()), this, SLOT(setCursorToBeginOther()));\r
+    connect(ui->move_DownOther, SIGNAL(triggered()), this, SLOT(cursorDownOther()));\r
+    connect(ui->move_EndOther, SIGNAL(triggered()), this, SLOT(setCursorToEndOther()));\r
+    connect(ui->move_UpOther, SIGNAL(triggered()), this, SLOT(cursorUpOther()));\r
     connect(ui->move_Forward, SIGNAL(triggered()), this, SLOT(historyForward()));\r
     connect(ui->move_History, SIGNAL(triggered()), this, SLOT(showHistoryDialog()));\r
     connect(ui->move_Home, SIGNAL(triggered()), this, SLOT(setPathToHome()));\r
     connect(ui->move_Jump, SIGNAL(triggered()), this, SLOT(chooseFolder()));\r
     connect(ui->move_Parent, SIGNAL(triggered()), this, SLOT(setPathToParent()));\r
     connect(ui->move_Root, SIGNAL(triggered()), this, SLOT(setPathToRoot()));\r
-    connect(ui->move_Up, SIGNAL(triggered()), this, SLOT(cursorUp()));\r
     connect(ui->view_Filter, SIGNAL(triggered()), this, SLOT(showFilterDialog()));\r
     connect(ui->view_FontSizeDown, SIGNAL(triggered()), this, SLOT(setFontSizeDown()));\r
     connect(ui->view_FontSizeUp, SIGNAL(triggered()), this, SLOT(setFontSizeUp()));\r
@@ -1685,9 +1767,11 @@ void MainWindow::closeEvent(QCloseEvent *event)
 \r
 void MainWindow::keyPressEvent(QKeyEvent *event)\r
 {\r
+\r
     QString ksq = KeyEventToSequence(event);\r
 \r
     qDebug() << ">>>>> キーイベントを受信(MainWindow)" << ksq << "<<<<<";\r
+    qDebug() << qApp->keyboardModifiers().testFlag(Qt::ShiftModifier);\r
 \r
     if (ProcessShortcut(ksq, this)) {\r
         event->accept();\r
index a620d39..56dc34b 100644 (file)
@@ -53,6 +53,8 @@ public slots:
     void createFolder();\r
     void cursorDown();\r
     void cursorUp();\r
+    void cursorDownOther();\r
+    void cursorUpOther();\r
     void deleteItems();\r
     void editBookmark();\r
     void executeCommand();\r
@@ -74,6 +76,8 @@ public slots:
     void searchPrev();\r
     void setCursorToBegin();\r
     void setCursorToEnd();\r
+    void setCursorToBeginOther();\r
+    void setCursorToEndOther();\r
     void setFontSizeDown();\r
     void setFontSizeUp();\r
     void setPathFromOther();\r
@@ -99,10 +103,10 @@ public slots:
 \r
 private:\r
     enum Mode {\r
-        ModeBasic = 0x00,\r
-        ModeSearch = 0x01,\r
-        ModeFullView = 0x02,\r
-        ModeHalfView = 0x04,\r
+        ModeBasic = 0x01,\r
+        ModeSearch = 0x02,\r
+        ModeFullView = 0x04,\r
+        ModeHalfView = 0x08,\r
     };\r
     typedef QFlags<Mode> ModeFlags;\r
 \r
@@ -121,6 +125,7 @@ private:
     void copyItems(const QFileInfoList &list, const QString &tgtDir);\r
     void changeFontSize(int diff);\r
     void initBookmark();\r
+    void sendEventOther(QEvent *event);\r
 \r
     // getter\r
     FolderView* otherSideFolderView(const FolderView *view) const;\r
index 53c59c9..e0fb5be 100644 (file)
@@ -45,6 +45,7 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) :
 
     connect(ui->boxClrBg, SIGNAL(clicked()), this, SLOT(selectBoxColor()));
     connect(ui->boxClrFg, SIGNAL(clicked()), this, SLOT(selectBoxColor()));
+    connect(ui->chooseBoxFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
 
     connect(ui->clrBgMark, SIGNAL(clicked()), this, SLOT(selectViewColor()));
     connect(ui->clrBgNormal, SIGNAL(clicked()), this, SLOT(selectViewColor()));
@@ -53,12 +54,13 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) :
     connect(ui->clrFgNormal, SIGNAL(clicked()), this, SLOT(selectViewColor()));
     connect(ui->clrFgReadonly, SIGNAL(clicked()), this, SLOT(selectViewColor()));
     connect(ui->clrFgSystem, SIGNAL(clicked()), this, SLOT(selectViewColor()));
-
-    connect(ui->chooseBoxFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
     connect(ui->chooseViewFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
 
+    connect(ui->enableDarker, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
+
     connect(ui->importAppearance, SIGNAL(clicked()), this, SLOT(importAppearance()));
     connect(ui->exportAppearance, SIGNAL(clicked()), this, SLOT(exportAppearance()));
+
     connect(ui->termBrowse, SIGNAL(clicked()), this, SLOT(browseApp()));
     connect(ui->editorBrowse, SIGNAL(clicked()), this, SLOT(browseApp()));
 
@@ -120,6 +122,8 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) :
 
     //>>>>> 色とフォント、テキストビューア
     loadAppearance(settings, false);
+    ui->enableDarker->setChecked(settings.value(IniKey_EnableDarker).toBool());
+    ui->dark->setValue(settings.value(IniKey_Darkness).toInt());
 
     //>>>>> ファイル操作
     // 確認ダイアログの表示
@@ -359,6 +363,9 @@ void PreferenceDialog::setControlsEnabled(bool enabled)
     else if (sender() == ui->enableViewerIgnoreExt) {
         ui->viewerIgnoreExt->setEnabled(enabled);
     }
+    else if (sender() == ui->enableDarker) {
+        ui->dark->setEnabled(enabled);
+    }
 }
 
 void PreferenceDialog::setIgnoreExtDefault()
@@ -532,6 +539,8 @@ void PreferenceDialog::accept()
 
     //>>>>> 色とフォント
     saveAppearance(settings);
+    settings.setValue(IniKey_EnableDarker, ui->enableDarker->isChecked());
+    settings.setValue(IniKey_Darkness, ui->dark->value());
 
     //>>>>> ファイル操作
     settings.setValue(IniKey_ConfirmCopy, ui->confirmCopy->isChecked());
index b3d9f68..eccefc5 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>617</width>
-    <height>498</height>
+    <width>581</width>
+    <height>584</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -26,7 +26,7 @@
       <enum>Qt::StrongFocus</enum>
      </property>
      <property name="currentIndex">
-      <number>3</number>
+      <number>1</number>
      </property>
      <widget class="QWidget" name="tabBoot_Exit">
       <attribute name="title">
               </item>
               <item>
                <widget class="QSpinBox" name="absoluteWidth">
+                <property name="suffix">
+                 <string> px</string>
+                </property>
                 <property name="maximum">
                  <number>9999</number>
                 </property>
                </widget>
               </item>
-              <item>
-               <widget class="QLabel" name="label_2">
-                <property name="text">
-                 <string>px</string>
-                </property>
-               </widget>
-              </item>
              </layout>
             </item>
             <item row="0" column="2">
               </item>
               <item>
                <widget class="QSpinBox" name="absoluteHeight">
+                <property name="suffix">
+                 <string> px</string>
+                </property>
                 <property name="maximum">
                  <number>9999</number>
                 </property>
                </widget>
               </item>
-              <item>
-               <widget class="QLabel" name="label">
-                <property name="text">
-                 <string>px</string>
-                </property>
-               </widget>
-              </item>
              </layout>
             </item>
             <item row="1" column="0">
               </item>
               <item>
                <widget class="QSpinBox" name="relativeWidth">
+                <property name="suffix">
+                 <string> %</string>
+                </property>
                 <property name="maximum">
                  <number>100</number>
                 </property>
                </widget>
               </item>
               <item>
-               <widget class="QLabel" name="label_6">
-                <property name="text">
-                 <string>%</string>
-                </property>
-               </widget>
-              </item>
-              <item>
                <spacer name="horizontalSpacer_7">
                 <property name="orientation">
                  <enum>Qt::Horizontal</enum>
               </item>
               <item>
                <widget class="QSpinBox" name="relativeHeight">
+                <property name="suffix">
+                 <string> %</string>
+                </property>
+                <property name="prefix">
+                 <string/>
+                </property>
                 <property name="maximum">
                  <number>100</number>
                 </property>
                </widget>
               </item>
               <item>
-               <widget class="QLabel" name="label_8">
-                <property name="text">
-                 <string>%</string>
-                </property>
-               </widget>
-              </item>
-              <item>
                <spacer name="horizontalSpacer_8">
                 <property name="orientation">
                  <enum>Qt::Horizontal</enum>
               </item>
               <item>
                <widget class="QSpinBox" name="absoluteLeft">
+                <property name="suffix">
+                 <string> px</string>
+                </property>
                 <property name="maximum">
                  <number>9999</number>
                 </property>
                </widget>
               </item>
-              <item>
-               <widget class="QLabel" name="label_14">
-                <property name="text">
-                 <string>px</string>
-                </property>
-               </widget>
-              </item>
              </layout>
             </item>
             <item row="0" column="2">
               </item>
               <item>
                <widget class="QSpinBox" name="absoluteTop">
+                <property name="suffix">
+                 <string> px</string>
+                </property>
                 <property name="maximum">
                  <number>9999</number>
                 </property>
                </widget>
               </item>
-              <item>
-               <widget class="QLabel" name="label_16">
-                <property name="text">
-                 <string>px</string>
-                </property>
-               </widget>
-              </item>
              </layout>
             </item>
             <item row="1" column="0">
               </item>
               <item>
                <widget class="QSpinBox" name="relativeLeft">
+                <property name="suffix">
+                 <string> %</string>
+                </property>
                 <property name="maximum">
                  <number>100</number>
                 </property>
                </widget>
               </item>
               <item>
-               <widget class="QLabel" name="label_10">
-                <property name="text">
-                 <string>%</string>
-                </property>
-               </widget>
-              </item>
-              <item>
                <spacer name="horizontalSpacer_5">
                 <property name="orientation">
                  <enum>Qt::Horizontal</enum>
               </item>
               <item>
                <widget class="QSpinBox" name="relativeTop">
+                <property name="suffix">
+                 <string> %</string>
+                </property>
                 <property name="maximum">
                  <number>100</number>
                 </property>
                </widget>
               </item>
               <item>
-               <widget class="QLabel" name="label_12">
-                <property name="text">
-                 <string>%</string>
-                </property>
-               </widget>
-              </item>
-              <item>
                <spacer name="horizontalSpacer_6">
                 <property name="orientation">
                  <enum>Qt::Horizontal</enum>
       <attribute name="title">
        <string>色とフォント</string>
       </attribute>
-      <layout class="QVBoxLayout" name="verticalLayout_6">
-       <property name="spacing">
-        <number>4</number>
-       </property>
-       <property name="leftMargin">
-        <number>4</number>
-       </property>
-       <property name="topMargin">
-        <number>4</number>
-       </property>
-       <property name="rightMargin">
-        <number>4</number>
-       </property>
-       <property name="bottomMargin">
-        <number>4</number>
-       </property>
+      <layout class="QVBoxLayout" name="verticalLayout_4">
        <item>
         <widget class="QGroupBox" name="groupBox">
          <property name="title">
         </widget>
        </item>
        <item>
+        <widget class="QGroupBox" name="enableDarker">
+         <property name="title">
+          <string>非アクティブパネルの色を暗くする</string>
+         </property>
+         <property name="flat">
+          <bool>false</bool>
+         </property>
+         <property name="checkable">
+          <bool>true</bool>
+         </property>
+         <layout class="QHBoxLayout" name="horizontalLayout_11">
+          <item>
+           <widget class="QLabel" name="label_18">
+            <property name="text">
+             <string>暗さ(0〜100)</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QSpinBox" name="dark">
+            <property name="prefix">
+             <string/>
+            </property>
+            <property name="maximum">
+             <number>100</number>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <spacer name="horizontalSpacer_2">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>40</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
         <layout class="QHBoxLayout" name="horizontalLayout_28">
          <property name="spacing">
           <number>4</number>
@@ -1996,8 +1997,8 @@ ABCDEFGHIJKLMNOPQRSTUVWXYZ
   </connection>
  </connections>
  <buttongroups>
-  <buttongroup name="overwriteOptions"/>
-  <buttongroup name="sizeOptions"/>
   <buttongroup name="posOptions"/>
+  <buttongroup name="sizeOptions"/>
+  <buttongroup name="overwriteOptions"/>
  </buttongroups>
 </ui>
index 142cb11..4978785 100644 (file)
@@ -240,6 +240,10 @@ void SimpleImageView::keyPressEvent(QKeyEvent *event)
     }
 
     QGraphicsView::keyReleaseEvent(event);
+    if (IsKeyUpDown(event)) {
+        event->accept();
+        return;
+    }
 
     // MainWindowへ
     event->ignore();
index 6b79ed6..deadb64 100644 (file)
@@ -8,17 +8,53 @@
 #include <QShortcut>
 #include <QTextCodec>
 #include <QStatusBar>
-
+#include <QApplication>
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief KeyEventToSequence
+/// \param event キーイベントオブジェクト
+/// \return キーシーケンスの文字列(Ctrl+C等)
+///
+/// キーイベントで押されているキーをキーシーケンス文字列に変換します
+///
 QString KeyEventToSequence(const 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();
-    return QKeySequence(modifier + key).toString();
+
+    return modifier + key;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief IsKeyUpDown
+/// \param event キーイベントオブジェクト
+/// \return (Up/Down/Home/End)+(!Shift)の場合true
+///
+/// カーソル移動系のキーが押されたかを判定します
+///
+bool IsKeyUpDown(const QKeyEvent *event)
+{
+    QString ksq = KeyEventToSequence(event);
+
+    switch (event->key()) {
+    case Qt::Key_Up:
+    case Qt::Key_Down:
+    case Qt::Key_Home:
+    case Qt::Key_End:
+        if (event->modifiers() & Qt::ShiftModifier) {
+            return false;
+        }
+        else {
+            return true;
+        }
+    }
+    return false;
 }
 
 SimpleTextView::SimpleTextView(QWidget *parent) :
@@ -56,13 +92,13 @@ SimpleTextView::SimpleTextView(QWidget *parent) :
     m_copy->setObjectName("copy");
     m_back->setObjectName("back");
 
-    m_convEUC->setShortcut(QKeySequence("Shift+E"));
-    m_convJIS->setShortcut(QKeySequence("Shift+J"));
-    m_convSJIS->setShortcut(QKeySequence("Shift+S"));
-    m_convUTF8->setShortcut(QKeySequence("Shift+U"));
-    m_convUTF16->setShortcut(QKeySequence("Shift+I"));
-    m_convUTF16BE->setShortcut(QKeySequence("Shift+O"));
-    m_convUTF16LE->setShortcut(QKeySequence("Shift+P"));
+    m_convEUC->setShortcut(QKeySequence("Ctrl+E"));
+    m_convJIS->setShortcut(QKeySequence("Ctrl+J"));
+    m_convSJIS->setShortcut(QKeySequence("Ctrl+S"));
+    m_convUTF8->setShortcut(QKeySequence("Ctrl+U"));
+    m_convUTF16->setShortcut(QKeySequence("Ctrl+I"));
+    m_convUTF16BE->setShortcut(QKeySequence("Ctrl+O"));
+    m_convUTF16LE->setShortcut(QKeySequence("Ctrl+P"));
     m_copy->setShortcut(QKeySequence::Copy);
 
     QList<QKeySequence> shortcuts;
@@ -192,6 +228,10 @@ void SimpleTextView::keyPressEvent(QKeyEvent *event)
     }
 
     QPlainTextEdit::keyPressEvent(event);
+    if (IsKeyUpDown(event)) {
+        event->accept();
+        return;
+    }
 
     // MainWindowへ
     event->ignore();