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 \
* SNS連携(タイムライン表示とか) ← ファイラーの機能か?
#### Ver0.19
+ * 非アクティブパネルの色を暗くするオプションを追加。
* 不具合修正
* 一部のショートカットキーが効いていなかったのを修正。
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 *)
{
FolderPanel* folderPanel() const;
SimpleImageView* imageView() const;
SimpleTextView* textView() const;
+ QWidget* visibleView() const;
private:
Ui::AnyView *ui;
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
#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
m_HiddenBrush(),\r
m_ReadonlyBrush()\r
{\r
+ m_fsWatcher = new QFileSystemWatcher(this);\r
+\r
// デフォルトフィルタを設定する\r
setFilter(QDir::NoDot | QDir::AllDirs | QDir::Files);\r
}\r
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
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
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
delete ui;
}
-void FolderPanel::initialize(MainWindow *mainWnd)
+void FolderPanel::initialize(MainWindow *mainWnd, bool left)
{
qDebug() << "FolderPanel::initialize();";
m_mainWnd = 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
explicit FolderPanel(QWidget *parent = 0);
~FolderPanel();
- void initialize(MainWindow *mainWnd);
+ void initialize(MainWindow *mainWnd, bool left);
// getter
LocationBox* locationBox() const;
#include "common.h"
#include "mainwindow.h"
+#include "folderpanel.h"
+#include "locationbox.h"
#include "folderview.h"
#include <QDebug>
}
}
-void FolderView::initialize(MainWindow *mainWnd)
+void FolderView::initialize(MainWindow *mainWnd, bool left)
{
qDebug() << side() << "initialize";
setPath(settings.value(side() + slash + IniKey_Dir).toString(), true);
// 色とフォントを設定する
- updateAppearance();
+ updateAppearance(!left);
// 列のリサイズモードを設定する
QHeaderView *header;
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);
// 行の高さを設定する
{
qDebug() << side() << "keyPressEvent";
- QTableView::keyPressEvent(event);
+ if (IsKeyUpDown(event)) {
+ QTableView::keyPressEvent(event);
+ event->accept();
+ return;
+ }
// MainWindowへ
event->ignore();
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);
+}
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);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
+ void focusInEvent(QFocusEvent *event);
+ void focusOutEvent(QFocusEvent *event);
};
#endif // FOLDERVIEW_H
{
}
-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>());
public:
explicit LocationBox(QWidget *parent = 0);
- void initialize();
- void updateAppearance();
+ void initialize(bool left);
+ void updateAppearance(bool darker = false);
signals:
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
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
}\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
\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
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
\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
void createFolder();\r
void cursorDown();\r
void cursorUp();\r
+ void cursorDownOther();\r
+ void cursorUpOther();\r
void deleteItems();\r
void editBookmark();\r
void executeCommand();\r
void searchPrev();\r
void setCursorToBegin();\r
void setCursorToEnd();\r
+ void setCursorToBeginOther();\r
+ void setCursorToEndOther();\r
void setFontSizeDown();\r
void setFontSizeUp();\r
void setPathFromOther();\r
\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
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
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()));
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()));
//>>>>> 色とフォント、テキストビューア
loadAppearance(settings, false);
+ ui->enableDarker->setChecked(settings.value(IniKey_EnableDarker).toBool());
+ ui->dark->setValue(settings.value(IniKey_Darkness).toInt());
//>>>>> ファイル操作
// 確認ダイアログの表示
else if (sender() == ui->enableViewerIgnoreExt) {
ui->viewerIgnoreExt->setEnabled(enabled);
}
+ else if (sender() == ui->enableDarker) {
+ ui->dark->setEnabled(enabled);
+ }
}
void PreferenceDialog::setIgnoreExtDefault()
//>>>>> 色とフォント
saveAppearance(settings);
+ settings.setValue(IniKey_EnableDarker, ui->enableDarker->isChecked());
+ settings.setValue(IniKey_Darkness, ui->dark->value());
//>>>>> ファイル操作
settings.setValue(IniKey_ConfirmCopy, ui->confirmCopy->isChecked());
<rect>
<x>0</x>
<y>0</y>
- <width>617</width>
- <height>498</height>
+ <width>581</width>
+ <height>584</height>
</rect>
</property>
<property name="sizePolicy">
<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>
</connection>
</connections>
<buttongroups>
- <buttongroup name="overwriteOptions"/>
- <buttongroup name="sizeOptions"/>
<buttongroup name="posOptions"/>
+ <buttongroup name="sizeOptions"/>
+ <buttongroup name="overwriteOptions"/>
</buttongroups>
</ui>
}
QGraphicsView::keyReleaseEvent(event);
+ if (IsKeyUpDown(event)) {
+ event->accept();
+ return;
+ }
// MainWindowへ
event->ignore();
#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) :
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;
}
QPlainTextEdit::keyPressEvent(event);
+ if (IsKeyUpDown(event)) {
+ event->accept();
+ return;
+ }
// MainWindowへ
event->ignore();