Skip to content

Commit

Permalink
Changed verification dialog colors for darkmode. Fixes #461. (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek authored Jul 22, 2024
1 parent e2030b6 commit ddebf12
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
14 changes: 8 additions & 6 deletions lib/radiolimits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -432,21 +432,23 @@ RadioLimitFrequencies::verify(const ConfigItem *item, const QMetaProperty &prop,
return false;
}

if (0 == _frequencyRanges.size())
return true;

Frequency value = prop.read(item).value<Frequency>();
foreach (const FrequencyRange &range, _frequencyRanges) {
if (range.contains(value))
return true;
}

if (context.ignoreFrequencyLimits() || (0 == _frequencyRanges.size()) || _warnOnly) {
auto &msg = context.newMessage(RadioLimitIssue::Warning);
msg << "Frequency " << value.inMHz() << "MHz is outside of allowed frequency ranges or "
<< "range cannot be determined.";
if (context.ignoreFrequencyLimits())
return true;
}

auto &msg = context.newMessage(RadioLimitIssue::Critical);
auto &msg = context.newMessage(RadioLimitIssue::Warning);
msg << "Frequency " << value.inMHz() << "MHz is outside of allowed frequency ranges.";

if(_warnOnly)
return true;
return false;
}

Expand Down
13 changes: 11 additions & 2 deletions src/verifydialog.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#include "verifydialog.hh"
#include "radiolimits.hh"
#include "application.hh"
#include <QPushButton>

VerifyDialog::VerifyDialog(const RadioLimitContext &issues, bool upload, QWidget *parent)
: QDialog(parent)
{
setupUi(this);

Application *app = qobject_cast<Application *>(QApplication::instance());

bool valid = true;
for (int i=0; i<issues.count(); i++) {
const RadioLimitIssue &issue = issues.message(i);
Expand All @@ -19,10 +22,16 @@ VerifyDialog::VerifyDialog(const RadioLimitContext &issues, bool upload, QWidget
item->setForeground(Qt::gray);
break;
case RadioLimitIssue::Warning:
item->setForeground(Qt::black);
if (app->isDarkMode())
item->setForeground(Qt::white);
else
item->setForeground(Qt::black);
break;
case RadioLimitIssue::Critical:
item->setForeground(Qt::red);
if (app->isDarkMode())
item->setForeground(Qt::red);
else
item->setForeground(Qt::darkRed);
valid = false;
break;
}
Expand Down

0 comments on commit ddebf12

Please sign in to comment.