Skip to content

Commit 9778c5d

Browse files
author
ThePBone
committed
Add new style plugin: randrew/phantomstyle (modified)
1 parent d9f41bc commit 9778c5d

File tree

13 files changed

+5898
-19
lines changed

13 files changed

+5898
-19
lines changed

V4L_Frontend.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ TEMPLATE = app
1212
QMAKE_CXXFLAGS += "-Wno-old-style-cast -Wno-unused-function"
1313

1414
include(visualization/SpectrumAudioViewer.pri)
15+
include(phantom/phantom.pri)
1516

1617
# The following define makes your compiler emit warnings if you use
1718
# any feature of Qt which has been marked as deprecated (the exact warnings

dialog/settings.ui

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<item>
114114
<widget class="QStackedWidget" name="stackedWidget">
115115
<property name="currentIndex">
116-
<number>0</number>
116+
<number>1</number>
117117
</property>
118118
<widget class="QWidget" name="general">
119119
<layout class="QVBoxLayout" name="verticalLayout_2">
@@ -366,7 +366,13 @@
366366
</widget>
367367
</item>
368368
<item row="0" column="1">
369-
<widget class="QComboBox" name="themeSelect"/>
369+
<widget class="QComboBox" name="themeSelect">
370+
<item>
371+
<property name="text">
372+
<string>Phantom</string>
373+
</property>
374+
</item>
375+
</widget>
370376
</item>
371377
</layout>
372378
</item>

mainwindow.cpp

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "misc/eventfilter.h"
1010
#include "dialog/firstlaunchwizard.h"
1111

12+
#include <phantomstyle.h>
1213
#include <Animation/Animation.h>
1314

1415
#include <QMenu>
@@ -54,8 +55,6 @@ MainWindow::MainWindow(QString exepath, bool statupInTray, bool allowMultipleIns
5455
conf->setConfigMap(readConfig());
5556
LoadConfig();
5657

57-
58-
5958
conv_dlg = new ConvolverDlg(this,this);
6059
preset_dlg = new PresetDlg(this);
6160

@@ -167,6 +166,8 @@ MainWindow::MainWindow(QString exepath, bool statupInTray, bool allowMultipleIns
167166
LaunchFirstRunSetup();
168167
else
169168
RunDiagnosticChecks();
169+
170+
//setStyle(new PhantomStyle);
170171
}
171172

172173
MainWindow::~MainWindow()
@@ -254,12 +255,15 @@ void MainWindow::InitializeSpectrum(){
254255
else if(refresh > 500) refresh = 500;
255256
m_audioengine->setNotifyIntervalMs(refresh);
256257

257-
analysisLayout.reset(new QHBoxLayout());
258-
analysisLayout->addWidget(m_spectrograph);
258+
analysisLayout.reset(new QFrame());
259+
analysisLayout->setFrameShape(QFrame::Shape::StyledPanel);
260+
analysisLayout->setLayout(new QHBoxLayout);
261+
analysisLayout->layout()->setMargin(0);
262+
analysisLayout->layout()->addWidget(m_spectrograph);
259263
m_spectrograph->hide();
260264

261265
auto buttonbox = ui->centralWidget->layout()->takeAt(ui->centralWidget->layout()->count()-1);
262-
ui->centralWidget->layout()->addItem(analysisLayout.data());
266+
ui->centralWidget->layout()->addWidget(analysisLayout.data());
263267
ui->centralWidget->layout()->addItem(buttonbox);
264268
analysisLayout.take();
265269

@@ -299,10 +303,22 @@ void MainWindow::RefreshSpectrumParameters(){
299303

300304
if(maxfreq < minfreq) maxfreq = minfreq + 100;
301305

306+
QColor outline;
307+
if (palette().window().style() == Qt::TexturePattern)
308+
outline = QColor(0, 0, 0, 160);
309+
else
310+
outline = palette().window().color().lighter(140);
311+
302312
if(m_appwrapper->getSpectrumTheme() == 0)
303-
m_spectrograph->setTheme(Qt::black,QColor(51,204,201),QColor(255,255,0),m_appwrapper->getSpetrumGrid());
313+
m_spectrograph->setTheme(Qt::black,QColor(51,204,201),QColor(51,204,201).darker(),QColor(255,255,0),m_appwrapper->getSpetrumGrid());
304314
else
305-
m_spectrograph->setTheme(palette().window().color().lighter(),palette().highlight().color(),palette().text().color(),m_appwrapper->getSpetrumGrid());
315+
m_spectrograph->setTheme(palette().window().color().lighter(),
316+
palette().highlight().color(),
317+
palette().text().color(),
318+
outline.lighter(108),
319+
m_appwrapper->getSpetrumGrid());
320+
321+
306322

307323
m_spectrograph->setParams(bands, minfreq, maxfreq);
308324
m_audioengine->setNotifyIntervalMs(refresh);

mainwindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private slots:
122122
PresetDlg *preset_dlg;
123123
LogDlg *log_dlg;
124124

125-
QScopedPointer<QHBoxLayout> analysisLayout;
125+
QScopedPointer<QFrame> analysisLayout;
126126
Spectrograph* m_spectrograph;
127127
AudioStreamEngine* m_audioengine;
128128

misc/stylehelper.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "ui_mainwindow.h"
33
#include "mainwindow.h"
44
#include "config/appconfigwrapper.h"
5+
#include "phantom/phantomstyle.h"
56

67
#include <QTextStream>
78
#include <QApplication>
@@ -12,7 +13,11 @@ StyleHelper::StyleHelper(QObject* host){
1213
void StyleHelper::SetStyle(){
1314
MainWindow* m_host = qobject_cast<MainWindow*>(m_objhost);
1415
AppConfigWrapper* m_appconf = m_host->getACWrapper();
15-
QApplication::setStyle(m_appconf->getTheme());
16+
if(m_appconf->getTheme() == "Phantom")
17+
QApplication::setStyle(new PhantomStyle);
18+
else
19+
QApplication::setStyle(m_appconf->getTheme());
20+
1621
QString style_sheet = m_appconf->getStylesheet();
1722
int theme_mode = m_appconf->getThememode();
1823
QString color_palette = m_appconf->getColorpalette();
@@ -27,7 +32,6 @@ void StyleHelper::SetStyle(){
2732
else if (style_sheet=="vsdark")stylepath = ":/vsdark/vsdark/vsdark.qss";
2833
else if (style_sheet=="vslight")stylepath = ":/vslight/vslight/vslight.qss";
2934
else stylepath = ":/default.qss";
30-
m_host->ui->vb->setContentsMargins(4,4,4,4);
3135
QFile f(stylepath);
3236
if (!f.exists())printf("Unable to set stylesheet, file not found\n");
3337
else
@@ -62,6 +66,7 @@ void StyleHelper::SetStyle(){
6266
}else{
6367
loadIcons(false);
6468
if(color_palette=="dark"){
69+
loadIcons(true);
6570
QColor background = QColor(53,53,53);
6671
QColor foreground = Qt::white;
6772
QColor base = QColor(25,25,25);

phantom/phantom.pri

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
INCLUDEPATH += $$PWD
2+
3+
HEADERS += \
4+
$$PWD/phantomcolor.h \
5+
$$PWD/phantomstyle.h \
6+
$$PWD/phantomtweak.h
7+
8+
SOURCES += \
9+
$$PWD/phantomcolor.cpp \
10+
$$PWD/phantomstyle.cpp

0 commit comments

Comments
 (0)