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
SOURCES += main.cpp\
* 簡易FTPクライアント
* SNS連携(タイムライン表示とか) ← ファイラーの機能か?
+#### 2014/08/29 Ver0.16
+ * 設定ファイルの格納先を変更。
+ * 「片面ビューアモード」を「プレビューモード」に呼称変更。
+ 合わせて、キーバインドを「P」に変更。
+ * 画像ビューアの背景色をフォルダビューと同一にした。
+ * ".."に対するコピー・移動・削除・リネームを禁止とした。
+ * リネーム時、変更後のファイルにカーソルを合わせるようにした。
+ * 移動・削除時、カーソル位置(行)を維持するようにした。
+ * ファイル・フォルダの作成時、作成したアイテムにカーソルを合わせるようにした。
+ * ツールバーのサイズを大きくした。
+ * デフォルトフォントをMSゴシック(Win)/Monaco(Mac)にした。
+ * 不具合修正
+ * スペースキーでのマークが正常に行われないケースがあったのを修正。
+
#### 2014/08/28 Ver0.15
* 簡易画像ビューアを実装。
* 外部アプリを優先する拡張子のデフォルトから、対応画像フォーマットの拡張子を削除。
else if (row >= m_model.rowCount()) {
row = m_model.rowCount() - 1;
}
- setCurrentIndex(m_model.index(row, 0));
- selectRow(row);
+ setCurrentIndex(m_model.index(row, 1));
+// selectRow(row);
}
void FolderView::searchItem(const QString &text)
qDebug() << side() << "searchItem" << text;
for (int row = 0; row < m_model.rowCount(); row++) {
- QModelIndex index = m_model.index(row, 0);
+ QModelIndex index = m_model.index(row, 1);
QString name = m_model.fileInfo(index).fileName().toLower();
if (name.indexOf(text.toLower()) != -1) {
setCurrentIndex(index);
qDebug() << side() << "searchNext" << text;
for (int row = currentIndex().row() + 1; row < m_model.rowCount(); row++) {
- QModelIndex index = m_model.index(row, 0);
+ QModelIndex index = m_model.index(row, 1);
QString name = m_model.fileInfo(index).fileName().toLower();
if (name.indexOf(text.toLower()) != -1) {
setCurrentIndex(index);
qDebug() << side() << "searchPrev" << text;
for (int row = currentIndex().row() - 1; row >= 0; row--) {
- QModelIndex index = m_model.index(row, 0);
+ QModelIndex index = m_model.index(row, 1);
QString name = m_model.fileInfo(index).fileName().toLower();
if (name.indexOf(text.toLower()) != -1) {
setCurrentIndex(index);
setUpdatesEnabled(false);
for (int n = 0; n < m_model.rowCount(); n++) {
- QModelIndex index = m_model.index(n, 0);
+ QModelIndex index = m_model.index(n, 1);
QFileInfo info = m_model.fileInfo(index);
if (info.isDir()) {
m_model.setCheckState(index, Qt::Unchecked);
setUpdatesEnabled(false);
for (int n = 0; n < m_model.rowCount(); n++) {
- QModelIndex index = m_model.index(n, 0);
+ QModelIndex index = m_model.index(n, 1);
if (m_model.checkState(index) == Qt::Checked) {
m_model.setCheckState(index, Qt::Unchecked);
}
void FolderView::toggleCheckState(const QModelIndex &index)
{
+ qDebug() << side() << "toggleCheckState();" << index;
+
QFileInfo info = m_model.fileInfo(index);
if (info.fileName() != "..") {
if (m_model.checkState(index) == Qt::Checked) {
setUpdatesEnabled(false);
m_model.setPath(path);
- setCurrentIndex(m_model.index(0, 0));
+ setCurrentIndex(m_model.index(0, 1));
setUpdatesEnabled(true);
if (addHistory) {
void FolderView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
{
- qDebug() << side() << "currentChanged();";
+ qDebug() << side() << "currentChanged();" << current;
emit currentChanged(m_model.fileInfo(current));
||L ||最新の情報に更新 || || || ||Load ||
||M ||開く ||アプリケーションで開く || ||隣のペインにアイテムを移動 ||viのキーバインド, Move ||
||O ||隣のパネルと同じフォルダを表示 ||隣のパネルに同じフォルダを表示 || || ||Onaji(同じ) ||
+||P ||プレビューモードに切り替え/解除 || || || ||Preview ||
||Q ||終了 || || || ||Quit ||
||R ||履歴を表示 || || ||名前の変更 ||Rireki, Rename ||
||S ||ソート方法を選択 ||システムファイルを表示/非表示 || || ||Sort, System ||
int main(int argc, char *argv[])\r
{\r
QApplication a(argc, argv);\r
- a.setOrganizationName("miyabi");\r
- a.setOrganizationDomain("rakusaba.jp");\r
+ a.setOrganizationName("gefu");\r
+ a.setOrganizationDomain("sourceforge.jp");\r
a.setApplicationName("Gefu");\r
#if defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACX)\r
a.setWindowIcon(QIcon(":/images/Gefu.icns"));\r
settings.clear();\r
}\r
\r
- // オラはやっちまっただぁ…\r
- QString strValue = settings.value("TerminalOption", "").toString();\r
- if (!strValue.isEmpty()) {\r
- settings.remove("TerminalOption");\r
- settings.setValue(IniKey_TerminalOption, strValue);\r
- }\r
-\r
// 各オプションのデフォルト値を設定する\r
+ QFont font = a.font();\r
+#ifdef Q_OS_WIN\r
+ font.setFamily("MS ゴシック");\r
+#else\r
+ font.setFamily("Monaco");\r
+#endif\r
//>>>>> 起動と終了\r
if (settings.value(IniKey_ConfirmExit, "").toString().isEmpty()) {\r
settings.setValue(IniKey_ConfirmExit, true);\r
}\r
//>>>>> 色とフォント\r
if (settings.value(IniKey_BoxFont, "").toString().isEmpty()) {\r
- settings.setValue(IniKey_BoxFont, a.font());\r
+ settings.setValue(IniKey_BoxFont, font);\r
settings.setValue(IniKey_BoxColorBg, QPalette().base().color());\r
settings.setValue(IniKey_BoxColorFg, QPalette().text().color());\r
}\r
if (settings.value(IniKey_ViewFont, "").toString().isEmpty()) {\r
- settings.setValue(IniKey_ViewFont, a.font());\r
+ settings.setValue(IniKey_ViewFont, font);\r
settings.setValue(IniKey_ViewColorBgMark, QColor(0,192,0));\r
settings.setValue(IniKey_ViewColorBgNormal, QPalette().base().color());\r
settings.setValue(IniKey_ViewColorFgHidden, QColor(128,128,128));\r
if (settings.value(IniKey_ViewerFont, "").toString().isEmpty()) {\r
settings.setValue(IniKey_ViewerColorBg, QPalette().base().color());\r
settings.setValue(IniKey_ViewerColorFg, QPalette().text().color());\r
- settings.setValue(IniKey_ViewerFont, a.font());\r
+ settings.setValue(IniKey_ViewerFont, font);\r
settings.setValue(IniKey_ViewerForceOpen, false);\r
settings.setValue(IniKey_ViewerInherit, true);\r
settings.setValue(IniKey_ViewerIgnoreExt, ViewerIgnoreExt());\r
opDlg.setWorker(worker);\r
opDlg.setAutoClose(settings.value(IniKey_AutoCloseMove).toBool());\r
\r
+ int row = view->currentIndex().row();\r
+\r
opDlg.exec();\r
\r
- settings.setValue(IniKey_AutoCloseMove, opDlg.autoClose());\r
+ if (row >= view->model()->rowCount()) {\r
+ row = view->model()->rowCount() - 1;\r
+ }\r
+ //view->selectRow(row);\r
+ view->setCurrentIndex(view->model()->index(row, 1));\r
\r
- // 念のため、リフレッシュ\r
-// ui->folderView1->refresh();\r
-// ui->folderView2->refresh();\r
+ settings.setValue(IniKey_AutoCloseMove, opDlg.autoClose());\r
}\r
\r
void MainWindow::leftKeyPress()\r
opDlg.exec();\r
\r
settings.setValue(IniKey_AutoCloseCopy, opDlg.autoClose());\r
-\r
- // 念のため、リフレッシュ\r
-// ui->folderView1->refresh();\r
-// ui->folderView2->refresh();\r
}\r
\r
void MainWindow::copyItems()\r
if (settings.value(IniKey_OpenAfterCreateFile).toBool()) {\r
openEditor(dir.absoluteFilePath(name));\r
}\r
+\r
+ view->refresh();\r
+ view->searchItem(name);\r
}\r
}\r
\r
if (settings.value(IniKey_MoveAfterCreateFolder).toBool()) {\r
view->setPath(dir.absoluteFilePath(name), true);\r
}\r
+\r
+ view->refresh();\r
+ view->searchItem(name);\r
}\r
}\r
\r
opDlg.setWorker(worker);\r
opDlg.setAutoClose(settings.value(IniKey_AutoCloseDelete).toBool());\r
\r
+ int row = view->currentIndex().row();\r
+\r
opDlg.exec();\r
+ view->refresh();\r
\r
- settings.setValue(IniKey_AutoCloseDelete, opDlg.autoClose());\r
+ if (row >= view->model()->rowCount()) {\r
+ row = view->model()->rowCount() - 1;\r
+ }\r
+// view->selectRow(row);\r
+ view->setCurrentIndex(view->model()->index(row, 1));\r
\r
- // 念のため、リフレッシュ\r
-// ui->folderView1->refresh();\r
-// ui->folderView2->refresh();\r
+ settings.setValue(IniKey_AutoCloseDelete, opDlg.autoClose());\r
}\r
\r
void MainWindow::open(const QModelIndex &index)\r
if (!startProcess(command, info.absolutePath(), tr("外部エディタの起動に失敗しました。"))) {\r
break;\r
}\r
- Sleep(100);\r
}\r
}\r
\r
if (!startProcess(command, info.absolutePath(), tr("ターミナルの起動に失敗しました。"))) {\r
break;\r
}\r
- Sleep(100);\r
+ Sleep(1000);\r
}\r
}\r
\r
opDlg.setAutoClose(settings.value(IniKey_AutoCloseRename).toBool());\r
\r
opDlg.exec();\r
+ view->refresh();\r
+\r
+ QFileInfo info(dlg->renameMap().first());\r
+ view->searchItem(info.fileName());\r
\r
settings.setValue(IniKey_AutoCloseRename, opDlg.autoClose());\r
}\r
\r
if (dlg.exec() == QDialog::Accepted) {\r
static_cast<FolderPanel*>(view->parent())->setNameFilters(dlg.textValue());\r
+ int row = view->currentIndex().row();\r
+\r
view->refresh();\r
+\r
+ if (row >= view->model()->rowCount()) {\r
+ row = view->model()->rowCount() - 1;\r
+ }\r
+// view->selectRow(row);\r
+ view->setCurrentIndex(view->model()->index(row, 1));\r
+\r
}\r
}\r
\r
}\r
}\r
\r
-//void MainWindow::openRequest(const QFileInfo &info)\r
-//{\r
-// m_focusedView = QApplication::focusWidget();\r
-\r
-// QFile file(info.absoluteFilePath());\r
-// if (file.open(QIODevice::ReadOnly)) {\r
-// ui->splitter->setVisible(false);\r
-// ui->textView->setVisible(true);\r
-// ui->textView->setFocus();\r
-// ui->textView->setSource(file.readAll());\r
-// file.close();\r
-// }\r
-// else {\r
-// QMessageBox::critical(\r
-// this, tr("エラー"),\r
-// tr("ファイルの読み込みに失敗しました。"));\r
-// }\r
-//}\r
-\r
void MainWindow::showPreferenceDialog()\r
{\r
qDebug() << "MainWindow::showPreferenceDialog";\r
FolderView *view;\r
if ((view = qobject_cast<FolderView*>(w))) {\r
setEnabledAllActions(true);\r
+ qDebug() << ">>>>> フォルダビューの共通メニュー設定 <<<<<";\r
ui->action_SearchNext->setEnabled(false);\r
ui->action_SearchPrev->setEnabled(false);\r
\r
}\r
}\r
\r
+ if (info.fileName() == "..") {\r
+ // ファイル操作を抑止\r
+ ui->cmd_Copy->setEnabled(false);\r
+ ui->cmd_Delete->setEnabled(false);\r
+ ui->cmd_Move->setEnabled(false);\r
+ ui->cmd_Rename->setEnabled(false);\r
+ }\r
+\r
if (m_viewMode & ModeBasic) {\r
qDebug() << ">>>>> 通常モードのメニュー設定 <<<<<";\r
ui->action_SearchNext->setEnabled(false);\r
</property>\r
<property name="iconSize">\r
<size>\r
- <width>16</width>\r
- <height>16</height>\r
+ <width>24</width>\r
+ <height>24</height>\r
</size>\r
</property>\r
<attribute name="toolBarArea">\r
<addaction name="move_Forward"/>\r
<addaction name="move_Root"/>\r
<addaction name="move_Home"/>\r
- <addaction name="move_Jump"/>\r
<addaction name="separator"/>\r
+ <addaction name="move_Jump"/>\r
<addaction name="cmd_Copy"/>\r
<addaction name="cmd_Move"/>\r
<addaction name="cmd_Delete"/>\r
<normaloff>:/images/Preview.png</normaloff>:/images/Preview.png</iconset>\r
</property>\r
<property name="text">\r
- <string>片面ビューアモード</string>\r
+ <string>プレビューモード</string>\r
</property>\r
<property name="toolTip">\r
- <string>片面ビューアモード</string>\r
+ <string>プレビューモード</string>\r
</property>\r
<property name="shortcut">\r
- <string>V</string>\r
+ <string>P</string>\r
</property>\r
</action>\r
</widget>\r
#include <QKeyEvent>
#include <QAction>
#include <QMenu>
+#include <QSettings>
SimpleImageView::SimpleImageView(QWidget *parent) :
QGraphicsView(parent),
{
qDebug() << "SimpleImageView::setSource()";
- m_img = QImage(path);
+ m_img = QPixmap(path);
emit fileInfo(QString("%1x%2x%3bpp")
.arg(m_img.width())
qDebug() << "SimpleImageView::paintEvent();";
QPainter painter(viewport());
- QImage scaledImg;
+ QPixmap scaledImg;
if (m_img.width() < viewport()->width() &&
m_img.height() < viewport()->height())
Qt::SmoothTransformation);
}
- painter.drawImage(
+ QSettings settings;
+ painter.setBrush(settings.value(IniKey_ViewColorBgNormal).value<QColor>());
+ painter.drawRect(viewport()->rect());
+ painter.drawPixmap(
(viewport()->width() - scaledImg.width()) / 2,
(viewport()->height() - scaledImg.height()) / 2,
scaledImg);
bool setSource(const QString &path);
private:
- QImage m_img;
+ QPixmap m_img;
QAction *m_back;
signals:
public slots:
void back();
-
// QWidget interface
protected:
void paintEvent(QPaintEvent *);
void SimpleTextView::setSource(const QByteArray &source)
{
m_source = source;
+ if (m_source.size() == 0) {
+ setPlainText("");
+ emit fileInfo("");
+ return;
+ }
std::string code = detectCode(m_source.left(1024));
QTextCodec *codec = QTextCodec::codecForName(code.c_str());
#ifndef VERSION_H
#define VERSION_H
-#define VERSION_VALUE 0.15
+#define VERSION_VALUE 0.16
#endif // VERSION_H