* 内蔵バイナリビューアを実装しました。
* 内蔵イメージビューアを自前描画に変更しました。
* 内蔵テキストビューアを自前描画に変更しました。
+ * 環境設定ダイアログに項目を追加しました。
+ * 内蔵テキストビューアの「制御文字」追加。
+ * 内蔵テキストビューアの「行の高さ」追加。
#### 2014/09/16 Ver0.24
* ツールバーの表示/非表示を切り替えられるようにしました。
* 内蔵バイナリビューアを実装しました。\r
* 内蔵イメージビューアを自前描画に変更しました。\r
* 内蔵テキストビューアを自前描画に変更しました。\r
+ * 環境設定ダイアログに項目を追加しました。\r
+ * 内蔵テキストビューアの「制御文字」追加。\r
+ * 内蔵テキストビューアの「行の高さ」追加。\r
\r
#### 2014/09/16 Ver 0.24\r
* ツールバーの表示/非表示を切り替えられるようにしました。\r
\r
#include <QThread>\r
\r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief AbstractWorker::AbstractWorker\r
+///\r
+/// コンストラクタ\r
+///\r
AbstractWorker::AbstractWorker() :\r
QObject(),\r
m_mutex(),\r
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
#include <QFileInfo>
#include <QMessageBox>
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::BookmarkDialog
+/// \param parent 親ウィジェット
+///
+/// コンストラクタ
+///
BookmarkDialog::BookmarkDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::BookmarkDialog),
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);
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);
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;
}
QString path = ui->tableWidget->item(i, 1)->data(Qt::DisplayRole).toString();
before << name + "¥t" + path;
}
- qDebug() << "set before" << before;
after.resize(before.size());
}
}
- qDebug() << "set after(1)" << after;
int n = 0;
for (int i = 0; i < ui->tableWidget->rowCount(); i++) {
if (!before[i].isEmpty()) {
after[n] = before[i];
}
}
- qDebug() << "set after(2)" << after;
while (ui->tableWidget->rowCount() > 0) {
ui->tableWidget->removeRow(0);
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::accept
+///
+/// OKボタンクリック時の処理を行います。
+///
void BookmarkDialog::accept()
{
Preferences prefs(this);
QDialog::accept();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief BookmarkDialog::on_buttonDelete_clicked
+///
+/// 削除ボタンクリック時の処理を行います。
+///
void BookmarkDialog::on_buttonDelete_clicked()
{
foreach (const QTableWidgetItem *item, ui->tableWidget->selectedItems()) {
}
}
+///////////////////////////////////////////////////////////////////////////////
+/// \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();
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";
}
\r
const int SLEEP_TIME = 1;\r
\r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief CopyMoveWorker::CopyMoveWorker\r
+///\r
+/// コンストラクタ\r
+///\r
CopyMoveWorker::CopyMoveWorker() :\r
OperationWorker(),\r
m_CopyList(),\r
{\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
///////////////////////////////////////////////////////////////////////////////\r
/// \brief CopyMoveWorker::run\r
///\r
+/// コピー(移動)を実行します。\r
+///\r
void CopyMoveWorker::run()\r
{\r
foreach (const QString &path, m_CopyList) {\r
emit finished();\r
}\r
\r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief CopyMoveWorker::initialText\r
+/// \return 初期表示テキストを返します。\r
+///\r
QString CopyMoveWorker::initialText() const\r
{\r
if (m_Move) {\r
\r
const int SLEEP_TIME = 1;\r
\r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief DeleteWorker::DeleteWorker\r
+///\r
+/// コンストラクタ\r
+///\r
DeleteWorker::DeleteWorker() :\r
OperationWorker(),\r
m_DeleteList(),\r
{\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
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
emit finished();\r
}\r
\r
+///////////////////////////////////////////////////////////////////////////////\r
+/// \brief DeleteWorker::initialText\r
+/// \return 初期表示テキストを返します。\r
+///\r
QString DeleteWorker::initialText() const\r
{\r
return tr("削除準備中...");\r
#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()) {
return;
}
- data.append(m_file.read(2048));
+ data.append(m_file.read(BUFFER_SIZE));
emit progress(data.size());
}
Q_OBJECT
public:
explicit FileReadWorker();
- ~FileReadWorker();
bool open(const QString &path);
void FolderModel::clearPixmapCache()\r
{\r
beginResetModel();\r
-// m_pixmapCacheMutex.lock();\r
-// m_pixmapCache.clear();\r
-// m_pixmapCacheMutex.unlock();\r
endResetModel();\r
}\r
\r
}\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
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
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
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
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
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
viewport()->installEventFilter(w);
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief FolderView::onScaleUp
+///
+/// 文字を大きくします。
+///
void FolderView::onScaleUp()
{
Preferences prefs(this);
emit prefs_updated();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief FolderView::onScaleDown
+///
+/// 文字を小さくします。
+///
void FolderView::onScaleDown()
{
Preferences prefs(this);
emit prefs_updated();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief FolderView::setModel
+/// \param model モデルオブジェクト
+///
+/// モデルを設定します。
+///
void FolderView::setModel(QAbstractItemModel *model)
{
if (this->model()) {
#include "global.h"
+///////////////////////////////////////////////////////////////////////////////
+/// \brief appendActionShortcut
+/// \param action アクションオブジェクト
+/// \param ks キーシーケンス文字列
+///
+/// アクションにショートカットキーを追加します。
+///
void appendActionShortcut(QAction *action, const QString &ks)
{
QList<QKeySequence> shortcuts = action->shortcuts();
action->setShortcuts(shortcuts);
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief detectCode
+/// \param bytes バイト列
+/// \return エンコード文字列を返します。
+///
std::string detectCode(const QByteArray &bytes)
{
const quint8 bEscape = 0x1B;
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++) {
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief fileSizeToString
+/// \param size サイズ
+/// \return サイズの文字列表記を返します。
+///
QString fileSizeToString(qint64 size)
{
if (size >= 1024 * 1024 * 1024) {
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);
}
-
-
const int GAP_ADR_HEX = 1;
const int GAP_HEX_ASCII = 3;
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::HexView
+/// \param parent 親ウィジェット
+///
+/// コンストラクタ
+///
HexView::HexView(QScrollArea *parent) :
QWidget(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;
setMinimumWidth(addressArea + hexArea + asciiArea);
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::cursorPos
+/// \param pos カーソル位置
+/// \return カーソル位置に対応するデータインデックスを返します。
+///
int HexView::cursorPos(const QPoint &pos)
{
int result = -1;
return result;
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::resetSelection
+/// \param index データインデックス
+///
+/// 選択範囲を初期化します。
+///
void HexView::resetSelection(int index)
{
m_selectionBegin = index;
emit copyAvailable(false);
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::setSelection
+/// \param index データインデックス
+///
+/// 選択範囲を設定します。
+///
void HexView::setSelection(int index)
{
if (index > m_selectionInit) {
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;
clipboard->setText(selected.trimmed());
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::onScaleDown
+///
+/// 文字を小さくします。
+///
void HexView::onScaleDown()
{
Preferences prefs(this);
update();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::onScaleUp
+///
+/// 文字を大きくします。
+///
void HexView::onScaleUp()
{
Preferences prefs(this);
update();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::onSelectAll
+///
+/// すべて選択します。
+///
void HexView::onSelectAll()
{
resetSelection(0);
update();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::setVisible
+/// \param visible 表示(true)/非表示(false)
+///
+/// 表示状態になった場合の処理を行います。
+///
void HexView::setVisible(bool visible)
{
if (visible) {
QWidget::setVisible(visible);
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::mousePressEvent
+/// \param e マウスイベントオブジェクト
+///
+/// マウスクリック時の処理を行います。
+///
void HexView::mousePressEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton) {
}
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::mouseDoubleClickEvent
+/// \param e マウスイベントオブジェクト
+///
+/// ダブルクリック時の処理を行います。
+///
void HexView::mouseDoubleClickEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton) {
}
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::mouseMoveEvent
+/// \param e マウスイベントオブジェクト
+///
+/// マウス移動時の処理を行います。
+///
void HexView::mouseMoveEvent(QMouseEvent *e)
{
m_scrollArea->ensureVisible(e->x(), e->y());
}
}
-void HexView::keyPressEvent(QKeyEvent *)
-{
-}
-
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HexView::paintEvent
+/// \param e 描画イベントオブジェクト
+///
+/// 描画イベントを処理します。
+///
void HexView::paintEvent(QPaintEvent *e)
{
QPainter painter(this);
void mousePressEvent(QMouseEvent *e);
void mouseDoubleClickEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
- void keyPressEvent(QKeyEvent *);
void paintEvent(QPaintEvent *e);
};
#include "historydialog.h"
#include "ui_historydialog.h"
+///////////////////////////////////////////////////////////////////////////////
+/// \brief HistoryDialog::HistoryDialog
+/// \param parent 親ウィジェット
+///
+/// コンストラクタ
+///
HistoryDialog::HistoryDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::HistoryDialog),
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;
}
}
+///////////////////////////////////////////////////////////////////////////////
+/// \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;
#include <QScrollArea>
#include <QScrollBar>
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::ImageView
+/// \param parent 親ウィジェット
+///
+/// コンストラクタ
+///
ImageView::ImageView(QScrollArea *parent) :
QWidget(parent),
m_dragStartPos(-1, -1)
setCursor(Qt::OpenHandCursor);
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::setData
+/// \param pixmap ピクスマップ
+///
+/// ピクスマップを設定します。
+///
void ImageView::setData(const QPixmap &pixmap)
{
m_pixmap = pixmap;
resizePixmap();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::scaleFactor
+/// \return 倍率を返します。
+///
double ImageView::scaleFactor()
{
if (m_scaleFactor <= 0) {
return m_scaleFactor;
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::resizePixmap
+///
+/// ピクスマップのサイズを変更します。
+///
void ImageView::resizePixmap()
{
double scaleFactor = this->scaleFactor();
.arg(static_cast<int>(scaleFactor * 100)));
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onFitToWindow
+///
+/// ピクスマップのサイズをウィンドウに合わせます。
+///
void ImageView::onFitToWindow()
{
qDebug() << "ImageView::onFitToWindow()";
m_scaleFactor = 0;
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onRotate90
+///
+/// 右に90度回転します。
+///
void ImageView::onRotate90()
{
m_rotateDeg += 90;
update();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onRotate180
+///
+/// 180度回転します。
+///
void ImageView::onRotate180()
{
m_rotateDeg += 180;
update();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onScaleDown
+///
+/// 縮小します。
+///
void ImageView::onScaleDown()
{
m_scaleFactor = this->scaleFactor() * 0.8;
update();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onScaleNormal
+///
+/// 等倍表示します。
+///
void ImageView::onScaleNormal()
{
m_scaleFactor = 1;
update();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::onScaleUp
+///
+/// 拡大します。
+///
void ImageView::onScaleUp()
{
m_scaleFactor = this->scaleFactor() * 1.25;
update();
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::setVisible
+/// \param visible 表示(true)/非表示(false)
+///
+/// 表示時の処理を行います。
+///
void ImageView::setVisible(bool visible)
{
if (visible) {
QWidget::setVisible(visible);
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::mousePressEvent
+/// \param e マウスイベントオブジェクト
+///
+/// マウスクリック時の処理を行います。
+///
void ImageView::mousePressEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton) {
}
}
+///////////////////////////////////////////////////////////////////////////////
+/// \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)
vBar->setValue(vBar->value() - delta.y());
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::paintEvent
+///
+/// 描画イベントを処理します。
+///
void ImageView::paintEvent(QPaintEvent *)
{
QPainter painter(this);
m_scaledPixmap);
}
+///////////////////////////////////////////////////////////////////////////////
+/// \brief ImageView::resizeEvent
+/// \param e リサイズイベントオブジェクト
+///
+/// リサイズ時の処理を行います。
+///
void ImageView::resizeEvent(QResizeEvent *e)
{
QWidget::resizeEvent(e);
///\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
{\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
\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
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
+#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
#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
QWidget *Panel::visibleView() const
{
if (ui->scrollArea->isVisible()) {
- return ui->scrollArea->widget();
+ return ui->scrollArea/*->widget()*/;
}
if (ui->folderPanel->isVisible()) {
return ui->folderPanel->itemView();
setFont(ui->hvFontSpec, prefs.getHexViewFont());
ui->lineHeight->setValue(prefs.getLineHeight());
+ ui->tvLineHeight->setValue(prefs.getTextViewLineHeight());
// [プログラムパス]
ui->editorPath->setText(prefs.getEditorPath());
prefs.setHexViewFont(ui->hvFontSpec->font());
prefs.setLineHeight(ui->lineHeight->value());
+ prefs.setTextViewLineHeight(ui->tvLineHeight->value());
// [プログラムパス]
prefs.setEditorPath(ui->editorPath->text());
<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>
IMPLEMENT_DOUBLE(DarkFacotr, 0)
IMPLEMENT_DOUBLE(LineHeight, 1.5)
+IMPLEMENT_DOUBLE(TextViewLineHeight, 1.0)
#define IMPLEMENT_FONT(key, defVal) \
QFont Preferences::get##key() const { \
DECLARE_PRIMITIVE(double, DarkFacotr);
DECLARE_PRIMITIVE(double, LineHeight);
+ DECLARE_PRIMITIVE(double, TextViewLineHeight);
DECLARE_OBJECT(QFont, FolderViewFont);
DECLARE_OBJECT(QFont, LocationBoxFont);
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;
}
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);
void ThumbnailWorker::addPath(const QString &path)
{
- qDebug() << "ThumbnailWorker::addPath()" << path;
QMutexLocker locker(&m_mutex);
m_pathList << path;
}
if (m_pathList.isEmpty()) {
return QString();
}
- qDebug() << "ThumbnailWorker::getPath()";
return m_pathList.takeFirst();
}