Redesign of the config menu

This commit is contained in:
lupoDharkael
2017-07-21 10:59:45 +02:00
parent b14d3cb5f0
commit 346607bc34
23 changed files with 273 additions and 76 deletions

View File

@@ -31,5 +31,11 @@
<file>img/buttonIconsBlack/square.png</file>
<file>img/buttonIconsWhite/square.png</file>
<file>img/flameshot.png</file>
<file>img/configWhite/config.png</file>
<file>img/configWhite/graphics.png</file>
<file>img/configWhite/name_edition.png</file>
<file>img/configBlack/config.png</file>
<file>img/configBlack/graphics.png</file>
<file>img/configBlack/name_edition.png</file>
</qresource>
</RCC>

BIN
img/configBlack/config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

4
img/configBlack/config.svg Executable file
View File

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path clip-rule="evenodd" fill="none" d="M0 0h24v24H0z"/>
<path d="M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"/>
</svg>

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

5
img/configBlack/graphics.svg Executable file
View File

@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path fill="none" d="M-74 29h48v48h-48V29z"/>
<path d="M22 9V7h-2V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-2h2v-2h-2v-2h2v-2h-2V9h2zm-4 10H4V5h14v14zM6 13h5v4H6zm6-6h4v3h-4zM6 7h5v5H6zm6 4h4v6h-4z"/>
<path fill="none" d="M0 0h24v24H0zm0 0h24v24H0z"/>
</svg>

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M4 9h16v2H4zm0 4h10v2H4z"/></svg>

After

Width:  |  Height:  |  Size: 125 B

BIN
img/configWhite/config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 24 24"
version="1.1"
id="svg6"
sodipodi:docname="config.svg"
inkscape:version="0.92+devel unknown">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
inkscape:document-rotation="0"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="986"
inkscape:window-height="739"
id="namedview8"
showgrid="false"
inkscape:zoom="22.041667"
inkscape:cx="12"
inkscape:cy="12"
inkscape:window-x="38"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg6" />
<path
clip-rule="evenodd"
fill="none"
d="M0 0h24v24H0z"
id="path2" />
<path
d="M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"
id="path4"
style="fill:#ffffff" />
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 24 24"
version="1.1"
id="svg8"
sodipodi:docname="graphics.svg"
inkscape:version="0.92+devel unknown">
<metadata
id="metadata14">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs12" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
inkscape:document-rotation="0"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="986"
inkscape:window-height="739"
id="namedview10"
showgrid="false"
inkscape:zoom="22.041667"
inkscape:cx="12"
inkscape:cy="12"
inkscape:window-x="38"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg8" />
<path
fill="none"
d="M-74 29h48v48h-48V29z"
id="path2" />
<path
d="M22 9V7h-2V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-2h2v-2h-2v-2h2v-2h-2V9h2zm-4 10H4V5h14v14zM6 13h5v4H6zm6-6h4v3h-4zM6 7h5v5H6zm6 4h4v6h-4z"
id="path4"
style="fill:#ffffff" />
<path
fill="none"
d="M0 0h24v24H0zm0 0h24v24H0z"
id="path6" />
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 24 24"
version="1.1"
id="svg4"
sodipodi:docname="name_edition.svg"
inkscape:version="0.92+devel unknown">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
inkscape:document-rotation="0"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="986"
inkscape:window-height="739"
id="namedview6"
showgrid="false"
inkscape:zoom="22.041667"
inkscape:cx="12"
inkscape:cy="12"
inkscape:window-x="38"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<path
d="M4 9h16v2H4zm0 4h10v2H4z"
id="path2"
style="fill:#ffffff" />
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -24,6 +24,7 @@
ButtonListView::ButtonListView(QWidget *parent) : QListWidget(parent) {
setMouseTracking(true);
setFlow(QListWidget::TopToBottom);
initButtonList();
connect(this, &QListWidget::itemChanged, this,
&ButtonListView::updateActiveButtons);
@@ -40,7 +41,7 @@ void ButtonListView::initButtonList() {
CaptureTool *tool = factory.CreateTool(t);
// add element to the local map
m_buttonTypeByName[tool->getName()] = t;
m_buttonTypeByName.insert(tool->getName(), t);
// init the menu option

View File

@@ -21,48 +21,44 @@
#include "src/config/uicoloreditor.h"
#include "src/config/geneneralconf.h"
#include "src/config/filenameeditor.h"
#include "src/config/strftimechooserwidget.h"
#include <QIcon>
#include <QVBoxLayout>
#include <QGroupBox>
#include <QLabel>
#include <QKeyEvent>
// ConfigWindow contains the menus where you can configure the application
ConfigWindow::ConfigWindow(QWidget *parent) : QWidget(parent) {
ConfigWindow::ConfigWindow(QWidget *parent) : QTabWidget(parent) {
setAttribute(Qt::WA_DeleteOnClose);
setFixedSize(410, 540);
setWindowIcon(QIcon(":img/flameshot.png"));
setWindowTitle(tr("Configuration"));
m_layout = new QVBoxLayout(this);
QColor background = this->palette().background().color();
bool isWhite = CaptureButton::iconIsWhiteByColor(background);
QString modifier = isWhite ? ":img/configWhite/" : ":img/configBlack/";
// color editor
QLabel *colorSelectionLabel = new QLabel(tr("UI color editor"), this);
m_layout->addWidget(colorSelectionLabel);
// visuals
auto visuals = new QWidget();
QVBoxLayout *layoutUI= new QVBoxLayout();
visuals->setLayout(layoutUI);
layoutUI->addWidget(new UIcolorEditor());
auto boxButtons = new QGroupBox();
boxButtons->setTitle(tr("Button Selection"));
auto listLayout = new QVBoxLayout(boxButtons);
listLayout->addWidget(new ButtonListView());
layoutUI->addWidget(boxButtons);
m_layout->addWidget(new UIcolorEditor(this));
addTab(visuals, "Interface");
setTabIcon(0, QIcon(modifier + "graphics.png"));
// general config
QLabel *configLabel = new QLabel(tr("General"), this);
m_layout->addWidget(configLabel);
// filename
addTab(new FileNameEditor(), "Name Editor");
setTabIcon(1, QIcon(modifier + "name_edition.png"));
m_layout->addWidget(new GeneneralConf(this));
// button selection
QLabel *buttonSelectLabel = new QLabel(tr("Button selection"), this);
m_layout->addWidget(buttonSelectLabel);
ButtonListView *m_buttonListView = new ButtonListView(this);
m_buttonListView->setFlow(QListWidget::TopToBottom);
m_layout->addWidget(m_buttonListView);
// name editor
QLabel *nameEditLabel = new QLabel(tr("Filename editor"), this);
m_layout->addWidget(nameEditLabel);
FileNameEditor *nameEditor = new FileNameEditor(this);
m_layout->addWidget(nameEditor);
addTab(new GeneneralConf(), "General");
setTabIcon(2, QIcon(modifier + "config.png"));
show();
}

View File

@@ -18,14 +18,9 @@
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#include <QWidget>
#include <QTabWidget>
class QVBoxLayout;
class QListWidgetItem;
class QListWidget;
class ConfigWindow : public QWidget {
class ConfigWindow : public QTabWidget {
Q_OBJECT
public:
explicit ConfigWindow(QWidget *parent = nullptr);
@@ -34,9 +29,6 @@ protected:
void keyPressEvent(QKeyEvent *);
private:
QVBoxLayout *m_layout;
};

View File

@@ -24,35 +24,36 @@
#include <QLineEdit>
#include <QPushButton>
FileNameEditor::FileNameEditor(QWidget *parent) : QFrame(parent) {
setFrameStyle(QFrame::StyledPanel);
FileNameEditor::FileNameEditor(QWidget *parent) : QGroupBox(parent) {
initWidgets();
initLayout();
}
void FileNameEditor::initLayout() {
m_layout = new QVBoxLayout(this);
m_layout->addWidget(m_helperButtons);
m_layout->addWidget(m_nameEditor);
m_layout->addWidget(m_outputLabel);
QPushButton *openHelp = new QPushButton(tr("Open Helper"), this);
connect(openHelp, &QPushButton::clicked, this, &FileNameEditor::openHelper);
m_layout->addWidget(m_saveButton);
QHBoxLayout *horizLayout = new QHBoxLayout();
horizLayout->addWidget(m_saveButton);
horizLayout->addWidget(openHelp);
horizLayout->addWidget(m_resetButton);
horizLayout->addWidget(m_clearButton);
m_layout->addLayout(horizLayout);
}
void FileNameEditor::initWidgets() {
m_nameHandler = new FileNameHandler(this);
// editor
m_nameEditor = new QLineEdit(this);
m_nameEditor->setMaxLength(FileNameHandler::MAX_CHARACTERS);
// preview
m_outputLabel = new QLineEdit(this);
m_outputLabel->setReadOnly(true);
m_outputLabel->setFocusPolicy(Qt::NoFocus);
m_outputLabel->setDisabled(true);
QString foreground = this->palette().foreground().color().name();
m_outputLabel->setStyleSheet(QString("color: %1").arg(foreground));
QPalette pal = m_outputLabel->palette();
QColor color = pal.color(QPalette::Disabled, m_outputLabel->backgroundRole());
pal.setColor(QPalette::Active, m_outputLabel->backgroundRole(), color);
@@ -63,9 +64,26 @@ void FileNameEditor::initWidgets() {
m_nameEditor->setText(ConfigHandler().getFilenamePattern());
m_outputLabel->setText(m_nameHandler->getParsedPattern());
// helper buttons
m_helperButtons = new StrftimeChooserWidget(this);
connect(m_helperButtons, &StrftimeChooserWidget::variableEmitted,
this, &FileNameEditor::addToNameEditor);
// save
m_saveButton = new QPushButton(tr("Save"), this);
connect(m_saveButton, &QPushButton::clicked, this, &FileNameEditor::savePattern);
}
m_saveButton->setToolTip(tr("Saves the pattern"));
// reset
m_resetButton = new QPushButton(tr("Reset"), this);
connect(m_resetButton, &QPushButton::clicked,
this, &FileNameEditor::resetName);
m_resetButton->setToolTip(tr("Restores the saved pattern"));
// clear
m_clearButton = new QPushButton(tr("Clear"), this);
connect(m_clearButton, &QPushButton::clicked, this,
[this](){ m_nameEditor->setText("");
});
m_clearButton->setToolTip(tr("Deletes the name"));}
void FileNameEditor::savePattern() {
QString pattern = m_nameEditor->text();
@@ -77,17 +95,10 @@ void FileNameEditor::showParsedPattern(const QString &p) {
m_outputLabel->setText(output);
}
void FileNameEditor::resetName() {
m_nameEditor->setText(ConfigHandler().getFilenamePattern());
}
void FileNameEditor::addToNameEditor(QString s) {
m_nameEditor->setText(m_nameEditor->text() + s);
}
void FileNameEditor::openHelper() {
if (!m_buttonHelper) {
m_buttonHelper = new StrftimeChooserWidget();
m_buttonHelper.data()->show();
connect(this, &FileNameEditor::destroyed,
m_buttonHelper, &StrftimeChooserWidget::deleteLater);
connect(m_buttonHelper, &StrftimeChooserWidget::variableEmitted,
this, &FileNameEditor::addToNameEditor);
}
}

View File

@@ -18,7 +18,7 @@
#ifndef FILENAMEEDITOR_H
#define FILENAMEEDITOR_H
#include <QFrame>
#include <QGroupBox>
#include <QPointer>
class QVBoxLayout;
@@ -27,7 +27,7 @@ class FileNameHandler;
class QPushButton;
class StrftimeChooserWidget;
class FileNameEditor : public QFrame
class FileNameEditor : public QGroupBox
{
Q_OBJECT
public:
@@ -37,19 +37,22 @@ private:
QVBoxLayout *m_layout;
QLineEdit *m_outputLabel;
QLineEdit *m_nameEditor;
QPushButton *m_saveButton;
FileNameHandler *m_nameHandler;
QPointer<StrftimeChooserWidget> m_buttonHelper;
StrftimeChooserWidget *m_helperButtons;
QPushButton *m_saveButton;
QPushButton *m_resetButton;
QPushButton *m_clearButton;
void initLayout();
void initWidgets();
public slots:
void addToNameEditor(QString s);
private slots:
void savePattern();
void showParsedPattern(const QString &);
void addToNameEditor(QString s);
void openHelper();
void resetName();
};
#endif // FILENAMEEDITOR_H

View File

@@ -20,10 +20,9 @@
#include <QVBoxLayout>
#include <QCheckBox>
GeneneralConf::GeneneralConf(QWidget *parent) : QFrame(parent) {
setFrameStyle(QFrame::StyledPanel);
GeneneralConf::GeneneralConf(QWidget *parent) : QGroupBox(parent) {
m_layout = new QVBoxLayout(this);
m_layout->setAlignment(Qt::AlignTop);
initShowHelp();
initShowDesktopNotification();
}

View File

@@ -18,11 +18,11 @@
#ifndef GENENERALCONF_H
#define GENENERALCONF_H
#include <QFrame>
#include <QGroupBox>
class QVBoxLayout;
class GeneneralConf : public QFrame {
class GeneneralConf : public QGroupBox {
Q_OBJECT
public:
GeneneralConf(QWidget *parent = nullptr);

View File

@@ -21,8 +21,6 @@
#include <QPushButton>
StrftimeChooserWidget::StrftimeChooserWidget(QWidget *parent) : QWidget(parent) {
setAttribute(Qt::WA_DeleteOnClose);
setWindowIcon(QIcon(":img/flameshot.png"));
QGridLayout *layout = new QGridLayout(this);
auto k = m_buttonData.keys();
int middle = k.length()/2;
@@ -35,6 +33,7 @@ StrftimeChooserWidget::StrftimeChooserWidget(QWidget *parent) : QWidget(parent)
QPushButton *button = new QPushButton(this);
button->setText(key);
button->setToolTip(variable);
button->setFixedHeight(30);
layout->addWidget(button, j, i);
connect(button, &QPushButton::clicked,
this, [variable, this](){Q_EMIT variableEmitted(variable);});

View File

@@ -23,9 +23,8 @@
#include <QComboBox>
#include <QMap>
UIcolorEditor::UIcolorEditor(QWidget *parent) : QFrame(parent) {
setFrameStyle(QFrame::StyledPanel);
UIcolorEditor::UIcolorEditor(QWidget *parent) : QGroupBox(parent) {
setTitle(tr("UI Color Editor"));
hLayout = new QHBoxLayout;
vLayout = new QVBoxLayout;

View File

@@ -20,14 +20,14 @@
#include "color_wheel.hpp"
#include "src/capture/capturebutton.h"
#include <QFrame>
#include <QGroupBox>
class QVBoxLayout;
class QHBoxLayout;
class CaptureButton;
class ClickableLabel;
class UIcolorEditor : public QFrame {
class UIcolorEditor : public QGroupBox {
Q_OBJECT
public:
explicit UIcolorEditor(QWidget *parent = nullptr);