Skip to content

Commit

Permalink
backup
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei47w committed Jul 11, 2024
1 parent 5ed6bc0 commit c0cbec3
Show file tree
Hide file tree
Showing 57 changed files with 883 additions and 979 deletions.
8 changes: 4 additions & 4 deletions core/src/devicebrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ DeviceBrowser::~DeviceBrowser()

void DeviceBrowser::initBtns()
{
StyleHelper::FrameBackgroundShadow(ui->containerHome);
StyleHelper::FrameBackgroundShadow(ui->containerAdd);
ui->containerHome->setStyleSheet("border: none");
ui->containerAdd->setStyleSheet("border: none");

bg = new QButtonGroup(this);

bg->addButton(ui->btnAdd);
bg->addButton(ui->btnHome);
ui->btnHome->setProperty(devBrowserId, "home");
ui->btnHome->setIcon(Style::getPixmap(":/gui/icons/home.svg", Style::getColor(json::theme::highlight)));
ui->btnHome->setIcon(Style::getPixmap(":/gui/icons/home.svg", Style::getColor(json::theme::focus_item)));
Style::setStyle(ui->btnHome, style::button::basic);
ui->btnAdd->setProperty(devBrowserId, "add");
ui->btnAdd->setIcon(Style::getPixmap(":/gui/icons/add.svg", Style::getColor(json::theme::highlight)));
ui->btnAdd->setIcon(Style::getPixmap(":/gui/icons/add.svg", Style::getColor(json::theme::focus_item)));
Style::setStyle(ui->btnAdd, style::button::basic);
list.append(ui->btnHome);
list.append(ui->btnAdd);
Expand Down
2 changes: 1 addition & 1 deletion core/src/deviceimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void DeviceImpl::loadBadges()
{
QPushButton *forgetBtn = new QPushButton();
forgetBtn->setMaximumSize(25, 25);
forgetBtn->setIcon(Style::getPixmap(":/gui/icons/orange_close.svg"));
forgetBtn->setIcon(Style::getPixmap(":/gui/icons/orange_close.svg", Style::getColor(json::theme::focus_item)));
connect(forgetBtn, &QPushButton::clicked, this, &DeviceImpl::forget);
HoverWidget *forgetHover = new HoverWidget(forgetBtn, m_icon, m_icon);
forgetHover->setStyleSheet("background-color: transparent; border: 0px;");
Expand Down
2 changes: 2 additions & 0 deletions core/src/scopyaboutpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <QTabBar>
#include <QTabWidget>
#include <QVBoxLayout>
#include <style.h>

#include <stylehelper.h>

Expand Down Expand Up @@ -39,6 +40,7 @@ QWidget *ScopyAboutPage::buildPage(QString src)
lay->addWidget(browser);
lay->setMargin(0);
initNavigationWidget(browser);
browser->setStyleSheet("background-color: " + Style::getAttribute(json::theme::focus_item));

if(QFile::exists(QString(src).replace("qrc:/", ":/"))) {
browser->setSource(src);
Expand Down
2 changes: 2 additions & 0 deletions core/src/scopyhomeinfopage.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "scopyhomeinfopage.h"
#include "style.h"

#include "ui_scopyhomeinfopage.h"

Expand All @@ -13,6 +14,7 @@ ScopyHomeInfoPage::ScopyHomeInfoPage(QWidget *parent)
, ui(new Ui::ScopyHomeInfoPage)
{
ui->setupUi(this);
Style::setStyle(ui->textBrowser, style::widget::border);
// initReportButton();
}

Expand Down
18 changes: 9 additions & 9 deletions core/src/scopymainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,20 @@ ScopyMainWindow::ScopyMainWindow(QWidget *parent)
{
QElapsedTimer timer;
timer.start();
initPreferences();

ScopyTitleManager::setMainWindow(this);
ScopyTitleManager::setApplicationName("Scopy");
ScopyTitleManager::setScopyVersion("v" + QString(scopy::config::version()));
ScopyTitleManager::setGitHash(QString(SCOPY_VERSION_GIT));
IIOUnitsManager::GetInstance();

setAttribute(Qt::WA_QuitOnClose, true);
initPreferences();
StyleHelper::GetInstance()->initColorMap();
StyleHelper::GetInstance()->initColorMap();
IIOUnitsManager::GetInstance();
setAttribute(Qt::WA_QuitOnClose, true);
initPythonWIN32();

ui->setupUi(this);
initStatusBar();
Style::setStyle(ui->centralwidget, style::widget::footer);

// Style::setStyle(ui->centralwidget, style::widget::footer);
Style::setStyle(ui->animHolder, style::widget::deviceList);

ConnectionProvider::GetInstance();
Expand Down Expand Up @@ -288,6 +286,9 @@ void ScopyMainWindow::initPreferences()

connect(p, SIGNAL(preferenceChanged(QString, QVariant)), this, SLOT(handlePreferences(QString, QVariant)));

Style::GetInstance()->setTheme(Preferences::GetInstance()->get("general_theme").toString());
ui->setupUi(this);

if(p->get("general_use_opengl").toBool()) {
m_glLoader = new QOpenGLWidget(this);
}
Expand All @@ -305,13 +306,12 @@ void ScopyMainWindow::initPreferences()

QMetaObject::invokeMethod(license, &LicenseOverlay::showOverlay, Qt::QueuedConnection);
}

QString theme = p->get("general_theme").toString();
QString themeName = "scopy-" + theme;
QIcon::setThemeName(themeName);
QIcon::setThemeSearchPaths({":/gui/icons/" + themeName});
qInfo(CAT_BENCHMARK) << "Init preferences took: " << timer.elapsed() << "ms";

Style::GetInstance()->setTheme(Preferences::GetInstance()->get("general_theme").toString());
}

void ScopyMainWindow::loadOpenGL()
Expand Down
1 change: 1 addition & 0 deletions core/src/scopypreferencespage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void ScopyPreferencesPage::addHorizontalTab(QWidget *w, QString text)
w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

QWidget *pane = new QWidget();
pane->setStyleSheet("background-color: " + Style::getAttribute(json::theme::background_secondary) + ";");
QHBoxLayout *lay = new QHBoxLayout();
lay->setMargin(10);
pane->setLayout(lay);
Expand Down
7 changes: 7 additions & 0 deletions core/src/toolbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "ui_toolbrowser.h"

#include <QDebug>
#include <style.h>

#include <gui/utils.h>

Expand All @@ -28,6 +29,12 @@ ToolBrowser::ToolBrowser(QWidget *parent)
Util::retainWidgetSizeWhenHidden(ui->logo);
homeTmi->setDraggable(false);

ui->btnLoad->setIcon(Style::getPixmap(":/gui/icons/scopy-default/icons/load.svg"));
ui->btnSave->setIcon(Style::getPixmap(":/gui/icons/scopy-default/icons/save.svg"));
ui->btnAbout->setIcon(Style::getPixmap(":/gui/icons/scopy-default/icons/info.svg"));
ui->btnPreferences->setIcon(Style::getPixmap(":/gui/icons/scopy-default/icons/gear_wheel.svg"));
ui->btnCollapseMini->setIcon(Style::getPixmap(":/gui/icons/scopy-default/icons/menu.svg"));

connect(ui->btnCollapse, &QPushButton::clicked, this, &ToolBrowser::toggleCollapse);
connect(ui->btnCollapseMini, &QPushButton::clicked, this, &ToolBrowser::toggleCollapse);
connect(ui->btnPreferences, &QPushButton::clicked, this, [=]() { Q_EMIT requestTool("preferences"); });
Expand Down
2 changes: 1 addition & 1 deletion core/src/toolmenuitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void ToolMenuItem::_buildUI()
layout->addWidget(toolBtn);
layout->addWidget(toolRunBtn);

setDynamicProperty(toolRunBtn, "stopButton", true);
Style::setStyle(toolRunBtn, style::button::stopButton);
toolRunBtn->setMaximumSize(32, 32);
toolBtn->setMinimumHeight(42);

Expand Down
14 changes: 0 additions & 14 deletions core/ui/toolbrowser.ui
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,6 @@
border-radius:5px;
}


#btnSave {
qproperty-icon: url(&quot;:/gui/icons/scopy-default/icons/save.svg&quot;);
}
#btnLoad {
qproperty-icon: url(&quot;:/gui/icons/scopy-default/icons/load.svg&quot;);
}
#btnPreferences {
qproperty-icon: url(&quot;:/gui/icons/scopy-default/icons/gear_wheel.svg&quot;);
}
#btnAbout {
qproperty-icon: url(&quot;:/gui/icons/scopy-default/icons/info.svg&quot;);
}
#logo {
background-image: url(:/gui/icons/scopy-default/icons/logo_analog.svg);
background-repeat: no-repeat;
Expand All @@ -67,7 +54,6 @@ min-height:36px;
#btnCollapseMini {
height:40px;
width:40px;
background-image: url(:/gui/icons/scopy-default/icons/menu.svg);
background-repeat: no-repeat;
background-position: center center;
}
Expand Down
1 change: 0 additions & 1 deletion gr-util/src/grtimechanneladdon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <QVBoxLayout>

#include <gui/stylehelper.h>
#include <gui/widgets/menubigswitch.h>
#include <gui/widgets/menucollapsesection.h>
#include <gui/widgets/menucombo.h>
#include <gui/widgets/menuheader.h>
Expand Down
1 change: 0 additions & 1 deletion gr-util/src/measurementcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include <grtimechanneladdon.h>
#include <gui/stylehelper.h>
#include <gui/widgets/menubigswitch.h>
#include <gui/widgets/menucollapsesection.h>
#include <gui/widgets/menucombo.h>
#include <gui/widgets/menulineedit.h>
Expand Down
45 changes: 10 additions & 35 deletions gui/include/gui/customSwitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@

#include "scopy-gui_export.h"

#include <QHBoxLayout>
#include <QLabel>
#include <QMap>
#include <QPushButton>
#include <QWidget>

namespace scopy {
class SCOPY_GUI_EXPORT CustomSwitch : public QPushButton
Expand All @@ -36,47 +33,25 @@ class SCOPY_GUI_EXPORT CustomSwitch : public QPushButton

public:
explicit CustomSwitch(QWidget *parent = nullptr);
// explicit CustomSwitch(const QString &text, QWidget *parent = nullptr);

// QSize sizeHint() const override;
// void setChecked(bool checked);
explicit CustomSwitch(QString on, QString off, QWidget *parent = nullptr);
~CustomSwitch();

void setOnText(const QString text);
void setOffText(const QString text);

void setOn(const QPixmap &pixmap);
void setOff(const QPixmap &pixmap);
QSize sizeHint() const override;

public Q_SLOTS:
void update();

protected:
// void resizeEvent(QResizeEvent *event) override;
void init();
void paintEvent(QPaintEvent *event) override;
// void mouseReleaseEvent(QMouseEvent *event) override;
// void enterEvent(QEvent *event) override;
// int offset() const;
// void setOffset(int value);
bool event(QEvent *) override;

private:
QLabel *onLabel;
QLabel *offLabel;
QHBoxLayout *layout;




int m_spacing;
int m_btn_width;
int m_track_radius;
int m_thumb_radius;
int m_margin;
int m_base_offset;
int m_offset;
qreal m_track_opacity;

QMap<bool, QColor> m_track_color;
QMap<bool, QColor> m_thumb_color;
QMap<bool, QColor> m_text_color;
QMap<bool, QString> m_text;
QMap<bool, std::function<int()>> m_end_offset;
QLabel *m_onLabel;
QLabel *m_offLabel;
};
} // namespace scopy

Expand Down
8 changes: 6 additions & 2 deletions gui/include/gui/smallOnOffSwitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,20 @@ class SCOPY_GUI_EXPORT SmallOnOffSwitch : public QCheckBox
public:
explicit SmallOnOffSwitch(QWidget *parent = nullptr);
explicit SmallOnOffSwitch(const QString &text, QWidget *parent = nullptr);
~SmallOnOffSwitch();

QSize sizeHint() const override;
void setChecked(bool checked);

public Q_SLOTS:
void toggleAnim();

protected:
void resizeEvent(QResizeEvent *event) override;
void paintEvent(QPaintEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void enterEvent(QEvent *event) override;
int offset() const;
void setOffset(int value);
void init();

private:
int m_spacing;
Expand All @@ -64,6 +67,7 @@ class SCOPY_GUI_EXPORT SmallOnOffSwitch : public QCheckBox
qreal m_track_opacity;

QMap<bool, QColor> m_track_color;
QMap<bool, QColor> m_track_color_disabled;
QMap<bool, QColor> m_thumb_color;
QMap<bool, std::function<int()>> m_end_offset;
};
Expand Down
3 changes: 3 additions & 0 deletions gui/include/gui/style.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class SCOPY_GUI_EXPORT Style : public QObject
bool setTheme(QString theme);
QStringList getThemeList();

protected:
static QString replaceAttribute(QString style);

private:
static Style *pinstance_;
static QJsonDocument *m_global_json;
Expand Down
29 changes: 0 additions & 29 deletions gui/include/gui/widgets/menubigswitch.h

This file was deleted.

2 changes: 0 additions & 2 deletions gui/include/gui/widgets/menucombo.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class SCOPY_GUI_EXPORT MenuCombo : public QWidget
virtual ~MenuCombo();

QComboBox *combo();
void applyStylesheet();

private:
QLabel *m_label;
Expand All @@ -36,7 +35,6 @@ class SCOPY_GUI_EXPORT MenuComboWidget : public QWidget
virtual ~MenuComboWidget();

QComboBox *combo();
void applyStylesheet();

private:
MenuCombo *m_combo;
Expand Down
Loading

0 comments on commit c0cbec3

Please sign in to comment.