ui: offroad experimental mode button (#26498)

* draft

* draft

* before qpushbutton

* icon, clean up button, clicked goes to toggles

* fix icon

* add imgs

* img

* make square

* works with layouts!

* fix gradient

* this looks good

* clean up

* clean up

* remove padding around couch

* use scene's experimental_model, new onroad design

* rename widget

* def want 3

* update translations

* add img

* add 25px of padding!

* make 300px (no change)

* clean up old images

* 5 px smaller

* add white img

* fix from merge

* no style sheets

* see how this looks on device

* aliased vertical line (clean up)

* clean up

* imgs

* couch

* delete

* bye bye

* expand toggle support

* clean up

* fix dynamic icon

* make exp icon dynamic

* order

* move to offroad
pull/26518/head
Shane Smiskol 3 years ago committed by GitHub
parent 73ec91f3bc
commit 58b84fb401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. BIN
      selfdrive/assets/fonts/JetBrainsMono-Medium.ttf
  2. 3
      selfdrive/assets/img_couch.svg
  3. 10
      selfdrive/assets/img_experimental.svg
  4. 4
      selfdrive/assets/img_experimental_grey.svg
  5. 4
      selfdrive/assets/img_experimental_white.svg
  6. 2
      selfdrive/ui/SConscript
  7. 19
      selfdrive/ui/qt/home.cc
  8. 5
      selfdrive/ui/qt/home.h
  9. 75
      selfdrive/ui/qt/offroad/experimental_mode.cc
  10. 31
      selfdrive/ui/qt/offroad/experimental_mode.h
  11. 23
      selfdrive/ui/qt/offroad/settings.cc
  12. 5
      selfdrive/ui/qt/offroad/settings.h
  13. 6
      selfdrive/ui/qt/onroad.cc
  14. 1
      selfdrive/ui/qt/onroad.h
  15. 2
      selfdrive/ui/qt/sidebar.h
  16. 4
      selfdrive/ui/qt/window.cc
  17. 2
      selfdrive/ui/qt/window.h
  18. 11
      selfdrive/ui/translations/main_ja.ts
  19. 11
      selfdrive/ui/translations/main_ko.ts
  20. 11
      selfdrive/ui/translations/main_pt-BR.ts
  21. 11
      selfdrive/ui/translations/main_zh-CHS.ts
  22. 11
      selfdrive/ui/translations/main_zh-CHT.ts

@ -0,0 +1,3 @@
<svg width="598" height="598" viewBox="0 0 598 598" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M523.25 236.708H510.792V174.417C511.555 158.737 506.091 143.391 495.59 131.723C485.089 120.055 470.401 113.011 454.729 112.125H143.271C127.599 113.011 112.911 120.055 102.409 131.723C91.9096 143.391 86.4454 158.737 87.2083 174.417V236.708H74.75C64.8416 236.72 55.3404 240.66 48.3343 247.668C41.3268 254.674 37.3865 264.175 37.375 274.083V398.667C37.3867 408.575 41.3266 418.076 48.3343 425.082C55.3404 432.09 64.8416 436.03 74.75 436.042H87.2083V473.417C87.2083 477.867 89.5832 481.98 93.4375 484.207C97.2918 486.432 102.042 486.432 105.896 484.207C109.75 481.98 112.125 477.866 112.125 473.417V436.042H485.875V473.417C485.875 477.867 488.25 481.98 492.104 484.207C495.958 486.432 500.708 486.432 504.563 484.207C508.417 481.98 510.792 477.866 510.792 473.417V436.042H523.25C533.158 436.03 542.66 432.09 549.666 425.082C556.673 418.076 560.614 408.575 560.625 398.667V274.083C560.613 264.175 556.673 254.674 549.666 247.668C542.66 240.66 533.158 236.72 523.25 236.708ZM143.271 137.042H454.729C463.783 137.949 472.117 142.373 477.941 149.364C483.765 156.352 486.615 165.349 485.875 174.417V239.006C478.608 241.565 472.313 246.311 467.851 252.593C463.39 258.873 460.982 266.381 460.958 274.086V336.377H137.042V274.086C137.018 266.381 134.61 258.873 130.149 252.593C125.687 246.312 119.392 241.566 112.125 239.006V174.417C111.385 165.349 114.235 156.352 120.059 149.364C125.884 142.374 134.217 137.949 143.271 137.042V137.042ZM62.2917 398.667V274.083C62.2936 270.78 63.6076 267.613 65.9435 265.277C68.2794 262.941 71.4466 261.627 74.7501 261.625H99.6667C102.97 261.627 106.137 262.941 108.473 265.277C110.809 267.613 112.123 270.78 112.125 274.083V411.125H74.7501C71.4467 411.123 68.2797 409.809 65.9436 407.473C63.6074 405.137 62.2937 401.97 62.2917 398.667L62.2917 398.667ZM137.042 361.292H460.958V411.125H137.042V361.292ZM535.708 398.667C535.706 401.97 534.392 405.137 532.056 407.473C529.721 409.809 526.553 411.123 523.25 411.125H485.875V274.083C485.877 270.78 487.191 267.613 489.527 265.277C491.863 262.941 495.03 261.627 498.333 261.625H523.25C526.553 261.627 529.72 262.941 532.057 265.277C534.393 267.613 535.706 270.78 535.708 274.083L535.708 398.667Z" fill="black" fill-opacity="0.4"/>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -0,0 +1,10 @@
<svg width="300" height="300" viewBox="0 0 300 300" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M182.019 181.218C123.429 239.83 67.543 258.769 54.9241 245.243C51.3182 241.636 51.3182 236.226 51.3182 231.717C51.3182 207.37 74.7548 160.481 124.331 114.489C129.74 109.98 129.74 101.864 125.233 96.454C120.725 91.0438 112.612 91.0438 107.204 95.5525C95.4866 106.373 85.5713 117.194 76.5569 128.016C51.3181 89.242 45.9096 61.2866 54.0213 52.2701C63.9367 42.351 100.894 50.4672 144.162 82.9291C157.683 92.8482 171.203 104.57 183.823 117.196C193.738 127.115 203.654 137.936 211.767 148.757C202.754 160.48 192.838 170.399 182.021 181.22L182.019 181.218ZM246.019 54.0753C255.033 63.0928 248.724 91.9498 225.287 128.918C217.174 118.999 209.062 109.982 200.048 100.063C191.034 91.0451 181.119 82.0274 171.204 73.9125C209.064 49.5654 237.006 45.0578 246.019 54.0753ZM264.048 36.04C243.316 15.3002 200.047 24.318 150.471 58.5842C100.894 24.317 56.7244 15.3005 35.9947 36.04C15.2627 56.7799 24.2771 99.1619 59.4313 149.66C38.6993 179.417 26.0793 208.272 26.0793 231.718C26.0793 247.949 32.3888 257.868 36.896 263.278C45.0091 271.394 54.9244 275 67.5433 275C105.403 275 158.583 241.635 200.049 200.157C209.063 191.14 218.077 181.22 225.288 171.301C249.625 209.176 255.034 237.128 246.02 246.144C238.809 253.357 218.076 250.653 193.739 238.028C187.43 235.322 180.218 237.127 176.613 243.438C173.008 249.75 175.712 256.965 182.022 260.571C200.951 270.49 218.979 274.999 232.501 274.999C245.121 274.999 255.036 271.391 263.148 263.277C283.88 242.537 274.866 199.252 240.612 149.657C272.163 105.473 286.583 59.4852 264.05 36.0397L264.048 36.04Z" fill="url(#paint0_radial_1352_397)"/>
<path d="M175.414 154.169C175.414 171.6 161.29 185.729 143.866 185.729C126.441 185.729 112.317 171.6 112.317 154.169C112.317 136.738 126.441 122.609 143.866 122.609C161.29 122.609 175.414 136.738 175.414 154.169Z" fill="#E11C1C"/>
<defs>
<radialGradient id="paint0_radial_1352_397" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(150 150) rotate(90) scale(125)">
<stop offset="0.135417" stop-color="#E11C1C"/>
<stop offset="1" stop-color="#FF8C22"/>
</radialGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -0,0 +1,4 @@
<svg width="300" height="300" viewBox="0 0 300 300" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M182.019 181.218C123.429 239.83 67.543 258.769 54.9241 245.243C51.3182 241.636 51.3182 236.226 51.3182 231.717C51.3182 207.37 74.7548 160.481 124.331 114.489C129.74 109.98 129.74 101.864 125.233 96.454C120.725 91.0438 112.612 91.0438 107.204 95.5525C95.4866 106.373 85.5713 117.194 76.5569 128.016C51.3181 89.242 45.9096 61.2866 54.0213 52.2701C63.9367 42.351 100.894 50.4672 144.162 82.9291C157.683 92.8482 171.203 104.57 183.823 117.196C193.738 127.115 203.654 137.936 211.767 148.757C202.754 160.48 192.838 170.399 182.021 181.22L182.019 181.218ZM246.019 54.0753C255.033 63.0928 248.724 91.9498 225.287 128.918C217.174 118.999 209.062 109.982 200.048 100.063C191.034 91.0451 181.119 82.0274 171.204 73.9125C209.064 49.5654 237.006 45.0578 246.019 54.0753ZM264.048 36.04C243.316 15.3002 200.047 24.318 150.471 58.5842C100.894 24.317 56.7244 15.3005 35.9947 36.04C15.2627 56.7799 24.2771 99.1619 59.4313 149.66C38.6993 179.417 26.0793 208.272 26.0793 231.718C26.0793 247.949 32.3888 257.868 36.896 263.278C45.0091 271.394 54.9244 275 67.5433 275C105.403 275 158.583 241.635 200.049 200.157C209.063 191.14 218.077 181.22 225.288 171.301C249.625 209.176 255.034 237.128 246.02 246.144C238.809 253.357 218.076 250.653 193.739 238.028C187.43 235.322 180.218 237.127 176.613 243.438C173.008 249.75 175.712 256.965 182.022 260.571C200.951 270.49 218.979 274.999 232.501 274.999C245.121 274.999 255.036 271.391 263.148 263.277C283.88 242.537 274.866 199.252 240.612 149.657C272.163 105.473 286.583 59.4852 264.05 36.0397L264.048 36.04Z" fill="black" fill-opacity="0.36"/>
<path d="M175.414 154.169C175.414 171.6 161.29 185.729 143.866 185.729C126.441 185.729 112.317 171.6 112.317 154.169C112.317 136.738 126.441 122.609 143.866 122.609C161.29 122.609 175.414 136.738 175.414 154.169Z" fill="black" fill-opacity="0.36"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -0,0 +1,4 @@
<svg width="300" height="300" viewBox="0 0 300 300" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M182.019 181.218C123.429 239.83 67.543 258.769 54.9241 245.243C51.3182 241.636 51.3182 236.226 51.3182 231.717C51.3182 207.37 74.7548 160.481 124.331 114.489C129.74 109.98 129.74 101.864 125.233 96.454C120.725 91.0438 112.612 91.0438 107.204 95.5525C95.4866 106.373 85.5713 117.194 76.5569 128.016C51.3181 89.242 45.9096 61.2866 54.0213 52.2701C63.9367 42.351 100.894 50.4672 144.162 82.9291C157.683 92.8482 171.203 104.57 183.823 117.196C193.738 127.115 203.654 137.936 211.767 148.757C202.754 160.48 192.838 170.399 182.021 181.22L182.019 181.218ZM246.019 54.0753C255.033 63.0928 248.724 91.9498 225.287 128.918C217.174 118.999 209.062 109.982 200.048 100.063C191.034 91.0451 181.119 82.0274 171.204 73.9125C209.064 49.5654 237.006 45.0578 246.019 54.0753ZM264.048 36.04C243.316 15.3002 200.047 24.318 150.471 58.5842C100.894 24.317 56.7244 15.3005 35.9947 36.04C15.2627 56.7799 24.2771 99.1619 59.4313 149.66C38.6993 179.417 26.0793 208.272 26.0793 231.718C26.0793 247.949 32.3888 257.868 36.896 263.278C45.0091 271.394 54.9244 275 67.5433 275C105.403 275 158.583 241.635 200.049 200.157C209.063 191.14 218.077 181.22 225.288 171.301C249.625 209.176 255.034 237.128 246.02 246.144C238.809 253.357 218.076 250.653 193.739 238.028C187.43 235.322 180.218 237.127 176.613 243.438C173.008 249.75 175.712 256.965 182.022 260.571C200.951 270.49 218.979 274.999 232.501 274.999C245.121 274.999 255.036 271.391 263.148 263.277C283.88 242.537 274.866 199.252 240.612 149.657C272.163 105.473 286.583 59.4852 264.05 36.0397L264.048 36.04Z" fill="white"/>
<path d="M175.414 154.169C175.414 171.6 161.29 185.729 143.866 185.729C126.441 185.729 112.317 171.6 112.317 154.169C112.317 136.738 126.441 122.609 143.866 122.609C161.29 122.609 175.414 136.738 175.414 154.169Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -58,7 +58,7 @@ qt_env.Program("qt/spinner", ["qt/spinner.cc"], LIBS=qt_libs)
qt_src = ["main.cc", "qt/sidebar.cc", "qt/onroad.cc", "qt/body.cc",
"qt/window.cc", "qt/home.cc", "qt/offroad/settings.cc",
"qt/offroad/software_settings.cc", "qt/offroad/onboarding.cc",
"qt/offroad/driverview.cc"]
"qt/offroad/driverview.cc", "qt/offroad/experimental_mode.cc"]
qt_env.Program("_ui", qt_src + [asset_obj], LIBS=qt_libs)
if GetOption('test'):
qt_src.remove("main.cc") # replaced by test_runner

@ -4,6 +4,7 @@
#include <QMouseEvent>
#include <QVBoxLayout>
#include "selfdrive/ui/qt/offroad/experimental_mode.h"
#include "selfdrive/ui/qt/util.h"
#include "selfdrive/ui/qt/widgets/drive_stats.h"
#include "selfdrive/ui/qt/widgets/prime.h"
@ -22,7 +23,8 @@ HomeWindow::HomeWindow(QWidget* parent) : QWidget(parent) {
slayout = new QStackedLayout();
main_layout->addLayout(slayout);
home = new OffroadHome();
home = new OffroadHome(this);
QObject::connect(home, &OffroadHome::openSettings, this, &HomeWindow::openSettings);
slayout->addWidget(home);
onroad = new OnroadWindow(this);
@ -128,11 +130,24 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) {
main_layout->addSpacing(25);
center_layout = new QStackedLayout();
// Vertical experimental button and drive stats layout
QWidget* statsAndExperimentalModeButtonWidget = new QWidget(this);
QVBoxLayout* statsAndExperimentalModeButton = new QVBoxLayout(statsAndExperimentalModeButtonWidget);
statsAndExperimentalModeButton->setSpacing(30);
statsAndExperimentalModeButton->setMargin(0);
ExperimentalModeButton *experimental_mode = new ExperimentalModeButton(this);
QObject::connect(experimental_mode, &ExperimentalModeButton::openSettings, this, &OffroadHome::openSettings);
statsAndExperimentalModeButton->addWidget(experimental_mode, 1);
statsAndExperimentalModeButton->addWidget(new DriveStats, 1);
// Horizontal experimental + drive stats and setup widget
QWidget* statsAndSetupWidget = new QWidget(this);
QHBoxLayout* statsAndSetup = new QHBoxLayout(statsAndSetupWidget);
statsAndSetup->setMargin(0);
statsAndSetup->setSpacing(30);
statsAndSetup->addWidget(new DriveStats, 1);
statsAndSetup->addWidget(statsAndExperimentalModeButtonWidget, 1);
statsAndSetup->addWidget(new SetupWidget);
center_layout->addWidget(statsAndSetupWidget);

@ -22,6 +22,9 @@ class OffroadHome : public QFrame {
public:
explicit OffroadHome(QWidget* parent = 0);
signals:
void openSettings(int index = 0, const QString &param = "");
private:
void showEvent(QShowEvent *event) override;
void hideEvent(QHideEvent *event) override;
@ -45,7 +48,7 @@ public:
explicit HomeWindow(QWidget* parent = 0);
signals:
void openSettings();
void openSettings(int index = 0, const QString &param = "");
void closeSettings();
public slots:

@ -0,0 +1,75 @@
#include "selfdrive/ui/qt/offroad/experimental_mode.h"
#include <QDebug>
#include <QHBoxLayout>
#include <QPainter>
#include <QStyle>
#include "selfdrive/ui/ui.h"
ExperimentalModeButton::ExperimentalModeButton(QWidget *parent) : QPushButton(parent) {
chill_pixmap = QPixmap("../assets/img_couch.svg").scaledToWidth(img_width, Qt::SmoothTransformation);
experimental_pixmap = QPixmap("../assets/img_experimental_grey.svg").scaledToWidth(img_width, Qt::SmoothTransformation);
// go to toggles and expand experimental mode description
connect(this, &QPushButton::clicked, [=]() { emit openSettings(2, "ExperimentalMode"); });
setFixedHeight(125);
QHBoxLayout *main_layout = new QHBoxLayout;
main_layout->setContentsMargins(horizontal_padding, 0, horizontal_padding, 0);
mode_label = new QLabel;
mode_icon = new QLabel;
mode_icon->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
main_layout->addWidget(mode_label, 1, Qt::AlignLeft);
main_layout->addWidget(mode_icon, 0, Qt::AlignRight);
setLayout(main_layout);
setStyleSheet(R"(
QPushButton {
border: none;
}
QLabel {
font-size: 45px;
font-weight: 300;
text-align: left;
font-family: JetBrainsMono;
color: #000000;
}
)");
}
void ExperimentalModeButton::paintEvent(QPaintEvent *event) {
QPainter p(this);
p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::Antialiasing);
QPainterPath path;
path.addRoundedRect(rect(), 10, 10);
// gradient
bool pressed = isDown();
QLinearGradient gradient(rect().left(), 0, rect().right(), 0);
if (experimental_mode) {
gradient.setColorAt(0, QColor(255, 155, 63, pressed ? 0xcc : 0xff));
gradient.setColorAt(1, QColor(219, 56, 34, pressed ? 0xcc : 0xff));
} else {
gradient.setColorAt(0, QColor(20, 255, 171, pressed ? 0xcc : 0xff));
gradient.setColorAt(1, QColor(35, 149, 255, pressed ? 0xcc : 0xff));
}
p.fillPath(path, gradient);
// vertical line
p.setPen(QPen(QColor(0, 0, 0, 0x4d), 3, Qt::SolidLine));
int line_x = rect().right() - img_width - (2 * horizontal_padding);
p.drawLine(line_x, rect().bottom(), line_x, rect().top());
}
void ExperimentalModeButton::showEvent(QShowEvent *event) {
experimental_mode = params.getBool("ExperimentalMode");
mode_icon->setPixmap(experimental_mode ? experimental_pixmap : chill_pixmap);
mode_label->setText(experimental_mode ? tr("EXPERIMENTAL MODE ON") : tr("CHILL MODE ON"));
}

@ -0,0 +1,31 @@
#pragma once
#include <QLabel>
#include <QPushButton>
#include "common/params.h"
class ExperimentalModeButton : public QPushButton {
Q_OBJECT
public:
explicit ExperimentalModeButton(QWidget* parent = 0);
signals:
void openSettings(int index = 0, const QString &toggle = "");
private:
void showEvent(QShowEvent *event) override;
Params params;
bool experimental_mode;
int img_width = 100;
int horizontal_padding = 30;
QPixmap experimental_pixmap;
QPixmap chill_pixmap;
QLabel *mode_label;
QLabel *mode_icon;
protected:
void paintEvent(QPaintEvent *event) override;
};

@ -39,7 +39,7 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
"ExperimentalMode",
tr("Experimental Mode"),
"",
"../assets/offroad/icon_road.png",
"../assets/img_experimental_white.svg",
},
{
"ExperimentalLongitudinalEnabled",
@ -100,6 +100,7 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
}
// Toggles with confirmation dialogs
toggles["ExperimentalMode"]->setActiveIcon("../assets/img_experimental.svg");
toggles["ExperimentalMode"]->setConfirmation(true, true);
toggles["ExperimentalLongitudinalEnabled"]->setConfirmation(true, false);
@ -108,6 +109,10 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
});
}
void TogglesPanel::expandToggleDescription(const QString &param) {
toggles[param.toStdString()]->showDescription();
}
void TogglesPanel::showEvent(QShowEvent *event) {
updateToggles();
}
@ -299,8 +304,15 @@ void DevicePanel::poweroff() {
}
void SettingsWindow::showEvent(QShowEvent *event) {
panel_widget->setCurrentIndex(0);
nav_btns->buttons()[0]->setChecked(true);
setCurrentPanel(0);
}
void SettingsWindow::setCurrentPanel(int index, const QString &param) {
panel_widget->setCurrentIndex(index);
nav_btns->buttons()[index]->setChecked(true);
if (!param.isEmpty()) {
emit expandToggleDescription(param);
}
}
SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
@ -341,10 +353,13 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
QObject::connect(device, &DevicePanel::reviewTrainingGuide, this, &SettingsWindow::reviewTrainingGuide);
QObject::connect(device, &DevicePanel::showDriverView, this, &SettingsWindow::showDriverView);
TogglesPanel *toggles = new TogglesPanel(this);
QObject::connect(this, &SettingsWindow::expandToggleDescription, toggles, &TogglesPanel::expandToggleDescription);
QList<QPair<QString, QWidget *>> panels = {
{tr("Device"), device},
{tr("Network"), new Networking(this)},
{tr("Toggles"), new TogglesPanel(this)},
{tr("Toggles"), toggles},
{tr("Software"), new SoftwarePanel(this)},
};

@ -17,6 +17,7 @@ class SettingsWindow : public QFrame {
public:
explicit SettingsWindow(QWidget *parent = 0);
void setCurrentPanel(int index, const QString &param = "");
protected:
void showEvent(QShowEvent *event) override;
@ -25,6 +26,7 @@ signals:
void closeSettings();
void reviewTrainingGuide();
void showDriverView();
void expandToggleDescription(const QString &param);
private:
QPushButton *sidebar_alert_widget;
@ -56,6 +58,9 @@ public:
explicit TogglesPanel(SettingsWindow *parent);
void showEvent(QShowEvent *event) override;
public slots:
void expandToggleDescription(const QString &param);
private:
Params params;
std::map<std::string, ParamControl*> toggles;

@ -174,6 +174,7 @@ AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* par
pm = std::make_unique<PubMaster, const std::initializer_list<const char *>>({"uiDebug"});
engage_img = loadPixmap("../assets/img_chffr_wheel.png", {img_size, img_size});
experimental_img = loadPixmap("../assets/img_experimental.svg", {img_size - 5, img_size - 5});
dm_img = loadPixmap("../assets/img_driver_face.png", {img_size, img_size});
}
@ -378,8 +379,9 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
// engage-ability icon
if (engageable) {
SubMaster &sm = *(uiState()->sm);
drawIcon(p, rect().right() - radius / 2 - bdr_s * 2, radius / 2 + int(bdr_s * 1.5),
engage_img, bg_colors[status], 1.0);
sm["controlsState"].getControlsState().getExperimentalMode() ? experimental_img : engage_img, blackColor(166), 1.0);
}
// dm icon
@ -409,7 +411,7 @@ void AnnotatedCameraWidget::drawIcon(QPainter &p, int x, int y, QPixmap &img, QB
p.setBrush(bg);
p.drawEllipse(x - radius / 2, y - radius / 2, radius, radius);
p.setOpacity(opacity);
p.drawPixmap(x - img_size / 2, y - img_size / 2, img);
p.drawPixmap(x - img.size().width() / 2, y - img.size().height() / 2, img);
}

@ -51,6 +51,7 @@ private:
void drawText(QPainter &p, int x, int y, const QString &text, int alpha = 255);
QPixmap engage_img;
QPixmap experimental_img;
QPixmap dm_img;
const int radius = 192;
const int img_size = (radius / 2) * 1.5;

@ -20,7 +20,7 @@ public:
explicit Sidebar(QWidget* parent = 0);
signals:
void openSettings();
void openSettings(int index = 0, const QString &param = "");
void valueChanged();
public slots:

@ -53,6 +53,7 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
QFontDatabase::addApplicationFont("../assets/fonts/Inter-Regular.ttf");
QFontDatabase::addApplicationFont("../assets/fonts/Inter-SemiBold.ttf");
QFontDatabase::addApplicationFont("../assets/fonts/Inter-Thin.ttf");
QFontDatabase::addApplicationFont("../assets/fonts/JetBrainsMono-Medium.ttf");
// no outline to prevent the focus rectangle
setStyleSheet(R"(
@ -64,8 +65,9 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
setAttribute(Qt::WA_NoSystemBackground);
}
void MainWindow::openSettings() {
void MainWindow::openSettings(int index, const QString &param) {
main_layout->setCurrentWidget(settingsWindow);
settingsWindow->setCurrentPanel(index, param);
}
void MainWindow::closeSettings() {

@ -15,7 +15,7 @@ public:
private:
bool eventFilter(QObject *obj, QEvent *event) override;
void openSettings();
void openSettings(int index = 0, const QString &param = "");
void closeSettings();
Device device;

@ -281,6 +281,17 @@
<translation></translation>
</message>
</context>
<context>
<name>ExperimentalModeButton</name>
<message>
<source>EXPERIMENTAL MODE ON</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CHILL MODE ON</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InputDialog</name>
<message>

@ -281,6 +281,17 @@
<translation> </translation>
</message>
</context>
<context>
<name>ExperimentalModeButton</name>
<message>
<source>EXPERIMENTAL MODE ON</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CHILL MODE ON</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InputDialog</name>
<message>

@ -281,6 +281,17 @@
<translation>câmera iniciando</translation>
</message>
</context>
<context>
<name>ExperimentalModeButton</name>
<message>
<source>EXPERIMENTAL MODE ON</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CHILL MODE ON</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InputDialog</name>
<message>

@ -281,6 +281,17 @@
<translation></translation>
</message>
</context>
<context>
<name>ExperimentalModeButton</name>
<message>
<source>EXPERIMENTAL MODE ON</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CHILL MODE ON</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InputDialog</name>
<message>

@ -281,6 +281,17 @@
<translation></translation>
</message>
</context>
<context>
<name>ExperimentalModeButton</name>
<message>
<source>EXPERIMENTAL MODE ON</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CHILL MODE ON</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InputDialog</name>
<message>

Loading…
Cancel
Save