12#include <QtCore/QOperatingSystemVersion>
13#include <QtCore/QString>
15#include <QtGui/QGuiApplication>
51static inline QString statusLabelStyle(
const QString &bg =
"#6699ff",
52 const QString &fg =
"#000000") {
53#if defined(Q_OS_MACOS)
54 return QStringLiteral(
"QLabel{background-color: %1; color: %2; "
55 "border-radius: 6px; padding: 2px 8px; "
56 "border: 1px solid rgba(0,0,0,0.15)}")
58#elif defined(Q_OS_WIN)
59 return QStringLiteral(
"QLabel{background-color:%1; color:%2; "
60 "border-radius:4px; padding:0px 8px; "
61 "border:1px solid rgba(0,0,0,0.25)}")
64 return QStringLiteral(
"QLabel{background-color:%1; color:%2; "
65 "border-radius:1px; padding:1px 6px; "
66 "border:1px inset rgba(0,0,0,0.18)}")
71enum class TxStatusAppearance {
80static inline QString makeStyle(
const QString &bg,
const QString &fg) {
81#if defined(Q_OS_LINUX)
82 return QString(
"QLabel{background-color:%1; color:%2; "
83 "border-radius:1px; padding:1px 6px; "
84 "border:1px inset rgba(0,0,0,0.18);}")
86#elif defined(Q_OS_WIN)
87 return QString(
"QLabel{background-color:%1; color:%2; "
88 "border-radius:4px; padding:0px 8px; "
89 "border:1px solid rgba(0,0,0,0.25);}")
91#elif defined(Q_OS_MACOS)
92 return QString(
"QLabel{background-color:%1; color:%2; "
93 "border-radius:6px; padding:2px 8px; "
94 "border:1px solid rgba(0,0,0,0.15);}")
97 return QString(
"QLabel{background-color:%1; color:%2;}").arg(bg, fg);
102 switch (appearance) {
103 case TxStatusAppearance::Receiving:
104 return makeStyle(
"#22ff22",
"#000000");
105 case TxStatusAppearance::Transmitting:
106 return makeStyle(
"#ff2222",
"#000000");
107 case TxStatusAppearance::Decoding:
108 return makeStyle(
"#22ff22",
"#000000");
109 case TxStatusAppearance::IdleTimeout:
110 return makeStyle(
"#000000",
"#ffffff");
132static inline QString progress_bar_stylesheet(
bool small =
false) {
133 const QString base = QString(
"QProgressBar {"
135 " background-color: #ffffff;"
137 " text-align: center;"
141 "QProgressBar::chunk {"
142 " background-color: #a5cdff;"
143 " border-radius: %2px;"
147 const int height = small ? 10 : 14;
148 const int radius = small ? 3 : 5;
149 const QString barDim =
150 QString(
"min-height:%1px; max-height:%1px; border-radius:%2px;")
153 const QString chunkDim = QString(
"min-height:%1px;").arg(height);
154 return base.arg(barDim, QString::number(radius), chunkDim);
183 background-color: #6699ff;
190 font-family: "Segoe UI";
193 background-color: #4d7fff;
196 QPushButton:pressed {
197 background-color: #003EAA;
199 QPushButton:disabled {
200 background-color: #ececec;
205#elif defined(Q_OS_MACOS)
208 background-color: #6699ff;
215 font-family: "-apple-system";
218 background-color: #4d7fff;
221 QPushButton:pressed {
222 background-color: #003EAA;
224 QPushButton:disabled {
225 background-color: #ececec;
230#elif defined(Q_OS_LINUX)
233 background-color: #6699ff;
238 font-family: "Ubuntu", "Noto Sans";
241 background-color: #4d7fff;
243 QPushButton:pressed {
244 background-color: #003EAA;
246 QPushButton:disabled {
247 background-color: #ececec;
259static inline QString logFrameStyle() {
260#if defined(Q_OS_MACOS)
261 return QStringLiteral(
"QFrame#frame { background-color: #F2F2F0; }"
262 "QLabel#currentFreq {"
264 " background-color: black;"
265 " border-radius:6px; padding:0px 8px; "
266 " font-family: Monaco, 'Courier New', monospace;"
268 " font-weight: bold;"
272#elif defined(Q_OS_WIN)
273 return QStringLiteral(
"QFrame#frame { background-color: #DDEEFF; }"
274 "QLabel#currentFreq {"
276 " background-color: black;"
277 " border-radius:4px; padding:0px 8px; "
278 " font-family: Consolas, 'Courier New', monospace;"
280 " font-weight: bold;"
285 return QStringLiteral(
"QFrame#frame { background-color: #F2F2F0; }"
286 "QLabel#currentFreq {"
288 " background-color: black;"
289 " border-radius:0px; padding:0px 8px; "
291 " font-weight: bold;"
315#if defined(Q_OS_MACOS)
318constexpr const char *LogWidgetStyle =
319 "QFrame#logWidget { background-color: #F2F2F0; }";
321constexpr const char *DialFreqUpDownButtonStyle =
323 " background-color: #000000;"
327 " border-radius:2px;"
329 "QPushButton:pressed {"
330 " background-color: #222;"
336 auto *layout =
new QHBoxLayout(
this);
337 auto *caption =
new QLabel(
"Offset:",
this);
338 caption->setStyleSheet(
"QLabel { color: black; }");
339 slider =
new QSlider(Qt::Horizontal,
this);
341 slider->setStyleSheet(R
"(
343 background: transparent;
346 QSlider::groove:horizontal {
347 border: 1px solid #b0b0b0;
352 QSlider::handle:horizontal {
354 border: 1px solid #c2c8d1;
359 QSlider::sub-page:horizontal {
363 QSlider::add-page:horizontal {
368 slider->setRange(0, 3000);
369 slider->setValue(1500);
370 valueLabel = new QLabel(
"0 Hz",
this);
371 valueLabel->setStyleSheet(
"QLabel { color: black; }");
372 valueLabel->setMinimumWidth(60);
373 layout->addWidget(caption);
374 layout->addWidget(slider, 1);
375 layout->addWidget(valueLabel);
376 connect(slider, &QSlider::valueChanged,
this, [
this](
int val) {
377 valueLabel->setText(QString(
"%1 Hz").arg(val));
378 if (onValueChanged) onValueChanged(val);
382 int offset()
const {
return slider->value(); }
383 void setValue(
int hz) { slider->setValue(hz); }
384 void setOnValueChanged(std::function<
void(
int)> cb) { onValueChanged = cb; }
389 std::function<void(
int)> onValueChanged;
392constexpr const char *LabCallsignStyle =
"QLabel {"
398constexpr const char *LabUTCStyle =
400 " border-radius:6px;"
403 " font-family: Monaco, 'Courier New', monospace;"
404 " font-weight: bold;"
405 " background-color: black;"
409constexpr const char *ButtonGridStyle =
411 " background-color:lightgray;"
412 " padding:0.25em 0.25em; font-weight:normal;"
413 " border-style:solid;"
415 " border-radius:6px;"
417 "QPushButton:checked {"
418 " background-color:#6699ff;"
421constexpr const char *MonitorTxButtonStyle =
423 " background-color:lightgray;"
425 " padding:0.25em 0.25em; font-weight:normal;"
426 " border-style:solid;"
428 " border-radius:6px;"
430 "QPushButton:checked {"
431 " background-color:#22FF22;"
434 "QPushButton[transmitting=\"true\"] {"
435 " background-color:#FF2222;"
439constexpr const char *MonitorButtonStyle =
441 " background-color:lightgray;"
443 " padding:0.25em 0.25em; font-weight:normal;"
444 " border-style:solid;"
446 " border-radius:6px;"
448 "QPushButton:checked {"
449 " background-color:#22FF22;"
453constexpr const char *LogQSOButtonStyle =
455 " background-color:#6699ff;"
457 " padding:0.25em 0.25em; font-weight:normal;"
458 " border-style:solid;"
460 " border-radius:6px;"
462 "QPushButton:checked {"
463 " background-color:#6699ff;"
467constexpr const char *TuneButtonStyle =
469 " background-color:lightgray;"
471 " padding:0.25em 0.25em; font-weight:normal;"
472 " border-style:solid;"
474 " border-radius:6px;"
476 "QPushButton:checked {"
477 " background-color:#6699ff;"
481constexpr const char *ModeButtonStyle =
483 " padding:0.25em 0.25em; font-weight:bold;"
484 " border-style:solid;"
486 " border-radius:6px;"
487 " background-color:#6699ff;"
490 "QPushButton:checked {"
491 " background-color:#6699ff;"
495constexpr const char *SpotButtonStyle =
497 " background-color:lightgray;"
499 " padding:0.25em 0.25em; font-weight:normal;"
500 " border-style:solid;"
502 " border-radius:6px;"
504 "QPushButton:checked {"
505 " background-color:#6699ff;"
510#elif defined(Q_OS_WIN)
513constexpr const char *LogWidgetStyle =
514 "QFrame#logWidget { background-color: #DDEEFF; }";
516constexpr const char *DialFreqUpDownButtonStyle =
518 " background-color: #000000;"
522 " border-radius:2px;"
524 "QPushButton:pressed {"
525 " background-color: #222;"
528class OffsetSliderWidget :
public QWidget {
530 explicit OffsetSliderWidget(QWidget *parent =
nullptr) : QWidget(parent) {
531 auto *layout =
new QHBoxLayout(
this);
532 auto *caption =
new QLabel(
"Offset:",
this);
533 caption->setStyleSheet(
"QLabel { color: black; }");
534 slider =
new QSlider(Qt::Horizontal,
this);
536 slider->setStyleSheet(R
"(
538 background: transparent;
541 QSlider::groove:horizontal {
542 border: 1px solid #b0b0b0;
547 QSlider::handle:horizontal {
549 border: 1px solid #c2c8d1;
554 QSlider::sub-page:horizontal {
558 QSlider::add-page:horizontal {
563 slider->setRange(0, 3000);
564 slider->setValue(1500);
565 valueLabel = new QLabel(
"0 Hz",
this);
566 valueLabel->setStyleSheet(
"QLabel { color: black; }");
567 valueLabel->setMinimumWidth(60);
568 layout->addWidget(caption);
569 layout->addWidget(slider, 1);
570 layout->addWidget(valueLabel);
571 connect(slider, &QSlider::valueChanged,
this, [
this](
int val) {
572 valueLabel->setText(QString(
"%1 Hz").arg(val));
573 if (onValueChanged) onValueChanged(val);
577 int offset()
const {
return slider->value(); }
578 void setValue(
int hz) { slider->setValue(hz); }
579 void setOnValueChanged(std::function<
void(
int)> cb) { onValueChanged = cb; }
584 std::function<void(
int)> onValueChanged;
587constexpr const char *LabCallsignStyle =
"QLabel {"
593constexpr const char *LabUTCStyle =
595 " border-radius:4px;"
598 " font-family: Consolas, 'Courier New', monospace;"
599 " font-weight: bold;"
600 " background-color: black;"
604constexpr const char *ButtonGridStyle =
606 " background-color:lightgray;"
607 " padding:0.25em 0.25em; font-weight:normal;"
608 " border-style:solid;"
610 " border-radius:4px;"
612 "QPushButton:checked {"
613 " background-color:#6699ff;"
616constexpr const char *MonitorTxButtonStyle =
618 " background-color:lightgray;"
620 " padding:0.25em 0.25em; font-weight:normal;"
621 " border-style:solid;"
623 " border-radius:4px;"
625 "QPushButton:checked {"
626 " background-color:#22FF22;"
629 "QPushButton[transmitting=\"true\"] {"
630 " background-color:#FF2222;"
634constexpr const char *MonitorButtonStyle =
636 " background-color:lightgray;"
638 " padding:0.25em 0.25em; font-weight:normal;"
639 " border-style:solid;"
641 " border-radius:4px;"
643 "QPushButton:checked {"
644 " background-color:#22FF22;"
648constexpr const char *LogQSOButtonStyle =
650 " background-color:lightgray;"
652 " padding:0.25em 0.25em; font-weight:normal;"
653 " border-style:solid;"
655 " border-radius:4px;"
657 "QPushButton:checked {"
658 " background-color:#6699ff;"
662constexpr const char *TuneButtonStyle = LogQSOButtonStyle;
664constexpr const char *ModeButtonStyle =
666 " padding:0.25em 0.25em; font-weight:bold;"
667 " border-style:solid;"
669 " border-radius:4px;"
670 " background-color:#6699ff;"
673 "QPushButton:checked {"
674 " background-color:#6699ff;"
678constexpr const char *SpotButtonStyle =
680 " background-color:lightgray;"
682 " padding:0.25em 0.25em; font-weight:normal;"
683 " border-style:solid;"
685 " border-radius:4px;"
687 "QPushButton:checked {"
688 " background-color:#6699ff;"
697constexpr const char *LogWidgetStyle =
698 "QFrame#logWidget { background-color: #F2F2F0; }";
701constexpr const char *DialFreqUpDownButtonStyle =
703 " background-color: #000000;"
707 " border-radius:0px;"
709 "QPushButton:pressed {"
710 " background-color: #222;"
713class OffsetSliderWidget :
public QWidget {
715 explicit OffsetSliderWidget(QWidget *parent =
nullptr) : QWidget(parent) {
716 auto *layout =
new QHBoxLayout(
this);
717 auto *caption =
new QLabel(
"Offset:",
this);
718 caption->setStyleSheet(
"QLabel { color: black; }");
719 slider =
new QSlider(Qt::Horizontal,
this);
721 slider->setStyleSheet(R
"(
723 background: transparent;
726 QSlider::groove:horizontal {
727 border: 1px solid #b0b0b0;
732 QSlider::handle:horizontal {
734 border: 1px solid #c2c8d1;
739 QSlider::sub-page:horizontal {
743 QSlider::add-page:horizontal {
748 slider->setRange(0, 3000);
749 slider->setValue(1500);
750 valueLabel = new QLabel(
"0 Hz",
this);
751 valueLabel->setStyleSheet(
"QLabel { color: black; }");
752 valueLabel->setMinimumWidth(60);
753 layout->addWidget(caption);
754 layout->addWidget(slider, 1);
755 layout->addWidget(valueLabel);
756 connect(slider, &QSlider::valueChanged,
this, [
this](
int val) {
757 valueLabel->setText(QString(
"%1 Hz").arg(val));
758 if (onValueChanged) onValueChanged(val);
762 int offset()
const {
return slider->value(); }
763 void setValue(
int hz) { slider->setValue(hz); }
764 void setOnValueChanged(std::function<
void(
int)> cb) { onValueChanged = cb; }
769 std::function<void(
int)> onValueChanged;
773constexpr const char *LabCallsignStyle =
"QLabel {"
780constexpr const char *LabUTCStyle =
782 " border-radius:0px;"
785 " font-family: \"DejaVu Sans Mono\", \"Liberation Mono\", \"Noto Mono\", \"Ubuntu Mono\", monospace;"
786 " font-weight: bold;"
787 " background-color: black;"
792constexpr const char *ButtonGridStyle =
794 " background-color:lightgray;"
795 " padding:0.25em 0.25em; font-weight:normal;"
796 " border-style:solid;"
798 " border-radius:0px;"
800 "QPushButton:checked {"
801 " background-color:#6699ff;"
805constexpr const char *MonitorTxButtonStyle =
807 " background-color:lightgray;"
808 " padding:0.25em 0.25em; font-weight:normal;"
809 " border-style:solid;"
811 " border-radius:0px;"
813 "QPushButton:checked {"
814 " background-color:#22FF22;"
816 "QPushButton[transmitting=\"true\"] {"
817 " background-color:#FF2222;"
821constexpr const char *MonitorButtonStyle =
823 " background-color:lightgray;"
824 " padding:0.25em 0.25em; font-weight:normal;"
825 " border-style:solid;"
827 " border-radius:0px;"
829 "QPushButton:checked {"
830 " background-color:#22FF22;"
834constexpr const char *LogQSOButtonStyle =
836 " background-color:lightgray;"
837 " padding:0.25em 0.25em; font-weight:normal;"
838 " border-style:solid;"
840 " border-radius:0px;"
842 "QPushButton:checked {"
843 " background-color:#6699ff;"
846constexpr const char *TuneButtonStyle = LogQSOButtonStyle;
849constexpr const char *ModeButtonStyle =
851 " padding:0.25em 0.25em; font-weight:bold;"
852 " border-style:solid;"
854 " border-radius:0px;"
855 " background-color:#6699ff;"
857 "QPushButton:checked {"
858 " background-color:#6699ff;"
862constexpr const char *SpotButtonStyle =
864 " background-color:lightgray;"
865 " padding:0.25em 0.25em; font-weight:normal;"
866 " border-style:solid;"
868 " border-radius:0px;"
870 "QPushButton:checked {"
871 " background-color:#6699ff;"
Defines platform-specific style constants for JS8Call's header bar controls.
QString buttonStyle()
Returns a platform-native QPushButton stylesheet.
Definition styles.h:179
QString txStatusLabelStyle(TxStatusAppearance appearance)
Returns the QSS stylesheet string for a given TX status state.
Definition styles.h:101