Skip to content

Commit

Permalink
Spaces and braces
Browse files Browse the repository at this point in the history
  • Loading branch information
ulmus-scott committed Dec 23, 2021
1 parent da8350b commit 5c6ef1d
Showing 1 changed file with 41 additions and 30 deletions.
71 changes: 41 additions & 30 deletions mythtv/libs/libmyth/mythcontext.cpp
Expand Up @@ -57,7 +57,7 @@

#define LOC QString("MythContext: ")

#if QT_VERSION < QT_VERSION_CHECK(5,10,0)
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
#define qEnvironmentVariable getenv
#endif

Expand Down Expand Up @@ -306,7 +306,8 @@ void MythContextPrivate::EndTempWindow(void)
if (m_guiStartup && !m_guiStartup->m_Exit)
{
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
if (mainStack) {
if (mainStack)
{
mainStack->PopScreen(m_guiStartup, false);
m_guiStartup = nullptr;
}
Expand All @@ -328,7 +329,7 @@ bool MythContextPrivate::checkPort(QString &host, int port, std::chrono::seconds
{
PortChecker checker;
if (m_guiStartup)
QObject::connect(m_guiStartup,&GUIStartup::cancelPortCheck,&checker,&PortChecker::cancelPortCheck);
QObject::connect(m_guiStartup, &GUIStartup::cancelPortCheck, &checker, &PortChecker::cancelPortCheck);
return checker.checkPort(host, port, timeLimit);
}

Expand Down Expand Up @@ -374,7 +375,8 @@ bool MythContextPrivate::Init(const bool gui,
gCoreContext->SaveLocaleDefaults();

// Close GUI Startup Window.
if (m_guiStartup) {
if (m_guiStartup)
{
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
if (mainStack)
mainStack->PopScreen(m_guiStartup, false);
Expand Down Expand Up @@ -591,7 +593,8 @@ bool MythContextPrivate::LoadDatabaseSettings(void)
}
#else //elif defined Q_OS_ANDROID
#define ANDROID_EXCEPTION_CHECK \
if (env->ExceptionCheck()) { \
if (env->ExceptionCheck()) \
{ \
env->ExceptionClear(); \
exception=true; \
}
Expand All @@ -605,13 +608,13 @@ bool MythContextPrivate::LoadDatabaseSettings(void)
QAndroidJniObject activity = QtAndroid::androidActivity();
ANDROID_EXCEPTION_CHECK;
QAndroidJniObject appctx = activity.callObjectMethod
("getApplicationContext","()Landroid/content/Context;");
("getApplicationContext", "()Landroid/content/Context;");
ANDROID_EXCEPTION_CHECK;
QAndroidJniObject contentR = appctx.callObjectMethod
("getContentResolver", "()Landroid/content/ContentResolver;");
ANDROID_EXCEPTION_CHECK;
QAndroidJniObject androidId = QAndroidJniObject::callStaticObjectMethod
("android/provider/Settings$Secure","getString",
("android/provider/Settings$Secure", "getString",
"(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;",
contentR.object<jobject>(),
myID.object<jstring>());
Expand Down Expand Up @@ -703,7 +706,7 @@ bool MythContextPrivate::SaveDatabaseParams(

void MythContextSlotHandler::OnCloseDialog(void)
{
if (d && d->m_loop
if (d && d->m_loop
&& d->m_loop->isRunning())
d->m_loop->exit();
}
Expand Down Expand Up @@ -826,11 +829,10 @@ QString MythContextPrivate::TestDBconnection(bool prompt)
st_success = 6
} startupState = st_start;

static const std::array<const QString,7> kGuiStatuses
{"start","dbAwake","dbStarted","dbConnects","beWOL","beAwake",
"success" };
static const std::array<const QString, 7> kGuiStatuses
{"start", "dbAwake", "dbStarted", "dbConnects", "beWOL", "beAwake", "success"};

auto secondsStartupScreenDelay = gCoreContext->GetDurSetting<std::chrono::seconds>("StartupScreenDelay",2s);
auto secondsStartupScreenDelay = gCoreContext->GetDurSetting<std::chrono::seconds>("StartupScreenDelay", 2s);
auto msStartupScreenDelay = std::chrono::duration_cast<std::chrono::milliseconds>(secondsStartupScreenDelay);
do
{
Expand All @@ -845,7 +847,8 @@ QString MythContextPrivate::TestDBconnection(bool prompt)
port = 3306;
std::chrono::seconds wakeupTime = 3s;
int attempts = 11;
if (m_dbParams.m_wolEnabled) {
if (m_dbParams.m_wolEnabled)
{
wakeupTime = m_dbParams.m_wolReconnect;
attempts = m_dbParams.m_wolRetry + 1;
startupState = st_start;
Expand Down Expand Up @@ -903,7 +906,8 @@ QString MythContextPrivate::TestDBconnection(bool prompt)
m_guiStartup->setMessageState("empty");
processEvents();
}
switch (startupState) {
switch (startupState)
{
case st_start:
if (m_dbParams.m_wolEnabled)
{
Expand Down Expand Up @@ -959,7 +963,8 @@ QString MythContextPrivate::TestDBconnection(bool prompt)
startupState = st_beWOL;
}
}
else {
else
{
startupState = st_success;
break;
}
Expand All @@ -970,7 +975,8 @@ QString MythContextPrivate::TestDBconnection(bool prompt)
backendPort = MythCoreContext::GetMasterServerPort();
[[clang::fallthrough]];
case st_beWOL:
if (!beWOLCmd.isEmpty()) {
if (!beWOLCmd.isEmpty())
{
if (attempt > 0)
MythWakeup(beWOLCmd);
if (!checkPort(backendIP, backendPort, useTimeout))
Expand Down Expand Up @@ -1065,14 +1071,18 @@ void MythContextPrivate::ShowGuiStartup(void)
TempMainWindow(false);
MythMainWindow *mainWindow = GetMythMainWindow();
MythScreenStack *mainStack = mainWindow->GetMainStack();
if (mainStack) {
if (!m_guiStartup) {
m_guiStartup = new GUIStartup(mainStack,m_loop);
if (!m_guiStartup->Create()) {
if (mainStack)
{
if (!m_guiStartup)
{
m_guiStartup = new GUIStartup(mainStack, m_loop);
if (!m_guiStartup->Create())
{
delete m_guiStartup;
m_guiStartup = nullptr;
}
if (m_guiStartup) {
if (m_guiStartup)
{
mainStack->AddScreen(m_guiStartup, false);
processEvents();
}
Expand Down Expand Up @@ -1252,7 +1262,7 @@ bool MythContextPrivate::DefaultUPnP(QString& Error)

// ----------------------------------------------------------------------

std::chrono::milliseconds timeout_ms { 2s };
std::chrono::milliseconds timeout_ms {2s};
auto timeout_s = duration_cast<std::chrono::seconds>(timeout_ms);
LOG(VB_GENERAL, LOG_INFO, loc + QString("UPNP Search up to %1 secs")
.arg(timeout_s.count()));
Expand Down Expand Up @@ -1488,12 +1498,12 @@ bool MythContextPrivate::saveSettingsCache(void)
XmlConfiguration config = XmlConfiguration("cache/contextcache.xml");
for (const auto & setting : kSettingsToSave)
{
QString cacheValue = config.GetValue("Settings/"+setting,QString());
QString cacheValue = config.GetValue("Settings/"+setting, QString());
gCoreContext->ClearOverrideSettingForSession(setting);
QString value = gCoreContext->GetSetting(setting,QString());
QString value = gCoreContext->GetSetting(setting, QString());
if (value != cacheValue)
{
config.SetValue("Settings/"+setting,value);
config.SetValue("Settings/" + setting, value);
m_settingsCacheDirty = true;
}
}
Expand All @@ -1508,9 +1518,9 @@ void MythContextPrivate::loadSettingsCacheOverride(void) const
XmlConfiguration config = XmlConfiguration("cache/contextcache.xml");
for (const auto & setting : kSettingsToSave)
{
if (!gCoreContext->GetSetting(setting,QString()).isEmpty())
if (!gCoreContext->GetSetting(setting, QString()).isEmpty())
continue;
QString value = config.GetValue("Settings/"+setting,QString());
QString value = config.GetValue("Settings/"+setting, QString());
if (!value.isEmpty())
gCoreContext->OverrideSettingForSession(setting, value);
}
Expand All @@ -1522,13 +1532,13 @@ void MythContextPrivate::loadSettingsCacheOverride(void) const

void MythContextPrivate::clearSettingsCacheOverride(void)
{
QString language = gCoreContext->GetSetting("Language",QString());
QString language = gCoreContext->GetSetting("Language", QString());
for (const auto & setting : kSettingsToSave)
gCoreContext->ClearOverrideSettingForSession(setting);
// Restore power off TV setting
gCoreContext->ClearOverrideSettingForSession("PowerOffTVAllowed");

if (language != gCoreContext->GetSetting("Language",QString()))
if (language != gCoreContext->GetSetting("Language", QString()))
MythTranslation::load("mythfrontend");
}

Expand All @@ -1544,7 +1554,8 @@ MythContext::MythContext(QString binversion, bool needsBackend)
{
#ifdef _WIN32
static bool WSAStarted = false;
if (!WSAStarted) {
if (!WSAStarted)
{
WSADATA wsadata;
int res = WSAStartup(MAKEWORD(2, 0), &wsadata);
LOG(VB_SOCKET, LOG_INFO,
Expand Down

0 comments on commit 5c6ef1d

Please sign in to comment.