OSDN Git Service

内蔵テキストビューアの行間を設定できるようにした
authorMasayuki Satoh <miyabi.satoh@gmail.com>
Mon, 22 Sep 2014 07:24:32 +0000 (16:24 +0900)
committerMasayuki Satoh <miyabi.satoh@gmail.com>
Mon, 22 Sep 2014 07:24:32 +0000 (16:24 +0900)
26 files changed:
README.md
ReadMe.txt
abstractworker.cpp
bookmarkdialog.cpp
copymoveworker.cpp
deleteworker.cpp
filereadworker.cpp
filereadworker.h
foldermodel.cpp
foldermodel.h
folderview.cpp
global.cpp
hexview.cpp
hexview.h
historydialog.cpp
imageview.cpp
mainwindow.cpp
operationdialog.cpp
operationdialog.h
panel.cpp
preferencedialog.cpp
preferencedialog.ui
preferences.cpp
preferences.h
textview.cpp
thumbnailworker.cpp

index d74a9e4..8ec7e45 100644 (file)
--- a/README.md
+++ b/README.md
@@ -8,6 +8,9 @@ Gefu is an Experimental File Utility.
   * 内蔵バイナリビューアを実装しました。
   * 内蔵イメージビューアを自前描画に変更しました。
   * 内蔵テキストビューアを自前描画に変更しました。
+  * 環境設定ダイアログに項目を追加しました。
+    * 内蔵テキストビューアの「制御文字」追加。
+    * 内蔵テキストビューアの「行の高さ」追加。
 
 #### 2014/09/16 Ver0.24
   * ツールバーの表示/非表示を切り替えられるようにしました。
index c4cf98a..99493af 100644 (file)
   * 内蔵バイナリビューアを実装しました。\r
   * 内蔵イメージビューアを自前描画に変更しました。\r
   * 内蔵テキストビューアを自前描画に変更しました。\r
+  * 環境設定ダイアログに項目を追加しました。\r
+    * 内蔵テキストビューアの「制御文字」追加。\r
+    * 内蔵テキストビューアの「行の高さ」追加。\r
 \r
 #### 2014/09/16 Ver 0.24\r
   * ツールバーの表示/非表示を切り替えられるようにしました。\r
index cc28426..6e0d86c 100644 (file)
@@ -2,6 +2,11 @@
 \r
 #include <QThread>\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief AbstractWorker::AbstractWorker\r
+///\r
+/// コンストラクタ\r
+///\r
 AbstractWorker::AbstractWorker() :\r
     QObject(),\r
     m_mutex(),\r
@@ -14,18 +19,32 @@ AbstractWorker::AbstractWorker() :
     connect(m_thread, SIGNAL(finished()), m_thread, SLOT(deleteLater()));\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief AbstractWorker::abort\r
+///\r
+/// 処理を中止します\r
+///\r
 void AbstractWorker::abort()\r
 {\r
     QMutexLocker lock(&m_mutex);\r
     m_abort = true;\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief AbstractWorker::start\r
+///\r
+/// ワーカースレッドを開始します。\r
+///\r
 void AbstractWorker::start()\r
 {\r
     this->moveToThread(m_thread);\r
     m_thread->start();\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief AbstractWorker::isAborted\r
+/// \return 中止要求されていればtrueを返します。\r
+///\r
 bool AbstractWorker::isAborted()\r
 {\r
     QMutexLocker lock(&m_mutex);\r
index 59e714b..0adc8ca 100644 (file)
@@ -7,6 +7,12 @@
 #include <QFileInfo>
 #include <QMessageBox>
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::BookmarkDialog
+/// \param parent   親ウィジェット
+///
+/// コンストラクタ
+///
 BookmarkDialog::BookmarkDialog(QWidget *parent) :
     QDialog(parent),
     ui(new Ui::BookmarkDialog),
@@ -18,11 +24,20 @@ BookmarkDialog::BookmarkDialog(QWidget *parent) :
     ui->tableWidget->setColumnCount(2);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::~BookmarkDialog
+///
+/// デストラクタ
+///
 BookmarkDialog::~BookmarkDialog()
 {
     delete ui;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::setEditMode
+/// \param edit 編集モードの場合はtrue
+///
 void BookmarkDialog::setEditMode(bool edit)
 {
     ui->buttonAdd->setVisible(edit);
@@ -52,11 +67,23 @@ void BookmarkDialog::setEditMode(bool edit)
     ui->tableWidget->setCurrentCell(0, 0);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::selectedIndex
+/// \return 現在の行番号
+///
 int BookmarkDialog::selectedIndex() const
 {
     return ui->tableWidget->currentRow();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::insertData
+/// \param row  行番号
+/// \param name 名前
+/// \param path パス
+///
+/// テーブルウィジェットにデータを追加します。
+///
 void BookmarkDialog::insertData(int row, const QString &name, const QString &path)
 {
     ui->tableWidget->insertRow(row);
@@ -72,13 +99,18 @@ void BookmarkDialog::insertData(int row, const QString &name, const QString &pat
     ui->tableWidget->setItem(row, 1, iPath);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::moveSelectedRows
+/// \param up   上げる場合はtrue, 下げる場合はfalse
+///
+/// 選択行を上または下に移動します。
+///
 void BookmarkDialog::moveSelectedRows(bool up)
 {
     qDebug() << "BookmarkDialog::moveSelectedRows();" << up;
 
     QList<QTableWidgetItem*> selected = ui->tableWidget->selectedItems();
     if (selected.isEmpty()) {
-        qDebug() << "Not selected.";
         return;
     }
 
@@ -90,7 +122,6 @@ void BookmarkDialog::moveSelectedRows(bool up)
         QString path = ui->tableWidget->item(i, 1)->data(Qt::DisplayRole).toString();
         before << name + "¥t" + path;
     }
-    qDebug() << "set before" << before;
 
     after.resize(before.size());
 
@@ -111,7 +142,6 @@ void BookmarkDialog::moveSelectedRows(bool up)
         }
     }
 
-    qDebug() << "set after(1)" << after;
     int n = 0;
     for (int i = 0; i < ui->tableWidget->rowCount(); i++) {
         if (!before[i].isEmpty()) {
@@ -121,7 +151,6 @@ void BookmarkDialog::moveSelectedRows(bool up)
             after[n] = before[i];
         }
     }
-    qDebug() << "set after(2)" << after;
 
     while (ui->tableWidget->rowCount() > 0) {
         ui->tableWidget->removeRow(0);
@@ -146,6 +175,11 @@ void BookmarkDialog::moveSelectedRows(bool up)
 
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::accept
+///
+/// OKボタンクリック時の処理を行います。
+///
 void BookmarkDialog::accept()
 {
     Preferences prefs(this);
@@ -171,6 +205,11 @@ void BookmarkDialog::accept()
     QDialog::accept();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::on_buttonDelete_clicked
+///
+/// 削除ボタンクリック時の処理を行います。
+///
 void BookmarkDialog::on_buttonDelete_clicked()
 {
     foreach (const QTableWidgetItem *item, ui->tableWidget->selectedItems()) {
@@ -180,16 +219,31 @@ void BookmarkDialog::on_buttonDelete_clicked()
     }
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::on_buttonUp_clicked
+///
+/// ↑ボタンクリック時の処理を行います。
+///
 void BookmarkDialog::on_buttonUp_clicked()
 {
     moveSelectedRows(true);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::on_buttonDown_clicked
+///
+/// ↓ボタンクリック時の処理を行います。
+///
 void BookmarkDialog::on_buttonDown_clicked()
 {
     moveSelectedRows(false);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::on_buttonAdd_clicked
+///
+/// 追加ボタンクリック時の処理を行います。
+///
 void BookmarkDialog::on_buttonAdd_clicked()
 {
     static QString initPath = QDir::homePath();
@@ -197,8 +251,7 @@ void BookmarkDialog::on_buttonAdd_clicked()
     QString path = QFileDialog::getExistingDirectory(
                 this, tr("フォルダを選択"), initPath);
     if (!path.isEmpty()) {
-        QFileInfo info(path);
-        QString name(info.fileName());
+        QString name(QFileInfo(path).fileName());
         if (name.isEmpty()) {
             name = "root";
         }
index 8031076..fd37d09 100644 (file)
@@ -8,6 +8,11 @@
 \r
 const int SLEEP_TIME = 1;\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief CopyMoveWorker::CopyMoveWorker\r
+///\r
+/// コンストラクタ\r
+///\r
 CopyMoveWorker::CopyMoveWorker() :\r
     OperationWorker(),\r
     m_CopyList(),\r
@@ -19,6 +24,13 @@ CopyMoveWorker::CopyMoveWorker() :
 {\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief CopyMoveWorker::Listup\r
+/// \param srcPath  コピー(移動)元パス\r
+/// \param tgtPath  コピー(移動)先パス\r
+///\r
+/// コピー(移動)対象をリストアップします。(再帰)\r
+///\r
 void CopyMoveWorker::Listup(const QString &srcPath, const QString &tgtPath)\r
 {\r
     if (isAborted()) {\r
@@ -50,6 +62,8 @@ void CopyMoveWorker::Listup(const QString &srcPath, const QString &tgtPath)
 ///////////////////////////////////////////////////////////////////////////////\r
 /// \brief CopyMoveWorker::run\r
 ///\r
+/// コピー(移動)を実行します。\r
+///\r
 void CopyMoveWorker::run()\r
 {\r
     foreach (const QString &path, m_CopyList) {\r
@@ -215,6 +229,10 @@ void CopyMoveWorker::run()
     emit finished();\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief CopyMoveWorker::initialText\r
+/// \return 初期表示テキストを返します。\r
+///\r
 QString CopyMoveWorker::initialText() const\r
 {\r
     if (m_Move) {\r
index 2e96cd8..fd732fb 100644 (file)
@@ -7,6 +7,11 @@
 \r
 const int SLEEP_TIME = 1;\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief DeleteWorker::DeleteWorker\r
+///\r
+/// コンストラクタ\r
+///\r
 DeleteWorker::DeleteWorker() :\r
     OperationWorker(),\r
     m_DeleteList(),\r
@@ -14,6 +19,12 @@ DeleteWorker::DeleteWorker() :
 {\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief DeleteWorker::Listup\r
+/// \param path 削除するパス\r
+///\r
+/// 削除対象をリストアップします。(再帰)\r
+///\r
 void DeleteWorker::Listup(const QString &path)\r
 {\r
     if (isAborted()) {\r
@@ -37,7 +48,11 @@ void DeleteWorker::Listup(const QString &path)
     m_Targets << path;\r
 }\r
 \r
-\r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief DeleteWorker::run\r
+///\r
+/// 削除を実行します。\r
+///\r
 void DeleteWorker::run()\r
 {\r
     foreach (const QFileInfo &info, m_DeleteList) {\r
@@ -89,6 +104,10 @@ void DeleteWorker::run()
     emit finished();\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief DeleteWorker::initialText\r
+/// \return 初期表示テキストを返します。\r
+///\r
 QString DeleteWorker::initialText() const\r
 {\r
     return tr("削除準備中...");\r
index cdd1393..1bb789b 100644 (file)
@@ -3,23 +3,35 @@
 #include <QDebug>
 #include <QThread>
 
+const int BUFFER_SIZE = 4096;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief FileReadWorker::FileReadWorker
+///
+/// コンストラクタ
+///
 FileReadWorker::FileReadWorker() :
     AbstractWorker(),
     m_file()
 {
 }
 
-FileReadWorker::~FileReadWorker()
-{
-    qDebug() << "FileReadWorker::~FileReadWorker()---------------------------";
-}
-
+///////////////////////////////////////////////////////////////////////////////
+/// \brief FileReadWorker::open
+/// \param path ファイルパス
+/// \return ファイルオープンに成功した場合はtrueを返します。
+///
 bool FileReadWorker::open(const QString &path)
 {
     m_file.setFileName(path);
     return m_file.open(QIODevice::ReadOnly);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief FileReadWorker::run
+///
+/// ファイル読込を実行します。
+///
 void FileReadWorker::run()
 {
     if (!m_file.isOpen()) {
@@ -38,7 +50,7 @@ void FileReadWorker::run()
             return;
         }
 
-        data.append(m_file.read(2048));
+        data.append(m_file.read(BUFFER_SIZE));
         emit progress(data.size());
     }
 
index 2487c14..8901341 100644 (file)
@@ -10,7 +10,6 @@ class FileReadWorker : public AbstractWorker
     Q_OBJECT
 public:
     explicit FileReadWorker();
-    ~FileReadWorker();
 
     bool    open(const QString &path);
 
index 36d031a..ccbf9ee 100644 (file)
@@ -60,9 +60,6 @@ FolderModel::~FolderModel()
 void FolderModel::clearPixmapCache()\r
 {\r
     beginResetModel();\r
-//    m_pixmapCacheMutex.lock();\r
-//    m_pixmapCache.clear();\r
-//    m_pixmapCacheMutex.unlock();\r
     endResetModel();\r
 }\r
 \r
@@ -484,18 +481,34 @@ void FolderModel::thumbnail_Ready(const QString &path, const QPixmap &pixmap)
     }\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief FolderModel::rowCount\r
+/// \param parent   (使用しません)\r
+/// \return 行数を返します。\r
+///\r
 int FolderModel::rowCount(const QModelIndex &parent) const\r
 {\r
     Q_UNUSED(parent);\r
     return m_fileInfoList.size();\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief FolderModel::columnCount\r
+/// \param parent   (使用しません)\r
+/// \return 列数を返します。\r
+///\r
 int FolderModel::columnCount(const QModelIndex &parent) const\r
 {\r
     Q_UNUSED(parent);\r
     return ColumnCount;\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief FolderModel::data\r
+/// \param index    インデックス\r
+/// \param role     ロール\r
+/// \return 該当のデータを返します。\r
+///\r
 QVariant FolderModel::data(const QModelIndex &index, int role) const\r
 {\r
     if (!index.isValid()) {\r
@@ -576,19 +589,11 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
     return QVariant();\r
 }\r
 \r
-QVariant FolderModel::headerData(int section, Qt::Orientation orientation, int role) const\r
-{\r
-    if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {\r
-        switch (section) {\r
-        case Name:          return tr("名前");\r
-        case Extension:     return tr("拡張子");\r
-        case Size:          return tr("サイズ");\r
-        case LastModified:  return tr("更新日時");\r
-        }\r
-    }\r
-    return QVariant();\r
-}\r
-\r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief FolderModel::flags\r
+/// \param index    インデックス\r
+/// \return フラグを返します。\r
+///\r
 Qt::ItemFlags FolderModel::flags(const QModelIndex &index) const\r
 {\r
     Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;\r
@@ -606,6 +611,13 @@ Qt::ItemFlags FolderModel::flags(const QModelIndex &index) const
     return flags;\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief FolderModel::setData\r
+/// \param index    インデックス\r
+/// \param value    値\r
+/// \param role     ロール\r
+/// \return 値を設定した場合はtrueを返します。\r
+///\r
 bool FolderModel::setData(const QModelIndex &index, const QVariant &value, int role)\r
 {\r
     qDebug() << "FolderModel::setData()" << index;\r
@@ -628,6 +640,10 @@ bool FolderModel::setData(const QModelIndex &index, const QVariant &value, int r
     return false;\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief FolderModel::supportedDropActions\r
+/// \return Qt::CopyActionを返します。\r
+///\r
 Qt::DropActions FolderModel::supportedDropActions() const\r
 {\r
     qDebug() << "FolderModel::supportedDropActions()";\r
@@ -635,6 +651,10 @@ Qt::DropActions FolderModel::supportedDropActions() const
     return Qt::CopyAction;\r
 }\r
 \r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief FolderModel::mimeTypes\r
+/// \return MIMEタイプのリストを返します。\r
+///\r
 QStringList FolderModel::mimeTypes() const\r
 {\r
     qDebug() << "FolderModel::mimeTypes()";\r
index 1d39a56..d8347de 100644 (file)
@@ -113,7 +113,6 @@ public:
     int rowCount(const QModelIndex &parent = QModelIndex()) const;\r
     int columnCount(const QModelIndex &parent = QModelIndex()) const;\r
     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;\r
-    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;\r
     Qt::ItemFlags flags(const QModelIndex &index) const;\r
     bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);\r
     Qt::DropActions supportedDropActions() const;\r
index ee525d5..ac24a12 100644 (file)
@@ -38,6 +38,11 @@ void FolderView::initialize(MainWindow *w)
     viewport()->installEventFilter(w);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief FolderView::onScaleUp
+///
+/// 文字を大きくします。
+///
 void FolderView::onScaleUp()
 {
     Preferences prefs(this);
@@ -48,6 +53,11 @@ void FolderView::onScaleUp()
     emit prefs_updated();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief FolderView::onScaleDown
+///
+/// 文字を小さくします。
+///
 void FolderView::onScaleDown()
 {
     Preferences prefs(this);
@@ -58,6 +68,12 @@ void FolderView::onScaleDown()
     emit prefs_updated();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief FolderView::setModel
+/// \param model    モデルオブジェクト
+///
+/// モデルを設定します。
+///
 void FolderView::setModel(QAbstractItemModel *model)
 {
     if (this->model()) {
index 938fb81..048e970 100644 (file)
@@ -1,5 +1,12 @@
 #include "global.h"
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief appendActionShortcut
+/// \param action   アクションオブジェクト
+/// \param ks       キーシーケンス文字列
+///
+/// アクションにショートカットキーを追加します。
+///
 void appendActionShortcut(QAction *action, const QString &ks)
 {
     QList<QKeySequence> shortcuts = action->shortcuts();
@@ -7,6 +14,11 @@ void appendActionShortcut(QAction *action, const QString &ks)
     action->setShortcuts(shortcuts);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief detectCode
+/// \param bytes    バイト列
+/// \return エンコード文字列を返します。
+///
 std::string detectCode(const QByteArray &bytes)
 {
     const quint8 bEscape = 0x1B;
@@ -22,21 +34,13 @@ std::string detectCode(const QByteArray &bytes)
     int len = bytes.size();
     quint8 b1, b2, b3, b4;
 
-//    bool isBinary = false;
     for (int i = 0; i < len; i++) {
         b1 = bytes[i];
         if (b1 <= 0x06 || b1 == 0x7F || b1 == 0xFF) {
             //'binary'
             return "Binary";
-//            isBinary = true;
-//            if (b1 == 0x00 && i < len - 1 && static_cast<byte>(bytes[i + 1]) <= 0x7F) {
-//                return "UTF-16LE";
-//            }
         }
     }
-//    if (isBinary) {
-//        return "UTF-8";
-//    }
 
     bool notJapanese = true;
     for (int i = 0; i < len; i++) {
@@ -146,6 +150,11 @@ std::string detectCode(const QByteArray &bytes)
 
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief fileSizeToString
+/// \param size サイズ
+/// \return サイズの文字列表記を返します。
+///
 QString fileSizeToString(qint64 size)
 {
     if (size >= 1024 * 1024 * 1024) {
@@ -160,12 +169,18 @@ QString fileSizeToString(qint64 size)
     return QString("%1B").arg(size);
 }
 
-
+///////////////////////////////////////////////////////////////////////////////
+/// \brief reconnectAction
+/// \param sender   送信元アクション
+/// \param signal   シグナル
+/// \param reciever 送信先オブジェクト
+/// \param slot     スロット
+///
+/// シグナルにスロットを再接続します。
+///
 void reconnectAction(QAction *sender, const char *signal, QObject *reciever, const char *slot)
 {
     sender->setEnabled(true);
     sender->disconnect();
     QObject::connect(sender, signal, reciever, slot);
 }
-
-
index 57f7b6f..a4a3b67 100644 (file)
@@ -13,6 +13,12 @@ const int BYTES_PER_LINE = 16;
 const int GAP_ADR_HEX = 1;
 const int GAP_HEX_ASCII = 3;
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::HexView
+/// \param parent   親ウィジェット
+///
+/// コンストラクタ
+///
 HexView::HexView(QScrollArea *parent) :
     QWidget(parent)
 {
@@ -23,17 +29,32 @@ HexView::HexView(QScrollArea *parent) :
     resetSelection(0);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::setData
+/// \param data データ
+///
+/// データを設定します。
+///
 void HexView::setData(const QByteArray &data)
 {
     m_data = data;
     adjust();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::addressChars
+/// \return アドレスエリアの表示桁数を返します。
+///
 int HexView::addressChars() const
 {
     return QString("%1").arg(m_data.size(), 0, 16).length();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::adjust
+///
+/// ウィジェットサイズを調整します。
+///
 void HexView::adjust()
 {
     int lines = (m_data.size() / BYTES_PER_LINE) + 1;
@@ -45,6 +66,11 @@ void HexView::adjust()
     setMinimumWidth(addressArea + hexArea + asciiArea);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::cursorPos
+/// \param pos  カーソル位置
+/// \return カーソル位置に対応するデータインデックスを返します。
+///
 int HexView::cursorPos(const QPoint &pos)
 {
     int result = -1;
@@ -66,6 +92,12 @@ int HexView::cursorPos(const QPoint &pos)
     return result;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::resetSelection
+/// \param index    データインデックス
+///
+/// 選択範囲を初期化します。
+///
 void HexView::resetSelection(int index)
 {
     m_selectionBegin = index;
@@ -75,6 +107,12 @@ void HexView::resetSelection(int index)
     emit copyAvailable(false);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::setSelection
+/// \param index    データインデックス
+///
+/// 選択範囲を設定します。
+///
 void HexView::setSelection(int index)
 {
     if (index > m_selectionInit) {
@@ -89,16 +127,29 @@ void HexView::setSelection(int index)
     emit copyAvailable(m_selectionBegin != m_selectionEnd);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::xPosHex
+/// \return 16進表示エリアの開始座標を返します。
+///
 int HexView::xPosHex() const
 {
     return m_charWidth * (addressChars() + GAP_ADR_HEX);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::xPosAscii
+/// \return アスキー文字表示エリアの開始座標を返します。
+///
 int HexView::xPosAscii() const
 {
     return xPosHex() + m_charWidth * (HEXCHARS_IN_LINE + GAP_HEX_ASCII);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::onCopy
+///
+/// 選択範囲をクリップボードにコピーします。
+///
 void HexView::onCopy()
 {
     QString selected;
@@ -111,6 +162,11 @@ void HexView::onCopy()
     clipboard->setText(selected.trimmed());
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::onScaleDown
+///
+/// 文字を小さくします。
+///
 void HexView::onScaleDown()
 {
     Preferences prefs(this);
@@ -123,6 +179,11 @@ void HexView::onScaleDown()
     update();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::onScaleUp
+///
+/// 文字を大きくします。
+///
 void HexView::onScaleUp()
 {
     Preferences prefs(this);
@@ -135,6 +196,11 @@ void HexView::onScaleUp()
     update();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::onSelectAll
+///
+/// すべて選択します。
+///
 void HexView::onSelectAll()
 {
     resetSelection(0);
@@ -143,6 +209,12 @@ void HexView::onSelectAll()
     update();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::setVisible
+/// \param visible  表示(true)/非表示(false)
+///
+/// 表示状態になった場合の処理を行います。
+///
 void HexView::setVisible(bool visible)
 {
     if (visible) {
@@ -161,6 +233,12 @@ void HexView::setVisible(bool visible)
     QWidget::setVisible(visible);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::mousePressEvent
+/// \param e    マウスイベントオブジェクト
+///
+/// マウスクリック時の処理を行います。
+///
 void HexView::mousePressEvent(QMouseEvent *e)
 {
     if (e->button() == Qt::LeftButton) {
@@ -171,6 +249,12 @@ void HexView::mousePressEvent(QMouseEvent *e)
     }
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::mouseDoubleClickEvent
+/// \param e    マウスイベントオブジェクト
+///
+/// ダブルクリック時の処理を行います。
+///
 void HexView::mouseDoubleClickEvent(QMouseEvent *e)
 {
     if (e->button() == Qt::LeftButton) {
@@ -183,6 +267,12 @@ void HexView::mouseDoubleClickEvent(QMouseEvent *e)
     }
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::mouseMoveEvent
+/// \param e    マウスイベントオブジェクト
+///
+/// マウス移動時の処理を行います。
+///
 void HexView::mouseMoveEvent(QMouseEvent *e)
 {
     m_scrollArea->ensureVisible(e->x(), e->y());
@@ -194,10 +284,12 @@ void HexView::mouseMoveEvent(QMouseEvent *e)
     }
 }
 
-void HexView::keyPressEvent(QKeyEvent *)
-{
-}
-
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::paintEvent
+/// \param e    描画イベントオブジェクト
+///
+/// 描画イベントを処理します。
+///
 void HexView::paintEvent(QPaintEvent *e)
 {
     QPainter painter(this);
index 37c17a1..1eff5e6 100644 (file)
--- a/hexview.h
+++ b/hexview.h
@@ -48,7 +48,6 @@ protected:
     void mousePressEvent(QMouseEvent *e);
     void mouseDoubleClickEvent(QMouseEvent *e);
     void mouseMoveEvent(QMouseEvent *e);
-    void keyPressEvent(QKeyEvent *);
     void paintEvent(QPaintEvent *e);
 };
 
index 918416a..7da26ff 100644 (file)
@@ -2,6 +2,12 @@
 #include "historydialog.h"
 #include "ui_historydialog.h"
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HistoryDialog::HistoryDialog
+/// \param parent   親ウィジェット
+///
+/// コンストラクタ
+///
 HistoryDialog::HistoryDialog(QWidget *parent) :
     QDialog(parent),
     ui(new Ui::HistoryDialog),
@@ -16,11 +22,24 @@ HistoryDialog::HistoryDialog(QWidget *parent) :
     connect(ui->listRight, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HistoryDialog::~HistoryDialog
+///
+/// デストラクタ
+///
 HistoryDialog::~HistoryDialog()
 {
     delete ui;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HistoryDialog::setModel
+/// \param left     左パネルのモデル
+/// \param right    右パネルのモデル
+/// \param active   アクティブモデル
+///
+/// モデルを設定します。
+///
 void HistoryDialog::setModel(const FolderModel *left, const FolderModel *right, FolderModel *active)
 {
     m_leftModel = left;
@@ -42,18 +61,33 @@ void HistoryDialog::setModel(const FolderModel *left, const FolderModel *right,
     }
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HistoryDialog::on_radioLeft_clicked
+///
+/// 左パネルラジオボタンクリック時の処理を行います。
+///
 void HistoryDialog::on_radioLeft_clicked()
 {
     ui->listRight->setVisible(false);
     ui->listLeft->setVisible(true);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HistoryDialog::on_radioRight_clicked
+///
+/// 右パネルラジオボタンクリック時の処理を行います。
+///
 void HistoryDialog::on_radioRight_clicked()
 {
     ui->listLeft->setVisible(false);
     ui->listRight->setVisible(true);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HistoryDialog::accept
+///
+/// OKボタンクリック時の処理を行います。
+///
 void HistoryDialog::accept()
 {
     QString path;
index 569cdeb..b83c453 100644 (file)
@@ -8,6 +8,12 @@
 #include <QScrollArea>
 #include <QScrollBar>
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::ImageView
+/// \param parent   親ウィジェット
+///
+/// コンストラクタ
+///
 ImageView::ImageView(QScrollArea *parent) :
     QWidget(parent),
     m_dragStartPos(-1, -1)
@@ -18,6 +24,12 @@ ImageView::ImageView(QScrollArea *parent) :
     setCursor(Qt::OpenHandCursor);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::setData
+/// \param pixmap   ピクスマップ
+///
+/// ピクスマップを設定します。
+///
 void ImageView::setData(const QPixmap &pixmap)
 {
     m_pixmap = pixmap;
@@ -26,6 +38,10 @@ void ImageView::setData(const QPixmap &pixmap)
     resizePixmap();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::scaleFactor
+/// \return 倍率を返します。
+///
 double ImageView::scaleFactor()
 {
     if (m_scaleFactor <= 0) {
@@ -48,6 +64,11 @@ double ImageView::scaleFactor()
     return m_scaleFactor;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::resizePixmap
+///
+/// ピクスマップのサイズを変更します。
+///
 void ImageView::resizePixmap()
 {
     double scaleFactor = this->scaleFactor();
@@ -68,6 +89,11 @@ void ImageView::resizePixmap()
                        .arg(static_cast<int>(scaleFactor * 100)));
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onFitToWindow
+///
+/// ピクスマップのサイズをウィンドウに合わせます。
+///
 void ImageView::onFitToWindow()
 {
     qDebug() << "ImageView::onFitToWindow()";
@@ -79,6 +105,11 @@ void ImageView::onFitToWindow()
     m_scaleFactor = 0;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onRotate90
+///
+/// 右に90度回転します。
+///
 void ImageView::onRotate90()
 {
     m_rotateDeg += 90;
@@ -87,6 +118,11 @@ void ImageView::onRotate90()
     update();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onRotate180
+///
+/// 180度回転します。
+///
 void ImageView::onRotate180()
 {
     m_rotateDeg += 180;
@@ -95,6 +131,11 @@ void ImageView::onRotate180()
     update();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onScaleDown
+///
+/// 縮小します。
+///
 void ImageView::onScaleDown()
 {
     m_scaleFactor = this->scaleFactor() * 0.8;
@@ -102,6 +143,11 @@ void ImageView::onScaleDown()
     update();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onScaleNormal
+///
+/// 等倍表示します。
+///
 void ImageView::onScaleNormal()
 {
     m_scaleFactor = 1;
@@ -109,6 +155,11 @@ void ImageView::onScaleNormal()
     update();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onScaleUp
+///
+/// 拡大します。
+///
 void ImageView::onScaleUp()
 {
     m_scaleFactor = this->scaleFactor() * 1.25;
@@ -116,6 +167,12 @@ void ImageView::onScaleUp()
     update();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::setVisible
+/// \param visible  表示(true)/非表示(false)
+///
+/// 表示時の処理を行います。
+///
 void ImageView::setVisible(bool visible)
 {
     if (visible) {
@@ -129,6 +186,12 @@ void ImageView::setVisible(bool visible)
     QWidget::setVisible(visible);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::mousePressEvent
+/// \param e    マウスイベントオブジェクト
+///
+/// マウスクリック時の処理を行います。
+///
 void ImageView::mousePressEvent(QMouseEvent *e)
 {
     if (e->button() == Qt::LeftButton) {
@@ -137,12 +200,23 @@ void ImageView::mousePressEvent(QMouseEvent *e)
     }
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::mouseReleaseEvent
+///
+/// マウスボタンが離された場合の処理を行います。
+///
 void ImageView::mouseReleaseEvent(QMouseEvent *)
 {
     setCursor(Qt::OpenHandCursor);
     m_dragStartPos = QPoint(-1, -1);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::mouseMoveEvent
+/// \param e    マウスイベントオブジェクト
+///
+/// マウス移動時の処理を行います。
+///
 void ImageView::mouseMoveEvent(QMouseEvent *e)
 {
     if (m_dragStartPos.x() == -1 && m_dragStartPos.y() == -1)
@@ -158,6 +232,11 @@ void ImageView::mouseMoveEvent(QMouseEvent *e)
     vBar->setValue(vBar->value() - delta.y());
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::paintEvent
+///
+/// 描画イベントを処理します。
+///
 void ImageView::paintEvent(QPaintEvent *)
 {
     QPainter painter(this);
@@ -169,6 +248,12 @@ void ImageView::paintEvent(QPaintEvent *)
                        m_scaledPixmap);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::resizeEvent
+/// \param e    リサイズイベントオブジェクト
+///
+/// リサイズ時の処理を行います。
+///
 void ImageView::resizeEvent(QResizeEvent *e)
 {
     QWidget::resizeEvent(e);
index 7180f6e..82a3d67 100644 (file)
@@ -1786,15 +1786,15 @@ FolderModel *MainWindow::activeModel() const
 ///\r
 Panel *MainWindow::activePanel() const\r
 {\r
-    if (ui->FPanel->model() == activeModel() && ui->FPanel->isVisible()) {\r
+    if (ui->FPanel->model()->isActive() && ui->FPanel->isVisible()) {\r
         return ui->FPanel;\r
     }\r
-    if (ui->LPanel->model() == activeModel() && ui->LPanel->isVisible()) {\r
-        return ui->LPanel;\r
-    }\r
-    if (ui->RPanel->model() == activeModel() && ui->RPanel->isVisible()) {\r
+    if (ui->RPanel->model()->isActive() && ui->RPanel->isVisible()) {\r
         return ui->RPanel;\r
     }\r
+    if (ui->LPanel->model()->isActive() && ui->LPanel->isVisible()) {\r
+        return ui->LPanel;\r
+    }\r
 \r
     qDebug() << ">>>>>>>>>> activePanel() Logic error <<<<<<<<<<";\r
     return NULL;\r
@@ -1841,8 +1841,6 @@ QFileInfoList MainWindow::selectedItems() const
 {\r
     QFileInfoList list = activeModel()->markedItems();\r
     if (list.isEmpty()) {\r
-        qDebug() << focusItemView();\r
-        qDebug() << focusItemView()->currentIndex();\r
         Q_ASSERT(focusItemView()->currentIndex().isValid());\r
         list << activeModel()->fileInfo(focusItemView()->currentIndex());\r
     }\r
@@ -1871,20 +1869,24 @@ void MainWindow::setViewMode(Mode mode)
 \r
     QWidget *newFocusWidget = NULL;\r
 \r
+    m_prevMode = m_viewMode;\r
+    m_viewMode = mode;\r
+\r
     switch (mode) {\r
     case ModeBasic:\r
         ui->FPanel->setVisible(false);\r
         ui->splitter->setVisible(true);\r
+        newFocusWidget = activePanel()->folderPanel()->itemView();\r
+\r
         ui->LPanel->setViewItem();\r
         ui->RPanel->setViewItem();\r
         ui->FPanel->setViewItem();\r
-        if (m_viewMode == ModeFull) {\r
+        if (m_prevMode == ModeFull) {\r
             activePanel()->folderPanel()->setItemView(focusItemView()->objectName());\r
             activePanel()->folderPanel()->itemView()->setCurrentIndex(\r
                         focusItemView()->currentIndex());\r
             ui->FPanel->setModel(NULL);\r
         }\r
-        newFocusWidget = activePanel()->folderPanel()->itemView();\r
         break;\r
 \r
     case ModeFull:\r
@@ -1912,13 +1914,12 @@ void MainWindow::setViewMode(Mode mode)
         break;\r
     }\r
 \r
-    m_prevMode = m_viewMode;\r
-    m_viewMode = mode;\r
-\r
     if (newFocusWidget)\r
         newFocusWidget->setFocus();\r
     else\r
         updateActions();\r
+\r
+    qDebug() << "MainWindow::setViewMode() end";\r
 }\r
 \r
 ///////////////////////////////////////////////////////////////////////////////\r
index 120ff7e..8cf46c1 100644 (file)
@@ -1,8 +1,7 @@
+#include "operationworker.h"\r
 #include "operationdialog.h"\r
 #include "ui_operationdialog.h"\r
 \r
-#include <QThread>\r
-\r
 OperationDialog::OperationDialog(QWidget *parent) :\r
     QDialog(parent),\r
     ui(new Ui::OperationDialog),\r
index d3af904..e4c1f96 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef OPERATIONDIALOG_H\r
 #define OPERATIONDIALOG_H\r
 \r
-#include "operationworker.h"\r
-\r
 #include <QDialog>\r
+class OperationWorker;\r
 \r
 namespace Ui {\r
 class OperationDialog;\r
index e979a02..2e909fe 100644 (file)
--- a/panel.cpp
+++ b/panel.cpp
@@ -155,7 +155,7 @@ void Panel::updateAppearance(const Preferences &prefs)
 QWidget *Panel::visibleView() const
 {
     if (ui->scrollArea->isVisible()) {
-        return ui->scrollArea->widget();
+        return ui->scrollArea/*->widget()*/;
     }
     if (ui->folderPanel->isVisible()) {
         return ui->folderPanel->itemView();
index 38ac0a2..58fea0d 100644 (file)
@@ -100,6 +100,7 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) :
     setFont(ui->hvFontSpec, prefs.getHexViewFont());
 
     ui->lineHeight->setValue(prefs.getLineHeight());
+    ui->tvLineHeight->setValue(prefs.getTextViewLineHeight());
 
     // [プログラムパス]
     ui->editorPath->setText(prefs.getEditorPath());
@@ -504,6 +505,7 @@ void PreferenceDialog::accept()
     prefs.setHexViewFont(ui->hvFontSpec->font());
 
     prefs.setLineHeight(ui->lineHeight->value());
+    prefs.setTextViewLineHeight(ui->tvLineHeight->value());
 
     // [プログラムパス]
     prefs.setEditorPath(ui->editorPath->text());
index c922fe9..073abbb 100644 (file)
@@ -35,7 +35,7 @@
       <enum>QTabWidget::Rounded</enum>
      </property>
      <property name="currentIndex">
-      <number>3</number>
+      <number>2</number>
      </property>
      <widget class="QWidget" name="tabGeneral">
       <attribute name="title">
       <attribute name="title">
        <string>外観(フォント)</string>
       </attribute>
-      <layout class="QVBoxLayout" name="verticalLayout_5">
+      <layout class="QVBoxLayout" name="verticalLayout_3">
        <item>
         <layout class="QGridLayout" name="gridLayout_8">
          <item row="0" column="0">
            </property>
           </spacer>
          </item>
+         <item row="6" column="0">
+          <widget class="QLabel" name="label_5">
+           <property name="text">
+            <string>内蔵テキストビューアの行の高さ(1〜2)</string>
+           </property>
+          </widget>
+         </item>
+         <item row="6" column="1">
+          <widget class="QDoubleSpinBox" name="tvLineHeight">
+           <property name="decimals">
+            <number>2</number>
+           </property>
+           <property name="minimum">
+            <double>1.000000000000000</double>
+           </property>
+           <property name="maximum">
+            <double>2.000000000000000</double>
+           </property>
+           <property name="singleStep">
+            <double>0.010000000000000</double>
+           </property>
+           <property name="value">
+            <double>1.500000000000000</double>
+           </property>
+          </widget>
+         </item>
+         <item row="6" column="2">
+          <spacer name="horizontalSpacer_7">
+           <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>
        </item>
        <item>
   <tabstop>tvFont</tabstop>
   <tabstop>hvFont</tabstop>
   <tabstop>lineHeight</tabstop>
+  <tabstop>tvLineHeight</tabstop>
   <tabstop>allFont</tabstop>
   <tabstop>editorPath</tabstop>
   <tabstop>browseEditor</tabstop>
index 778699d..f315c5a 100644 (file)
@@ -326,6 +326,7 @@ IMPLEMENT_COLOR(ImageViewBgColor, QPalette().base().color())
 
 IMPLEMENT_DOUBLE(DarkFacotr, 0)
 IMPLEMENT_DOUBLE(LineHeight, 1.5)
+IMPLEMENT_DOUBLE(TextViewLineHeight, 1.0)
 
 #define IMPLEMENT_FONT(key, defVal)                                 \
     QFont Preferences::get##key() const {                           \
index 25ee4f2..11cf962 100644 (file)
@@ -90,6 +90,7 @@ public:
 
     DECLARE_PRIMITIVE(double, DarkFacotr);
     DECLARE_PRIMITIVE(double, LineHeight);
+    DECLARE_PRIMITIVE(double, TextViewLineHeight);
 
     DECLARE_OBJECT(QFont, FolderViewFont);
     DECLARE_OBJECT(QFont, LocationBoxFont);
index 8e7d848..5379b50 100644 (file)
@@ -282,7 +282,7 @@ void TextView::setVisible(bool visible)
         this->setAutoFillBackground(true);
         this->setFont(prefs.getTextViewFont());
 
-        m_charHeight = fontMetrics().height();
+        m_charHeight = fontMetrics().height() * prefs.getTextViewLineHeight();
         m_charWidth = fontMetrics().width('9');
         m_tabWidth = 8 * m_charWidth;
     }
@@ -395,9 +395,9 @@ void TextView::paintEvent(QPaintEvent *e)
             painter.setPen(this->palette().color(this->foregroundRole()));
         }
         else if (ch == "\t") {
-            painter.setPen(this->palette().color(QPalette::BrightText));
-            painter.drawText(vPos.x, vPos.y, "^");
-            painter.setPen(this->palette().color(this->foregroundRole()));
+//            painter.setPen(this->palette().color(QPalette::BrightText));
+//            painter.drawText(vPos.x, vPos.y, "^");
+//            painter.setPen(this->palette().color(this->foregroundRole()));
         }
         else {
             painter.drawText(vPos.x, vPos.y, ch);
index 55838cd..d80d1c6 100644 (file)
@@ -12,7 +12,6 @@ ThumbnailWorker::ThumbnailWorker() :
 
 void ThumbnailWorker::addPath(const QString &path)
 {
-    qDebug() << "ThumbnailWorker::addPath()" << path;
     QMutexLocker locker(&m_mutex);
     m_pathList << path;
 }
@@ -29,7 +28,6 @@ QString ThumbnailWorker::getPath()
     if (m_pathList.isEmpty()) {
         return QString();
     }
-    qDebug() << "ThumbnailWorker::getPath()";
     return m_pathList.takeFirst();
 }