mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-21 22:23:46 +00:00
Adjust logo in NewFileDialog and OptionsDialog to palette #89
This commit is contained in:
parent
fde759b6ae
commit
f7cb84994a
@ -58,6 +58,8 @@ static QString formatBytecount(const long bytecount)
|
|||||||
return stream.readAll();
|
return stream.readAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "utils/Helpers.h"
|
||||||
|
|
||||||
NewFileDialog::NewFileDialog(QWidget *parent) :
|
NewFileDialog::NewFileDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::NewFileDialog)
|
ui(new Ui::NewFileDialog)
|
||||||
@ -67,6 +69,9 @@ NewFileDialog::NewFileDialog(QWidget *parent) :
|
|||||||
ui->recentsListWidget->addAction(ui->actionRemove_item);
|
ui->recentsListWidget->addAction(ui->actionRemove_item);
|
||||||
ui->recentsListWidget->addAction(ui->actionClear_all);
|
ui->recentsListWidget->addAction(ui->actionClear_all);
|
||||||
|
|
||||||
|
QColor logoColor = (palette().window().color().value() < 127) ? QColor(255, 255, 255) : QColor(0, 0, 0);
|
||||||
|
ui->logoSvgWidget->load(qhelpers::applyColorToSvg(":/img/cutter.svg", logoColor));
|
||||||
|
|
||||||
fillRecentFilesList();
|
fillRecentFilesList();
|
||||||
bool projectsExist = fillProjectsList();
|
bool projectsExist = fillProjectsList();
|
||||||
|
|
||||||
|
@ -14,57 +14,37 @@
|
|||||||
<string>Open File</string>
|
<string>Open File</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<item>
|
||||||
<number>5</number>
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
</property>
|
<property name="leftMargin">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<item alignment="Qt::AlignHCenter">
|
|
||||||
<widget class="QLabel" name="Logo">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>96</width>
|
|
||||||
<height>96</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>96</width>
|
|
||||||
<height>96</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="pixmap">
|
|
||||||
<pixmap resource="../resources.qrc">:/img/cutter.svg</pixmap>
|
|
||||||
</property>
|
|
||||||
<property name="scaledContents">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>8</number>
|
<number>8</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="topMargin">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QSvgWidget" name="logoSvgWidget" native="true">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>88</width>
|
||||||
|
<height>88</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>88</width>
|
||||||
|
<height>88</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
@ -462,6 +442,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>QSvgWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>qsvgwidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../resources.qrc"/>
|
<include location="../resources.qrc"/>
|
||||||
<include location="../resources.qrc"/>
|
<include location="../resources.qrc"/>
|
||||||
|
@ -25,6 +25,9 @@ OptionsDialog::OptionsDialog(MainWindow *main):
|
|||||||
ui->progressBar->setVisible(0);
|
ui->progressBar->setVisible(0);
|
||||||
ui->statusLabel->setVisible(0);
|
ui->statusLabel->setVisible(0);
|
||||||
|
|
||||||
|
QColor logoColor = (palette().window().color().value() < 127) ? QColor(255, 255, 255) : QColor(0, 0, 0);
|
||||||
|
ui->logoSvgWidget->load(qhelpers::applyColorToSvg(":/img/cutter.svg", logoColor));
|
||||||
|
|
||||||
ui->analSlider->setValue(defaultAnalLevel);
|
ui->analSlider->setValue(defaultAnalLevel);
|
||||||
|
|
||||||
// Fill the plugins combo
|
// Fill the plugins combo
|
||||||
@ -121,7 +124,6 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
|
|||||||
ui->analSlider->setValue(level);
|
ui->analSlider->setValue(level);
|
||||||
|
|
||||||
this->setEnabled(0);
|
this->setEnabled(0);
|
||||||
ui->logo->setEnabled(true);
|
|
||||||
|
|
||||||
// Show Progress Bar
|
// Show Progress Bar
|
||||||
ui->progressBar->setEnabled(1);
|
ui->progressBar->setEnabled(1);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,6 @@
|
|||||||
#include <QAbstractItemView>
|
#include <QAbstractItemView>
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QtGui/QtGui>
|
|
||||||
|
|
||||||
|
|
||||||
static QAbstractItemView::ScrollMode scrollMode()
|
static QAbstractItemView::ScrollMode scrollMode()
|
||||||
@ -128,4 +127,33 @@ namespace qhelpers
|
|||||||
/ fontMetrics.lineSpacing();
|
/ fontMetrics.lineSpacing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QByteArray applyColorToSvg(const QString &filename, QColor color)
|
||||||
|
{
|
||||||
|
static QRegularExpression styleRegExp("(?:style=\".*fill:(.*?);.*?\")|(?:fill=\"(.*?)\")");
|
||||||
|
|
||||||
|
QString replaceStr = QString("#%1").arg(color.rgb() & 0xffffff, 6, 16, QLatin1Char('0'));
|
||||||
|
int replaceStrLen = replaceStr.length();
|
||||||
|
|
||||||
|
QFile file(filename);
|
||||||
|
file.open(QIODevice::ReadOnly);
|
||||||
|
QString xml = QString::fromUtf8(file.readAll());
|
||||||
|
|
||||||
|
int offset = 0;
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
QRegularExpressionMatch match = styleRegExp.match(xml, offset);
|
||||||
|
if (!match.hasMatch())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int captureIndex = match.captured(1).isNull() ? 2 : 1;
|
||||||
|
xml.replace(match.capturedStart(captureIndex), match.capturedLength(captureIndex), replaceStr);
|
||||||
|
offset = match.capturedStart(captureIndex) + replaceStrLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
return xml.toUtf8();
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define QHELPERS_H
|
#define QHELPERS_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QColor>
|
||||||
#include <QSizePolicy>
|
#include <QSizePolicy>
|
||||||
|
|
||||||
class QPlainTextEdit;
|
class QPlainTextEdit;
|
||||||
@ -40,6 +41,8 @@ namespace qhelpers
|
|||||||
|
|
||||||
|
|
||||||
int getMaxFullyDisplayedLines(QPlainTextEdit *plainTextEdit);
|
int getMaxFullyDisplayedLines(QPlainTextEdit *plainTextEdit);
|
||||||
|
|
||||||
|
QByteArray applyColorToSvg(const QString &filename, QColor color);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HELPERS_H
|
#endif // HELPERS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user