Skip to content

Commit

Permalink
Add debug setting to dump log
Browse files Browse the repository at this point in the history
  • Loading branch information
shermp committed Jan 14, 2024
1 parent 0c8588b commit ef13000
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/nc_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ void NCSettings::syncSettings()
}
settings.setValue(SL(Margin), marginStr);

auto debug = settings.value(debugKey, QVariant(false));
settings.setValue(debugKey, debug);

settings.sync();
}

Expand Down Expand Up @@ -150,3 +153,7 @@ void NCSettings::setMaxHMargin(QRect const& screenGeom)
maxHMargin = w / 4;
}

bool NCSettings::debugEnabled()
{
return settings.value(debugKey).toBool();
}
2 changes: 2 additions & 0 deletions src/nc_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ class NCSettings
BatteryType batteryType();
QString batteryLabel();
int margin();
bool debugEnabled();

private:
QSettings settings;
int maxHMargin = 200;
QString enabledKey = "Enabled";
QString batteryLabelKey = "LevelTemplate";
QString debugKey = "Debug";

void setMaxHMargin(QRect const& screenGeom);
Position position(QString const& group);
Expand Down
3 changes: 3 additions & 0 deletions src/nickelclock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,5 +322,8 @@ extern "C" __attribute__((visibility("default"))) void _nc_set_header_clock(Read
{
nc->settings.syncSettings();
nc->addItemsToFooter(_this);
if (nc->settings.debugEnabled()) {
nh_dump_log();
}
ReadingView__ReaderIsDoneLoading(_this);
}

0 comments on commit ef13000

Please sign in to comment.