Skip to content
Permalink
Browse files

1. integration of "Viewer" tab of Preferences Dialog into "Appearance…

…" tab.

2. Image Viewer background -> Image Viewer transparent background.
  • Loading branch information...
haraki committed May 14, 2019
1 parent 48af459 commit 20813d58f51e9fad985d68ac6465cf4cf5452134
Showing with 1,088 additions and 1,077 deletions.
  1. +4 −4 default_settings.h
  2. +2 −2 imageviewer.cpp
  3. +19 −19 preferencesdialog.cpp
  4. +5 −5 preferencesdialog.h
  5. +1,024 −1,013 preferencesdialog.ui
  6. +23 −23 settings.cpp
  7. +9 −9 settings.h
  8. +2 −2 types.h
@@ -86,7 +86,7 @@ static const QMap<QString, QColor> DEFAULT_COLOR_SETTINGS =
{ "console_text", "#000000", },
{ "console_background", "#ffffff", },

{ "imageViewer_background", "#808080", },
{ "imageViewer_transparent_background", "#808080", },

{ "textViewer_text", "#000000", },
{ "textViewer_background", "#ffffff", },
@@ -127,12 +127,12 @@ static const int DEFAULT_CURSOR_WIDTH = 1;

static const bool DEFAULT_CONSOLE_VISIBLE = true;

static const bool DEFAULT_IMAGE_VIEWER_FIT_IN_VIEW = true;
static const ImageViewerBGType DEFAULT_IMAGE_VIEWER_BG_TYPE = ImageViewerBGType::Checkered;

static const bool DEFAULT_TEXT_VIEWER_SHOW_LINE_NUMBER = true;
static const bool DEFAULT_TEXT_VIEWER_WORD_WRAP = false;

static const bool DEFAULT_IMAGE_VIEWER_FIT_IN_VIEW = true;
static const ImageViewerTransparentBGType DEFAULT_IMAGE_VIEWER_TRANSPARENT_BG_TYPE = ImageViewerTransparentBGType::Checkered;

#if defined(Q_OS_WIN)
static const QString DEFAULT_TEXT_EDITOR_PATH = "C:\\Windows\\notepad.exe";
static const QString DEFAULT_TEXT_EDITOR_ARGS = "$F";
@@ -229,7 +229,7 @@ QBrush ImageViewer::createTransparentBGBrush()
{
QBrush bgBrush = QBrush();

if(Settings::getInstance()->getImageViewerBGType() == ImageViewerBGType::Solid)
if(Settings::getInstance()->getImageViewerTransparentBGType() == ImageViewerTransparentBGType::Solid)
{
bgBrush.setStyle(Qt::SolidPattern);
}
@@ -260,7 +260,7 @@ QBrush ImageViewer::createTransparentBGBrush()
bgBrush.setTexture(bgBitmap);
}

bgBrush.setColor(Settings::getInstance()->getColorSetting("imageViewer_background"));
bgBrush.setColor(Settings::getInstance()->getColorSetting("imageViewer_transparent_background"));

return bgBrush;
}
@@ -280,8 +280,8 @@ void PreferencesDialog::initialize(const QSize& mainWindowSize,

ui->imageViewerFitInViewCheckBox->setChecked(Settings::getInstance()->getImageViewerFitInView());

ui->imageViewerBGTypeComboBox->addItems({tr("Solid"), tr("Checkered")});
ui->imageViewerBGTypeComboBox->setCurrentIndex((Settings::getInstance()->getImageViewerBGType() == ImageViewerBGType::Solid) ? 0 : 1);
ui->imageViewerTransparentBGTypeComboBox->addItems({tr("Solid"), tr("Checkered")});
ui->imageViewerTransparentBGTypeComboBox->setCurrentIndex((Settings::getInstance()->getImageViewerTransparentBGType() == ImageViewerTransparentBGType::Solid) ? 0 : 1);

m_textViewerEncodeList = Settings::getInstance()->getTextViewerEncodeList();
ui->textViewerEncodeComboBox->addItems(m_textViewerEncodeList);
@@ -751,20 +751,20 @@ void PreferencesDialog::on_textViewerFontPushButton_clicked()
}
}

void PreferencesDialog::on_textViewerFontColorPushButton_clicked()
void PreferencesDialog::on_textViewerNormalFontColorPushButton_clicked()
{
chooseColor("textViewer_text", "textViewer_background", ui->textViewerSampleLineEdit);
chooseColor("textViewer_text", "textViewer_background", ui->textViewerNormalSampleLineEdit);
}

void PreferencesDialog::on_textViewerBGColorPushButton_clicked()
void PreferencesDialog::on_textViewerNormalBGColorPushButton_clicked()
{
QColor newColor = QColor();

if(showChooseColorDialog(m_colorSettings["textViewer_background"], newColor))
{
m_colorSettings["textViewer_background"] = newColor;

setFontColorSample("textViewer_text", "textViewer_background", ui->textViewerSampleLineEdit);
setFontColorSample("textViewer_text", "textViewer_background", ui->textViewerNormalSampleLineEdit);
}
}

@@ -830,20 +830,20 @@ void PreferencesDialog::on_hexViewerFontPushButton_clicked()
}
}

void PreferencesDialog::on_hexViewerFontColorPushButton_clicked()
void PreferencesDialog::on_hexViewerNormalFontColorPushButton_clicked()
{
chooseColor("hexViewer_text", "hexViewer_background", ui->hexViewerSampleLineEdit);
chooseColor("hexViewer_text", "hexViewer_background", ui->hexViewerNormalSampleLineEdit);
}

void PreferencesDialog::on_hexViewerBGColorPushButton_clicked()
void PreferencesDialog::on_hexViewerNormalBGColorPushButton_clicked()
{
QColor newColor = QColor();

if(showChooseColorDialog(m_colorSettings["hexViewer_background"], newColor))
{
m_colorSettings["hexViewer_background"] = newColor;

setFontColorSample("hexViewer_text", "hexViewer_background", ui->hexViewerSampleLineEdit);
setFontColorSample("hexViewer_text", "hexViewer_background", ui->hexViewerNormalSampleLineEdit);
}
}

@@ -881,16 +881,16 @@ void PreferencesDialog::on_hexViewerAddressBGColorPushButton_clicked()
}
}

void PreferencesDialog::on_imageViewerBGColorPushButton_clicked()
void PreferencesDialog::on_imageViewerTransparentBGColorPushButton_clicked()
{
QColor oldColor = ui->imageViewerBGColorSampleLineEdit->palette().base().color();
QColor oldColor = ui->imageViewerTransparentBGColorSampleLineEdit->palette().base().color();
QColor newColor = QColor();

if(showChooseColorDialog(oldColor, newColor))
{
m_colorSettings["imageViewer_background"] = newColor;
m_colorSettings["imageViewer_transparent_background"] = newColor;

setFontColorSample("", "imageViewer_background", ui->imageViewerBGColorSampleLineEdit);
setFontColorSample("", "imageViewer_transparent_background", ui->imageViewerTransparentBGColorSampleLineEdit);
}
}

@@ -1040,7 +1040,7 @@ void PreferencesDialog::setViewerFontAndColorOption()

// Image viewer

setFontColorSample("", "imageViewer_background", ui->imageViewerBGColorSampleLineEdit);
setFontColorSample("", "imageViewer_transparent_background", ui->imageViewerTransparentBGColorSampleLineEdit);

// Text viewer

@@ -1049,7 +1049,7 @@ void PreferencesDialog::setViewerFontAndColorOption()
ui->textViewerFontLabel->setText(QString("%1, %2 pt").arg(font.family()).arg(font.pointSize()));
ui->textViewerFontLabel->setFont(font);

setFontColorSample("textViewer_text", "textViewer_background", ui->textViewerSampleLineEdit);
setFontColorSample("textViewer_text", "textViewer_background", ui->textViewerNormalSampleLineEdit);
setFontColorSample("textViewer_selected_text", "textViewer_selected_background", ui->textViewerSelectedSampleLineEdit);
setFontColorSample("textViewer_lineNumber_text", "textViewer_lineNumber_background", ui->textViewerLineNumberSampleLineEdit);

@@ -1060,7 +1060,7 @@ void PreferencesDialog::setViewerFontAndColorOption()
ui->hexViewerFontLabel->setText(QString("%1, %2 pt").arg(font.family()).arg(font.pointSize()));
ui->hexViewerFontLabel->setFont(font);

setFontColorSample("hexViewer_text", "hexViewer_background", ui->hexViewerSampleLineEdit);
setFontColorSample("hexViewer_text", "hexViewer_background", ui->hexViewerNormalSampleLineEdit);
setFontColorSample("hexViewer_selected_text", "hexViewer_selected_background", ui->hexViewerSelectedSampleLineEdit);
setFontColorSample("hexViewer_address_text", "hexViewer_address_background", ui->hexViewerAddressSampleLineEdit);
}
@@ -1270,8 +1270,8 @@ void PreferencesDialog::on_buttonBox_accepted()

Settings::getInstance()->setImageViewerFitInView(ui->imageViewerFitInViewCheckBox->isChecked());

Settings::getInstance()->setImageViewerBGType((ui->imageViewerBGTypeComboBox->currentIndex() == 0) ? ImageViewerBGType::Solid
: ImageViewerBGType::Checkered);
Settings::getInstance()->setImageViewerTransparentBGType((ui->imageViewerTransparentBGTypeComboBox->currentIndex() == 0) ? ImageViewerTransparentBGType::Solid
: ImageViewerTransparentBGType::Checkered);

Settings::getInstance()->setTextViewerEncodeList(m_textViewerEncodeList);

@@ -90,23 +90,23 @@ private slots:
void on_consoleBGColorPushButton_clicked();

void on_textViewerFontPushButton_clicked();
void on_textViewerFontColorPushButton_clicked();
void on_textViewerBGColorPushButton_clicked();
void on_textViewerNormalFontColorPushButton_clicked();
void on_textViewerNormalBGColorPushButton_clicked();
void on_textViewerSelectedFontColorPushButton_clicked();
void on_textViewerSelectedBGColorPushButton_clicked();
void on_textViewerLineNumberFontColorPushButton_clicked();
void on_textViewerLineNumberBGColorPushButton_clicked();
void on_textViewerEncodeComboBox_activated(int index);

void on_hexViewerFontPushButton_clicked();
void on_hexViewerFontColorPushButton_clicked();
void on_hexViewerBGColorPushButton_clicked();
void on_hexViewerNormalFontColorPushButton_clicked();
void on_hexViewerNormalBGColorPushButton_clicked();
void on_hexViewerSelectedFontColorPushButton_clicked();
void on_hexViewerSelectedBGColorPushButton_clicked();
void on_hexViewerAddressFontColorPushButton_clicked();
void on_hexViewerAddressBGColorPushButton_clicked();

void on_imageViewerBGColorPushButton_clicked();
void on_imageViewerTransparentBGColorPushButton_clicked();

void on_textEditorSelectButton_clicked();

Oops, something went wrong.

0 comments on commit 20813d5

Please sign in to comment.
You can’t perform that action at this time.