Add ui color modification logic

This commit is contained in:
lupoDharkael
2017-05-19 23:57:53 +02:00
parent 2a55452922
commit 51c1a37b50
5 changed files with 56 additions and 7 deletions

View File

@@ -97,11 +97,13 @@ CaptureWidget::~CaptureWidget() {
// selection in the capture
void CaptureWidget::redefineButtons() {
QSettings settings;
QString buttonStyle = Button::getStyle();
auto buttonsInt = settings.value("buttons").value<QList<int> >();
QVector<Button*> vectorButtons;
for (auto i: buttonsInt) {
auto t = static_cast<Button::Type>(i);
Button *b = new Button(t, this);
b->setStyleSheet(buttonStyle);
if (t == Button::Type::selectionIndicator) {
m_sizeIndButton = b;
}

View File

@@ -18,6 +18,7 @@
#include "configwindow.h"
#include "capture/button.h"
#include "config/buttonlistview.h"
#include "config/uicoloreditor.h"
#include <QIcon>
#include <QVBoxLayout>
#include <QLabel>
@@ -32,6 +33,11 @@ ConfigWindow::ConfigWindow(QWidget *parent) : QWidget(parent){
QVBoxLayout *baseLayout = new QVBoxLayout(this);
QLabel *colorSelectionLabel = new QLabel("Choose the UI color", this);
baseLayout->addWidget(colorSelectionLabel);
baseLayout->addWidget(new UIcolorEditor(this));
QLabel *buttonSelectLabel = new QLabel("Choose the buttons to enable", this);
baseLayout->addWidget(buttonSelectLabel);

View File

@@ -1,5 +1,41 @@
#include "uicoloreditor.h"
#include "color_wheel.hpp"
#include "buttonlistview.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QSettings>
UIcolorEditor::UIcolorEditor(QWidget *parent) : QWidget(parent) {
setFixedSize(200,130);
QHBoxLayout *hLayout = new QHBoxLayout;
QVBoxLayout *vLayout = new QVBoxLayout;
setLayout(hLayout);
color_widgets::ColorWheel *colorWheel = new color_widgets::ColorWheel(this);
connect(colorWheel, &color_widgets::ColorWheel::mouseReleaseOnColor, this,
&UIcolorEditor::updateUIcolor);
connect(colorWheel, &color_widgets::ColorWheel::colorChanged, this,
&UIcolorEditor::updateLocalColor);
QSettings settings;
m_uiColor = settings.value("uiColor").value<QColor>();
colorWheel->setColor(m_uiColor);
colorWheel->setFixedSize(100,100);
hLayout->addWidget(colorWheel);
hLayout->addLayout(vLayout);
setLayout(hLayout);
}
void UIcolorEditor::updateUIcolor() {
QSettings settings;
settings.setValue("uiColor", m_uiColor);
}
void UIcolorEditor::updateLocalColor(QColor c) {
m_uiColor = c;
}

View File

@@ -1,5 +1,5 @@
#ifndef UICOLOREDITOR_H
#define UICOLOREDITOR_H
#ifndef UICOLORPICKER_H
#define UICOLORPICKER_H
#include <QWidget>
@@ -8,9 +8,12 @@ class UIcolorEditor : public QWidget {
public:
explicit UIcolorEditor(QWidget *parent = 0);
signals:
private slots:
void updateUIcolor();
void updateLocalColor(QColor);
public slots:
private:
QColor m_uiColor;
};
#endif // UICOLOREDITOR_H
#endif // UICOLORPICKER_H

View File

@@ -43,7 +43,8 @@ SOURCES += main.cpp\
capture/capturewidget.cpp \
capture/capturemodification.cpp \
capture/colorpicker.cpp \
config/buttonlistview.cpp
config/buttonlistview.cpp \
config/uicoloreditor.cpp
HEADERS += \
nativeeventfilter.h \
@@ -56,7 +57,8 @@ HEADERS += \
capture/capturewidget.h \
capture/capturemodification.h \
capture/colorpicker.h \
config/buttonlistview.h
config/buttonlistview.h \
config/uicoloreditor.h
RESOURCES += \
graphics.qrc