Original file line number Diff line number Diff line change
Expand Up @@ -8,62 +8,13 @@ using namespace std;
// MythTV
#include <mythcontext.h>
#include <mythdb.h>
#include <mythdbcheck.h>

// mytharchive
#include "dbcheck.h"
#include "archivedbcheck.h"

const QString currentDatabaseVersion = "1005";

static bool UpdateDBVersionNumber(const QString &newnumber)
{

if (!gCoreContext->SaveSettingOnHost("ArchiveDBSchemaVer",newnumber,nullptr))
{
LOG(VB_GENERAL, LOG_ERR,
QString("DB Error (Setting new DB version number): %1\n")
.arg(newnumber));

return false;
}

return true;
}

static bool performActualUpdate(const QString updates[], const QString& version,
QString &dbver)
{
MSqlQuery query(MSqlQuery::InitCon());

LOG(VB_GENERAL, LOG_NOTICE,
"Upgrading to MythArchive schema version " + version);

int counter = 0;
QString thequery = updates[counter];

while (thequery != "")
{
if (!query.exec(thequery))
{
QString msg =
QString("DB Error (Performing database upgrade): \n"
"Query was: %1 \nError was: %2 \nnew version: %3")
.arg(thequery)
.arg(MythDB::DBErrorMessage(query.lastError()))
.arg(version);
LOG(VB_GENERAL, LOG_ERR, msg);
return false;
}

counter++;
thequery = updates[counter];
}

if (!UpdateDBVersionNumber(version))
return false;

dbver = version;
return true;
}
const QString MythArchiveVersionName = "ArchiveDBSchemaVer";

bool UpgradeArchiveDatabaseSchema(void)
{
Expand All @@ -77,7 +28,7 @@ bool UpgradeArchiveDatabaseSchema(void)
LOG(VB_GENERAL, LOG_INFO,
"Inserting MythArchive initial database information.");

const QString updates[] =
DBUpdates updates
{
"DROP TABLE IF EXISTS archiveitems;",

Expand All @@ -94,54 +45,54 @@ bool UpgradeArchiveDatabaseSchema(void)
" hascutlist BOOL NOT NULL DEFAULT 0,"
" cutlist TEXT,"
" INDEX (title)"
");",
""
");"
};
if (!performActualUpdate(updates, "1000", dbver))
if (!performActualUpdate("MythArchive", MythArchiveVersionName,
updates, "1000", dbver))
return false;
}

if (dbver == "1000")
{
const QString updates[] =
DBUpdates updates
{
"ALTER TABLE archiveitems MODIFY size BIGINT UNSIGNED NOT NULL;",
""
"ALTER TABLE archiveitems MODIFY size BIGINT UNSIGNED NOT NULL;"
};

if (!performActualUpdate(updates, "1001", dbver))
if (!performActualUpdate("MythArchive", MythArchiveVersionName,
updates, "1001", dbver))
return false;
}


if (dbver == "1001")
{
const QString updates[] =
DBUpdates updates
{
QString("ALTER DATABASE %1 DEFAULT CHARACTER SET latin1;")
.arg(gContext->GetDatabaseParams().m_dbName),
qPrintable(QString("ALTER DATABASE %1 DEFAULT CHARACTER SET latin1;")
.arg(gContext->GetDatabaseParams().m_dbName)),
"ALTER TABLE archiveitems"
" MODIFY title varbinary(128) default NULL,"
" MODIFY subtitle varbinary(128) default NULL,"
" MODIFY description blob,"
" MODIFY startdate varbinary(30) default NULL,"
" MODIFY starttime varbinary(30) default NULL,"
" MODIFY filename blob,"
" MODIFY cutlist blob;",
""
" MODIFY cutlist blob;"
};

if (!performActualUpdate(updates, "1002", dbver))
if (!performActualUpdate("MythArchive", MythArchiveVersionName,
updates, "1002", dbver))
return false;
}


if (dbver == "1002")
{
const QString updates[] =
DBUpdates updates
{
QString("ALTER DATABASE %1 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;")
.arg(gContext->GetDatabaseParams().m_dbName),
qPrintable(QString("ALTER DATABASE %1 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;")
.arg(gContext->GetDatabaseParams().m_dbName)),
"ALTER TABLE archiveitems"
" DEFAULT CHARACTER SET default,"
" MODIFY title varchar(128) CHARACTER SET utf8 default NULL,"
Expand All @@ -150,17 +101,17 @@ bool UpgradeArchiveDatabaseSchema(void)
" MODIFY startdate varchar(30) CHARACTER SET utf8 default NULL,"
" MODIFY starttime varchar(30) CHARACTER SET utf8 default NULL,"
" MODIFY filename text CHARACTER SET utf8 NOT NULL,"
" MODIFY cutlist text CHARACTER SET utf8;",
""
" MODIFY cutlist text CHARACTER SET utf8;"
};

if (!performActualUpdate(updates, "1003", dbver))
if (!performActualUpdate("MythArchive", MythArchiveVersionName,
updates, "1003", dbver))
return false;
}

if (dbver == "1003")
{
const QString updates[] =
DBUpdates updates
{
"ALTER TABLE `archiveitems` "
"ADD duration INT UNSIGNED NOT NULL DEFAULT 0, "
Expand All @@ -169,24 +120,24 @@ bool UpgradeArchiveDatabaseSchema(void)
"ADD videoheight INT UNSIGNED NOT NULL DEFAULT 0, "
"ADD filecodec VARCHAR(50) NOT NULL DEFAULT '', "
"ADD videocodec VARCHAR(50) NOT NULL DEFAULT '', "
"ADD encoderprofile VARCHAR(50) NOT NULL DEFAULT 'NONE';",
""
"ADD encoderprofile VARCHAR(50) NOT NULL DEFAULT 'NONE';"
};

if (!performActualUpdate(updates, "1004", dbver))
if (!performActualUpdate("MythArchive", MythArchiveVersionName,
updates, "1004", dbver))
return false;
}

if (dbver == "1004")
{
const QString updates[] =
DBUpdates updates
{
"DELETE FROM keybindings "
" WHERE action = 'DELETEITEM' AND context = 'Archive';",
""
" WHERE action = 'DELETEITEM' AND context = 'Archive';"
};

if (!performActualUpdate(updates, "1005", dbver))
if (!performActualUpdate("MythArchive", MythArchiveVersionName,
updates, "1005", dbver))
return false;
}

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions mythplugins/mytharchive/mytharchive/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ using namespace std;
#include "fileselector.h"
#include "recordingselector.h"
#include "videoselector.h"
#include "dbcheck.h"
#include "archivedbcheck.h"
#include "archiveutil.h"
#include "selectdestination.h"
#include "exportnative.h"
Expand Down Expand Up @@ -91,7 +91,7 @@ static bool checkLockFile(const QString &lockFile)
// Is the process that created the lock still alive?
if (!checkProcess(lockFile))
{
showWarningDialog(qApp->translate("(MythArchiveMain)",
showWarningDialog(QCoreApplication::translate("(MythArchiveMain)",
"Found a lock file but the owning process isn't running!\n"
"Removing stale lock file."));
if (!file.remove())
Expand Down Expand Up @@ -212,14 +212,14 @@ static void runTestDVD(void)
{
if (!gCoreContext->GetSetting("MythArchiveLastRunType").startsWith("DVD"))
{
showWarningDialog(qApp->translate("(MythArchiveMain)",
showWarningDialog(QCoreApplication::translate("(MythArchiveMain)",
"Last run did not create a playable DVD."));
return;
}

if (!gCoreContext->GetSetting("MythArchiveLastRunStatus").startsWith("Success"))
{
showWarningDialog(qApp->translate("(MythArchiveMain)",
showWarningDialog(QCoreApplication::translate("(MythArchiveMain)",
"Last run failed to create a DVD."));
return;
}
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mytharchive/mytharchive/mytharchive.pro
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ target.path = $${LIBDIR}/mythtv/plugins
INSTALLS += target

HEADERS += archivesettings.h logviewer.h fileselector.h
HEADERS += recordingselector.h videoselector.h dbcheck.h
HEADERS += recordingselector.h videoselector.h archivedbcheck.h
HEADERS += archiveutil.h selectdestination.h
HEADERS += mythburn.h themeselector.h editmetadata.h thumbfinder.h
HEADERS += exportnative.h importnative.h

SOURCES += main.cpp archivesettings.cpp logviewer.cpp
SOURCES += fileselector.cpp recordingselector.cpp videoselector.cpp
SOURCES += dbcheck.cpp archiveutil.cpp selectdestination.cpp
SOURCES += archivedbcheck.cpp archiveutil.cpp selectdestination.cpp
SOURCES += mythburn.cpp themeselector.cpp editmetadata.cpp thumbfinder.cpp
SOURCES += exportnative.cpp importnative.cpp

Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mytharchive/mytharchive/mythburn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ void MythBurn::updateArchiveList(void)
busyPopup = nullptr;
}

qApp->processEvents();
QCoreApplication::processEvents();

m_archiveButtonList->Reset();

Expand All @@ -413,7 +413,7 @@ void MythBurn::updateArchiveList(void)
{
foreach (auto a, m_archiveList)
{
qApp->processEvents();
QCoreApplication::processEvents();
// get duration of this file
if (a->duration == 0)
{
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mytharchive/mytharchive/recordingselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void RecordingSelector::Init(void)
auto *thread = new GetRecordingListThread(this);
while (thread->isRunning())
{
qApp->processEvents();
QCoreApplication::processEvents();
usleep(2000);
}

Expand Down Expand Up @@ -434,7 +434,7 @@ void RecordingSelector::updateRecordingList(void)

item->SetData(QVariant::fromValue(p));
}
qApp->processEvents();
QCoreApplication::processEvents();
}
}

Expand Down Expand Up @@ -509,7 +509,7 @@ void RecordingSelector::updateSelectedList()
break;
}

qApp->processEvents();
QCoreApplication::processEvents();
}
}
}
10 changes: 5 additions & 5 deletions mythplugins/mytharchive/mytharchive/thumbfinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ void ThumbFinder::updateThumb(void)
m_imageGrid->SetRedraw();
}

QString ThumbFinder::frameToTime(int64_t frame, bool addFrame)
QString ThumbFinder::frameToTime(int64_t frame, bool addFrame) const
{
QString str;

Expand Down Expand Up @@ -478,7 +478,7 @@ bool ThumbFinder::getThumbImages()

new MythUIButtonListItem(m_imageGrid, thumb->caption, thumb->filename);

qApp->processEvents();
QCoreApplication::processEvents();

for (int x = 1; x <= m_thumbCount; x++)
{
Expand Down Expand Up @@ -513,11 +513,11 @@ bool ThumbFinder::getThumbImages()
m_frameFile = thumb->filename;

seekToFrame(thumb->frame);
qApp->processEvents();
QCoreApplication::processEvents();
getFrameImage();
qApp->processEvents();
QCoreApplication::processEvents();
new MythUIButtonListItem(m_imageGrid, thumb->caption, thumb->filename);
qApp->processEvents();
QCoreApplication::processEvents();
}

m_frameFile = origFrameFile;
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchive/thumbfinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ThumbFinder : public MythScreenType
void updateCurrentPos(void);
bool seekToFrame(int frame, bool checkPos = true);
static QString createThumbDir(void);
QString frameToTime(int64_t frame, bool addFrame = false);
QString frameToTime(int64_t frame, bool addFrame = false) const;

// avcodec stuff
bool initAVCodec(const QString &inFile);
Expand Down
17 changes: 8 additions & 9 deletions mythplugins/mytharchive/mytharchivehelper/external/pxsup2dast.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ typedef int_fast32_t fi32; typedef uint_fast32_t fu32;
/* use this only to cast quoted strings in function calls */
#define CUS (const unsigned char *)

/* forward declarations */
typedef struct _Png4File Png4File;
typedef struct _BoundStr BoundStr;

enum { MiscError = 1, EOFIndicator, IndexError };

int sup2dast(const char *supfile, const char *ifofile, int delay_ms);
Expand Down Expand Up @@ -122,6 +118,8 @@ struct
#define exc_catchall else
#define exc_endall(x) EXC.m_last = exc_s##x.m_prev; } while (0)

#define exc_cleanup() EXC.m_last = NULL;

static void __exc_throw(int type) /* protoadd GCCATTR_NORETURN */
{
struct exc__state * exc_s = EXC.m_last;
Expand Down Expand Up @@ -391,8 +389,7 @@ static void argpalette(const char * arg,
}


/* typedef struct _Png4File Png4File; */
struct _Png4File
typedef struct Png4File
{
FILE *m_fh;
int m_width;
Expand All @@ -404,7 +401,7 @@ struct _Png4File
eu32 m_adler;
eu8 m_paletteChunk[24];
eu8 m_buffer[65536];
};
} Png4File;

static void png4file_init(Png4File * self, eu8 palette[4][3])
{
Expand Down Expand Up @@ -619,11 +616,11 @@ static char * pts2ts(fu32 pts, char * rvbuf, bool is_png_filename)

/* *********** */

struct _BoundStr
typedef struct BoundStr
{
eu8 *m_p;
int m_l;
};
} BoundStr;

static void boundstr_init(BoundStr * bs, eu8 * p, int l)
{
Expand Down Expand Up @@ -821,6 +818,7 @@ static void pxsubtitle(const char * supfile, FILE * ofh, eu8 palette[16][3],
size_t len = write(1, sptsstr, strlen(sptsstr));
if (len != strlen(sptsstr))
printf("ERROR: write failed");
exc_cleanup();
return;
}
exc_end(1);
Expand Down Expand Up @@ -982,6 +980,7 @@ int sup2dast(const char *supfile, const char *ifofile ,int delay_ms)
if (write(2, "\n", 1) != 1)
printf("ERROR: write failed");

exc_cleanup();
return 1;
}
exc_endall(1);
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchivehelper/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ int NativeArchive::doNativeArchive(const QString &jobFile)
return 0;
}

static QRegExp badChars = QRegExp("(/|\\\\|:|\'|\"|\\?|\\|)");
static QRegExp badChars = QRegExp(R"((/|\\|:|'|"|\?|\|))");

static QString fixFilename(const QString &filename)
{
Expand Down
85 changes: 18 additions & 67 deletions mythplugins/mythbrowser/mythbrowser/browserdbutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,15 @@
// myth
#include <mythcontext.h>
#include <mythdb.h>
#include <mythdbcheck.h>
#include <mythsorthelper.h>

// mythbrowser
#include "browserdbutil.h"
#include "bookmarkmanager.h"

const QString currentDatabaseVersion = "1003";

static bool UpdateDBVersionNumber(const QString &newnumber)
{

if (!gCoreContext->SaveSettingOnHost("BrowserDBSchemaVer", newnumber, nullptr))
{
LOG(VB_GENERAL, LOG_ERR,
QString("DB Error (Setting new DB version number): %1\n")
.arg(newnumber));

return false;
}

return true;
}

static bool performActualUpdate(const QString updates[], const QString& version,
QString &dbver)
{
MSqlQuery query(MSqlQuery::InitCon());

LOG(VB_GENERAL, LOG_NOTICE,
"Upgrading to MythBrowser schema version " + version);

int counter = 0;
QString thequery = updates[counter];

while (thequery != "")
{
if (!query.exec(thequery))
{
QString msg =
QString("DB Error (Performing database upgrade): \n"
"Query was: %1 \nError was: %2 \nnew version: %3")
.arg(thequery)
.arg(MythDB::DBErrorMessage(query.lastError()))
.arg(version);
LOG(VB_GENERAL, LOG_ERR, msg);
return false;
}

counter++;
thequery = updates[counter];
}

if (!UpdateDBVersionNumber(version))
return false;

dbver = version;
return true;
}
const QString MythBrowserVersionName = "BrowserDBSchemaVer";

bool UpgradeBrowserDatabaseSchema(void)
{
Expand All @@ -75,51 +26,51 @@ bool UpgradeBrowserDatabaseSchema(void)
LOG(VB_GENERAL, LOG_NOTICE,
"Inserting MythBrowser initial database information.");

const QString updates[] =
DBUpdates updates
{
"DROP TABLE IF EXISTS websites;",
"CREATE TABLE websites ("
"id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, "
"category VARCHAR(100) NOT NULL, "
"name VARCHAR(100) NOT NULL, "
"url VARCHAR(255) NOT NULL);",
""
"url VARCHAR(255) NOT NULL);"
};
if (!performActualUpdate(updates, "1000", dbver))
if (!performActualUpdate("MythBrowser", MythBrowserVersionName,
updates, "1000", dbver))
return false;
}

if (dbver == "1000")
{
const QString updates[] =
DBUpdates updates
{
"UPDATE settings SET data = 'Internal' WHERE data LIKE '%mythbrowser' AND value = 'WebBrowserCommand';",
""
"UPDATE settings SET data = 'Internal' WHERE data LIKE '%mythbrowser' AND value = 'WebBrowserCommand';"
};
if (!performActualUpdate(updates, "1001", dbver))
if (!performActualUpdate("MythBrowser", MythBrowserVersionName,
updates, "1001", dbver))
return false;
}

if (dbver == "1001")
{
const QString updates[] =
DBUpdates updates
{
"DELETE FROM keybindings "
" WHERE action = 'DELETETAB' AND context = 'Browser';",
""
" WHERE action = 'DELETETAB' AND context = 'Browser';"
};
if (!performActualUpdate(updates, "1002", dbver))
if (!performActualUpdate("MythBrowser", MythBrowserVersionName,
updates, "1002", dbver))
return false;
}

if (dbver == "1002")
{
const QString updates[] =
DBUpdates updates
{
"ALTER TABLE `websites` ADD `homepage` BOOL NOT NULL;",
""
"ALTER TABLE `websites` ADD `homepage` BOOL NOT NULL;"
};
if (!performActualUpdate(updates, "1003", dbver))
if (!performActualUpdate("MythBrowser", MythBrowserVersionName,
updates, "1003", dbver))
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythbrowser/mythbrowser/mythflashplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ MythFlashPlayer::MythFlashPlayer(MythScreenStack *parent,
m_fftime = PlayGroup::GetSetting("Default", "skipahead", 30);
m_rewtime = PlayGroup::GetSetting("Default", "skipback", 5);
m_jumptime = PlayGroup::GetSetting("Default", "jump", 10);
qApp->setOverrideCursor(QCursor(Qt::BlankCursor));
QGuiApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
GetMythMainWindow()->PauseIdleTimer(true);
MythUIHelper::DisableScreensaver();
}


MythFlashPlayer::~MythFlashPlayer()
{
qApp->restoreOverrideCursor();
QGuiApplication::restoreOverrideCursor();

if (m_browser)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,69 +6,20 @@ using namespace std;

#include <mythcontext.h>
#include <mythdb.h>
#include <mythdbcheck.h>

#include "dbcheck.h"
#include "gamedbcheck.h"
#include "gamesettings.h"

const QString currentDatabaseVersion = "1019";

static bool UpdateDBVersionNumber(const QString &newnumber)
{

if (!gCoreContext->SaveSettingOnHost("GameDBSchemaVer",newnumber,nullptr))
{
LOG(VB_GENERAL, LOG_ERR,
QString("DB Error (Setting new DB version number): %1\n")
.arg(newnumber));

return false;
}

return true;
}

static bool performActualUpdate(const QString updates[], const QString& version,
QString &dbver)
{
MSqlQuery query(MSqlQuery::InitCon());

LOG(VB_GENERAL, LOG_NOTICE,
QString("Upgrading to MythGame schema version ") + version);

int counter = 0;
QString thequery = updates[counter];

while (thequery != "")
{
if (!query.exec(thequery))
{
QString msg =
QString("DB Error (Performing database upgrade): \n"
"Query was: %1 \nError was: %2 \nnew version: %3")
.arg(thequery)
.arg(MythDB::DBErrorMessage(query.lastError()))
.arg(version);
LOG(VB_GENERAL, LOG_ERR, msg);
return false;
}

counter++;
thequery = updates[counter];
}

if (!UpdateDBVersionNumber(version))
return false;

dbver = version;
return true;
}
const QString MythGameVersionName = "GameDBSchemaVer";

static bool InitializeDatabase(void)
{
LOG(VB_GENERAL, LOG_NOTICE,
"Inserting MythGame initial database information.");

const QString updates[] = {
DBUpdates updates {
"CREATE TABLE gamemetadata ("
" `system` varchar(128) NOT NULL default '',"
" romname varchar(128) NOT NULL default '',"
Expand Down Expand Up @@ -122,11 +73,11 @@ static bool InitializeDatabase(void)
" KEY name (name),"
" KEY description (description),"
" KEY platform (platform)"
");",
""
");"
};
QString dbver = "";
return performActualUpdate(updates, "1011", dbver);
return performActualUpdate("MythGame", MythGameVersionName,
updates, "1011", dbver);
}

bool UpgradeGameDatabaseSchema(void)
Expand All @@ -146,11 +97,11 @@ bool UpgradeGameDatabaseSchema(void)

if (dbver == "1000")
{
const QString updates[] = {
"ALTER TABLE gamemetadata ADD COLUMN favorite BOOL NULL;",
""
DBUpdates updates {
"ALTER TABLE gamemetadata ADD COLUMN favorite BOOL NULL;"
};
if (!performActualUpdate(updates, "1001", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1001", dbver))
return false;
}

Expand All @@ -159,7 +110,7 @@ bool UpgradeGameDatabaseSchema(void)
|| (dbver == "1002"))
|| (dbver == "1001"))
{
const QString updates[] = {
DBUpdates updates {

"CREATE TABLE gameplayers ("
" gameplayerid int(10) unsigned NOT NULL auto_increment,"
Expand All @@ -174,21 +125,21 @@ bool UpgradeGameDatabaseSchema(void)
" UNIQUE KEY playername (playername)"
");",
"ALTER TABLE gamemetadata ADD COLUMN rompath varchar(255) NOT NULL default ''; ",
"ALTER TABLE gamemetadata ADD COLUMN gametype varchar(64) NOT NULL default ''; ",
""
"ALTER TABLE gamemetadata ADD COLUMN gametype varchar(64) NOT NULL default ''; "
};
if (!performActualUpdate(updates, "1005", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1005", dbver))
return false;
}

if (dbver == "1005")
{
const QString updates[] = {
DBUpdates updates {
"ALTER TABLE gameplayers ADD COLUMN spandisks tinyint(1) NOT NULL default 0; ",
"ALTER TABLE gamemetadata ADD COLUMN diskcount tinyint(1) NOT NULL default 1; ",
""
"ALTER TABLE gamemetadata ADD COLUMN diskcount tinyint(1) NOT NULL default 1; "
};
if (!performActualUpdate(updates, "1006", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1006", dbver))
return false;
}

Expand All @@ -202,31 +153,31 @@ bool UpgradeGameDatabaseSchema(void)
MythDB::DBError("update GameAllTreeLevels", query);
}

QString updates[] = {
DBUpdates updates = {
"ALTER TABLE gamemetadata ADD COLUMN country varchar(128) NOT NULL default ''; ",
"ALTER TABLE gamemetadata ADD COLUMN crc_value varchar(64) NOT NULL default ''; ",
"ALTER TABLE gamemetadata ADD COLUMN display tinyint(1) NOT NULL default 1; ",
""
"ALTER TABLE gamemetadata ADD COLUMN display tinyint(1) NOT NULL default 1; "
};

if (!performActualUpdate(updates, "1007", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1007", dbver))
return false;
}

if (dbver == "1007")
{
const QString updates[] = {
"ALTER TABLE gameplayers MODIFY commandline TEXT NOT NULL default ''; ",
""
DBUpdates updates {
"ALTER TABLE gameplayers MODIFY commandline TEXT NOT NULL default ''; "
};

if (!performActualUpdate(updates, "1008", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1008", dbver))
return false;
}

if (dbver == "1008")
{
const QString updates[] = {
DBUpdates updates {
"CREATE TABLE romdb ("
" crc varchar(64) NOT NULL default '',"
" name varchar(128) NOT NULL default '',"
Expand All @@ -246,56 +197,56 @@ bool UpgradeGameDatabaseSchema(void)
" KEY name (name),"
" KEY description (description),"
" KEY platform (platform)"
");",
""
");"
};

if (!performActualUpdate(updates, "1009", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1009", dbver))
return false;
}

if (dbver == "1009")
{
const QString updates[] = {
"ALTER TABLE gamemetadata MODIFY year varchar(10) not null default '';",
""
DBUpdates updates {
"ALTER TABLE gamemetadata MODIFY year varchar(10) not null default '';"
};

if (!performActualUpdate(updates, "1010", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1010", dbver))
return false;
}

if (dbver == "1010")
{
const QString updates[] = {
DBUpdates updates {

"ALTER TABLE gamemetadata ADD COLUMN version varchar(64) NOT NULL default '';",
"ALTER TABLE gamemetadata ADD COLUMN publisher varchar(128) NOT NULL default '';",
""
"ALTER TABLE gamemetadata ADD COLUMN publisher varchar(128) NOT NULL default '';"
};

if (!performActualUpdate(updates, "1011", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1011", dbver))
return false;
}


if (dbver == "1011")
{
const QString updates[] = {
"ALTER TABLE romdb ADD COLUMN binfile varchar(64) NOT NULL default ''; ",
""
DBUpdates updates {
"ALTER TABLE romdb ADD COLUMN binfile varchar(64) NOT NULL default ''; "
};

if (!performActualUpdate(updates, "1012", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1012", dbver))
return false;
}


if (dbver == "1012")
{
const QString updates[] = {
QString("ALTER DATABASE %1 DEFAULT CHARACTER SET latin1;")
.arg(gContext->GetDatabaseParams().m_dbName),
DBUpdates updates {
qPrintable(QString("ALTER DATABASE %1 DEFAULT CHARACTER SET latin1;")
.arg(gContext->GetDatabaseParams().m_dbName)),
"ALTER TABLE gamemetadata"
" MODIFY `system` varbinary(128) NOT NULL default '',"
" MODIFY romname varbinary(128) NOT NULL default '',"
Expand Down Expand Up @@ -328,20 +279,20 @@ QString("ALTER DATABASE %1 DEFAULT CHARACTER SET latin1;")
" MODIFY platform varbinary(64) NOT NULL default '',"
" MODIFY flags varbinary(64) NOT NULL default '',"
" MODIFY version varbinary(64) NOT NULL default '',"
" MODIFY binfile varbinary(64) NOT NULL default '';",
""
" MODIFY binfile varbinary(64) NOT NULL default '';"
};

if (!performActualUpdate(updates, "1013", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1013", dbver))
return false;
}


if (dbver == "1013")
{
const QString updates[] = {
QString("ALTER DATABASE %1 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;")
.arg(gContext->GetDatabaseParams().m_dbName),
DBUpdates updates {
qPrintable(QString("ALTER DATABASE %1 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;")
.arg(gContext->GetDatabaseParams().m_dbName)),
"ALTER TABLE gamemetadata"
" DEFAULT CHARACTER SET default,"
" MODIFY `system` varchar(128) CHARACTER SET utf8 NOT NULL default '',"
Expand Down Expand Up @@ -377,75 +328,75 @@ QString("ALTER DATABASE %1 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;")
" MODIFY platform varchar(64) CHARACTER SET utf8 NOT NULL default '',"
" MODIFY flags varchar(64) CHARACTER SET utf8 NOT NULL default '',"
" MODIFY version varchar(64) CHARACTER SET utf8 NOT NULL default '',"
" MODIFY binfile varchar(64) CHARACTER SET utf8 NOT NULL default '';",
""
" MODIFY binfile varchar(64) CHARACTER SET utf8 NOT NULL default '';"
};

if (!performActualUpdate(updates, "1014", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1014", dbver))
return false;
}

if (dbver == "1014")
{
const QString updates[] = {
DBUpdates updates {

"ALTER TABLE gamemetadata ADD fanart VARCHAR(255) NOT NULL AFTER rompath,"
"ADD boxart VARCHAR( 255 ) NOT NULL AFTER fanart;",
""
"ADD boxart VARCHAR( 255 ) NOT NULL AFTER fanart;"
};

if (!performActualUpdate(updates, "1015", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1015", dbver))
return false;
}

if (dbver == "1015")
{
const QString updates[] = {
DBUpdates updates {

"ALTER TABLE gamemetadata ADD screenshot VARCHAR(255) NOT NULL AFTER rompath,"
"ADD plot TEXT NOT NULL AFTER fanart;",
""
"ADD plot TEXT NOT NULL AFTER fanart;"
};

if (!performActualUpdate(updates, "1016", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1016", dbver))
return false;
}

if (dbver == "1016")
{
const QString updates[] = {
DBUpdates updates {

"ALTER TABLE gamemetadata ADD inetref TEXT AFTER crc_value;",
""
"ALTER TABLE gamemetadata ADD inetref TEXT AFTER crc_value;"
};

if (!performActualUpdate(updates, "1017", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1017", dbver))
return false;
}

if (dbver == "1017")
{
const QString updates[] = {
DBUpdates updates {

"ALTER TABLE gamemetadata ADD intid int(11) NOT NULL AUTO_INCREMENT "
"PRIMARY KEY FIRST;",
""
"PRIMARY KEY FIRST;"
};

if (!performActualUpdate(updates, "1018", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1018", dbver))
return false;
}

if (dbver == "1018")
{
const QString updates[] = {
DBUpdates updates {
"ALTER TABLE romdb MODIFY description varchar(192) CHARACTER SET utf8 NOT NULL default '';",
"ALTER TABLE romdb MODIFY binfile varchar(128) CHARACTER SET utf8 NOT NULL default '';",
"ALTER TABLE romdb MODIFY filesize int(12) unsigned default NULL;",
""
"ALTER TABLE romdb MODIFY filesize int(12) unsigned default NULL;"
};

if (!performActualUpdate(updates, "1019", dbver))
if (!performActualUpdate("MythGame", MythGameVersionName,
updates, "1019", dbver))
return false;
}

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion mythplugins/mythgame/mythgame/gamehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ void GameHandler::customEvent(QEvent *event)
if (resultid == "removalPopup")
{
int buttonNum = dce->GetResult();
GameScan scan = dce->GetData().value<GameScan>();
auto scan = dce->GetData().value<GameScan>();
switch (buttonNum)
{
case 1:
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgame/mythgame/gamescan.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class GameScannerThread : public MThread
void SetHandlers(QList<GameHandler*> handlers) { m_handlers = std::move(handlers); };
void SetProgressDialog(MythUIProgressDialog *dialog) { m_dialog = dialog; };

bool getDataChanged() { return m_dbDataChanged; };
bool getDataChanged() const { return m_dbDataChanged; };

private:

Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgame/mythgame/gamesettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ void GamePlayersList::Load()
GroupSetting::Load();
}

void GamePlayersList::NewPlayerDialog()
void GamePlayersList::NewPlayerDialog() const
{
MythScreenStack *stack = GetMythMainWindow()->GetStack("popup stack");
auto *nameDialog = new MythTextInputDialog(stack, tr("Player Name"));
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgame/mythgame/gamesettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MPUBLIC GamePlayersList : public GroupSetting

private:
void Load() override; // StandardSetting
void NewPlayerDialog();
void NewPlayerDialog() const;
void CreateNewPlayer(const QString& name);
};

Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythgame/mythgame/gameui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "gamescan.h"
#include "gameui.h"

static const QString _Location = "MythGame";
static const QString sLocation = "MythGame";

class GameTreeInfo
{
Expand Down Expand Up @@ -629,7 +629,7 @@ void GameUI::customEvent(QEvent *event)
else if (event->type() == ImageDLFailureEvent::kEventType)
{
MythErrorNotification n(tr("Failed to retrieve image(s)"),
_Location,
sLocation,
tr("Check logs"));
GetNotificationCenter()->Queue(n);
}
Expand Down Expand Up @@ -877,7 +877,7 @@ void GameUI::updateChangedNode(MythGenericTree *node, RomInfo *romInfo)
{
resetOtherTrees(node);

if (node->getParent() == m_favouriteNode && romInfo->Favorite() == 0)
if (node->getParent() == m_favouriteNode && !romInfo->Favorite())
{
// node is being removed
m_gameUITree->SetCurrentNode(m_favouriteNode);
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgame/mythgame/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "gameui.h"
#include "gamehandler.h"
#include "gamesettings.h"
#include "dbcheck.h"
#include "gamedbcheck.h"

#include <mythcontext.h>
#include <mythdbcon.h>
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythgame/mythgame/mythgame.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ target.path = $${LIBDIR}/mythtv/plugins
INSTALLS += target installscripts installgiantbomb installgiantbombxsl

# Input
HEADERS += gamehandler.h rominfo.h gamesettings.h gameui.h
HEADERS += gamehandler.h rominfo.h gamesettings.h gamedbcheck.h gameui.h
HEADERS += rom_metadata.h romedit.h gamedetails.h gamescan.h

SOURCES += main.cpp gamehandler.cpp rominfo.cpp gameui.cpp
SOURCES += gamesettings.cpp dbcheck.cpp rom_metadata.cpp romedit.cpp
SOURCES += gamesettings.cpp gamedbcheck.cpp rom_metadata.cpp romedit.cpp
SOURCES += gamedetails.cpp gamescan.cpp

DEFINES += MPLUGIN_API NOUNCRYPT
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgame/mythgame/rom_metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ QString crcinfo(const QString& romname, const QString& GameType, QString *key, R
char block[32768] = "";
uLong crc = crc32(0, Z_NULL, 0);
QString crcRes;
unz_file_info file_info;
unz_file_info file_info {};

int blocksize = 8192;
#if 0
Expand Down
8 changes: 4 additions & 4 deletions mythplugins/mythgame/mythgame/rominfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bool operator==(const RomInfo& a, const RomInfo& b)
return a.Romname() == b.Romname();
}

void RomInfo::SaveToDatabase()
void RomInfo::SaveToDatabase() const
{
MSqlQuery query(MSqlQuery::InitCon());

Expand Down Expand Up @@ -91,7 +91,7 @@ void RomInfo::SaveToDatabase()
}
}

void RomInfo::DeleteFromDatabase()
void RomInfo::DeleteFromDatabase() const
{
LOG(VB_GENERAL, LOG_INFO, LOC + QString("Removing %1 - %2").arg(Rompath())
.arg(Romname()));
Expand Down Expand Up @@ -231,7 +231,7 @@ void RomInfo::setFavorite(bool updateDatabase)
}
}

QString RomInfo::getExtension()
QString RomInfo::getExtension() const
{
int pos = Romname().lastIndexOf(".");
if (pos == -1)
Expand Down Expand Up @@ -413,7 +413,7 @@ RomInfo *RomInfo::GetRomInfoById(int id)
return ret;
}

QString RomInfo::toString()
QString RomInfo::toString() const
{
return QString ("Rom Info:\n"
"ID: %1\n"
Expand Down
10 changes: 5 additions & 5 deletions mythplugins/mythgame/mythgame/rominfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,17 @@ class RomInfo
QString Inetref() const { return m_inetref; }
void setInetref(const QString &linetref) { m_inetref = linetref; }

int Favorite() const { return m_favorite; }
bool Favorite() const { return m_favorite; }
void setFavorite(bool updateDatabase = false);

QString getExtension();
QString toString();
QString getExtension() const;
QString toString() const;

void setField(const QString& field, const QString& data);
void fillData();

void SaveToDatabase();
void DeleteFromDatabase();
void SaveToDatabase() const;
void DeleteFromDatabase() const;

protected:
int m_id;
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/bumpscope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void BumpScope::generate_phongdat(void)

#define M_PI_F static_cast<float>(M_PI)
void BumpScope::translate(int x, int y, int *xo, int *yo, int *xd, int *yd,
int *angle)
int *angle) const
{
unsigned int HEIGHT = m_height;
unsigned int WIDTH = m_width;
Expand Down Expand Up @@ -213,7 +213,7 @@ void BumpScope::translate(int x, int y, int *xo, int *yo, int *xd, int *yd,
}

inline void BumpScope::draw_vert_line(unsigned char *buffer, int x, int y1,
int y2)
int y2) const
{
if (y1 < y2)
{
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythmusic/mythmusic/bumpscope.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class BumpScope : public VisualBase
void generate_phongdat(void);

void translate(int x, int y, int *xo, int *yo, int *xd, int *yd,
int *angle);
int *angle) const;

inline void draw_vert_line(unsigned char *buffer, int x, int y1, int y2);
inline void draw_vert_line(unsigned char *buffer, int x, int y1, int y2) const;
void render_light(int lx, int ly);

static void rgb_to_hsv(unsigned int color, double *h, double *s, double *v);
Expand All @@ -53,7 +53,7 @@ class BumpScope : public VisualBase

int m_bpl {0};

vector<vector<unsigned char> > m_phongDat;
vector<vector<unsigned char> > m_phongDat {};
unsigned char *m_rgbBuf {nullptr};
double m_intense1[256] {};
double m_intense2[256] {};
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/cddecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static CdIo_t * openCdio(const QString& name)
// Stack-based cdio device open
class StCdioDevice
{
CdIo_t* m_cdio;
CdIo_t* m_cdio {nullptr};

void* operator new(std::size_t); // Stack only
// No copying
Expand Down
12 changes: 6 additions & 6 deletions mythplugins/mythmusic/mythmusic/cdrip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void CDRipperThread::cancel(void)
m_quit = true;
}

bool CDRipperThread::isCancelled(void)
bool CDRipperThread::isCancelled(void) const
{
return m_quit;
}
Expand Down Expand Up @@ -885,16 +885,16 @@ bool Ripper::deleteExistingTrack(RipTrack *track)
" ON music_songs.directory_id=music_directories.directory_id "
"WHERE artist_name REGEXP \'");
QString token = artist;
token.replace(QRegExp("(/|\\\\|:|\'|\\,|\\!|\\(|\\)|\"|\\?|\\|)"),
token.replace(QRegExp(R"((/|\\|:|'|\,|\!|\(|\)|"|\?|\|))"),
QString("."));

queryString += token + "\' AND " + "album_name REGEXP \'";
token = album;
token.replace(QRegExp("(/|\\\\|:|\'|\\,|\\!|\\(|\\)|\"|\\?|\\|)"),
token.replace(QRegExp(R"((/|\\|:|'|\,|\!|\(|\)|"|\?|\|))"),
QString("."));
queryString += token + "\' AND " + "name REGEXP \'";
token = title;
token.replace(QRegExp("(/|\\\\|:|\'|\\,|\\!|\\(|\\)|\"|\\?|\\|)"),
token.replace(QRegExp(R"((/|\\|:|'|\,|\!|\(|\)|"|\?|\|))"),
QString("."));
queryString += token + "\' ORDER BY artist_name, album_name,"
" name, song_id, filename LIMIT 1";
Expand Down Expand Up @@ -939,7 +939,7 @@ bool Ripper::deleteExistingTrack(RipTrack *track)
return false;
}

bool Ripper::somethingWasRipped()
bool Ripper::somethingWasRipped() const
{
return m_somethingwasripped;
}
Expand Down Expand Up @@ -1541,7 +1541,7 @@ void RipStatus::customEvent(QEvent *event)
auto *dce = dynamic_cast<DialogCompletionEvent *>(event);
if (dce == nullptr)
return;
if (dce->GetId() == "stop_ripping" && dce->GetResult())
if ((dce->GetId() == "stop_ripping") && (dce->GetResult() != 0))
{
m_ripperThread->cancel();
m_ripperThread->wait();
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/cdrip.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class CDRipperThread: public MThread
void run(void) override; // MThread
int ripTrack(QString &cddevice, Encoder *encoder, int tracknum);

bool isCancelled(void);
bool isCancelled(void) const;

RipStatus *m_parent {nullptr};
bool m_quit {false};
Expand Down Expand Up @@ -103,7 +103,7 @@ class Ripper : public MythScreenType
bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
void customEvent(QEvent *event) override; // MythUIType

bool somethingWasRipped();
bool somethingWasRipped() const;
void scanCD(void);
void ejectCD(void);

Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythmusic/mythmusic/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
// warranty, or liability of any kind.
//

#ifndef __constants_h
#define __constants_h
#ifndef CONSTANTS_H
#define CONSTANTS_H

const unsigned int historySize = 100;
const unsigned int groupOpenTimeout = 750;
const unsigned int numbBands = 10;

#endif // __constants_h
#endif // CONSTANTS_H
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class DecoderEvent : public MythEvent
{
public:
explicit DecoderEvent(Type type) : MythEvent(type) { ; }

explicit DecoderEvent(QString *e) : MythEvent(Error), m_errorMsg(e) { ; }

~DecoderEvent() override
Expand All @@ -40,6 +39,8 @@ class DecoderEvent : public MythEvent

const QString *errorMessage() const { return m_errorMsg; }

DecoderEvent &operator=(const DecoderEvent&) = delete;

MythEvent *clone(void) const override // MythEvent
{ return new DecoderEvent(*this); }

Expand All @@ -56,7 +57,6 @@ class DecoderEvent : public MythEvent
m_errorMsg = new QString(*o.m_errorMsg);
}
}
DecoderEvent &operator=(const DecoderEvent&) = delete;

private:
QString *m_errorMsg {nullptr};
Expand Down
5 changes: 4 additions & 1 deletion mythplugins/mythmusic/mythmusic/decoderhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ void DecoderHandler::stop(void)

void DecoderHandler::customEvent(QEvent *event)
{
if (event == nullptr)
return;

if (auto *dhe = dynamic_cast<DecoderHandlerEvent*>(event))
{
// Proxy all DecoderHandlerEvents
Expand Down Expand Up @@ -321,7 +324,7 @@ void DecoderHandler::createPlaylistFromRemoteUrl(const QUrl &url)
m_state = STOPPED;
}

qApp->processEvents();
QCoreApplication::processEvents();
usleep(500);
}
}
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythmusic/mythmusic/genres.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef GENRES_H__
#define GENRES_H__
#ifndef GENRES_H
#define GENRES_H

extern const char *genre_table[];
extern int genre_table_size;

#endif /* GENRES_H__ */
#endif /* GENRES_H */
8 changes: 4 additions & 4 deletions mythplugins/mythmusic/mythmusic/importmusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,15 @@ void ImportMusicDialog::addAllNewPressed()
while (m_currentTrack < (int) m_tracks->size())
{
fillWidgets();
qApp->processEvents();
QCoreApplication::processEvents();

if (m_tracks->at(m_currentTrack)->isNewTune)
{
addPressed();
newCount++;
}

qApp->processEvents();
QCoreApplication::processEvents();

m_currentTrack++;
}
Expand Down Expand Up @@ -484,7 +484,7 @@ bool ImportMusicDialog::copyFile(const QString &src, const QString &dst)
while (!copy->isFinished())
{
usleep(500);
qApp->processEvents();
QCoreApplication::processEvents();
}

res = copy->GetResult();
Expand Down Expand Up @@ -523,7 +523,7 @@ void ImportMusicDialog::startScan()
while (!scanner->isFinished())
{
usleep(500);
qApp->processEvents();
QCoreApplication::processEvents();
}

delete scanner;
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/importmusic.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class FileCopyThread: public MThread
m_dstFile(std::move(dst)) {}
void run() override; // MThread

bool GetResult(void) { return m_result; }
bool GetResult(void) const { return m_result; }

private:
QString m_srcFile;
Expand All @@ -68,7 +68,7 @@ class ImportMusicDialog : public MythScreenType
bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
void customEvent(QEvent *event) override; // MythUIType

bool somethingWasImported() { return m_somethingWasImported; }
bool somethingWasImported() const { return m_somethingWasImported; }
void doScan(void);
void doFileCopy(const QString &src, const QString &dst);

Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/lameencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void LameEncoder::init_id3tags(lame_global_flags *gf)
id3tag_v2_only(gf);
}

int LameEncoder::init_encoder(lame_global_flags *gf, int quality, bool vbr)
int LameEncoder::init_encoder(lame_global_flags *gf, int quality, bool vbr) const
{
int lameret = 0;
int meanbitrate = 128;
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/lameencoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class LameEncoder : public Encoder
int addSamples(int16_t *bytes, unsigned int len) override; // Encoder

private:
int init_encoder(lame_global_flags *gf, int quality, bool vbr);
int init_encoder(lame_global_flags *gf, int quality, bool vbr) const;
static void init_id3tags(lame_global_flags *gf);

int m_bits {16};
Expand Down
22 changes: 11 additions & 11 deletions mythplugins/mythmusic/mythmusic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "playlistview.h"
#include "streamview.h"
#include "playlistcontainer.h"
#include "dbcheck.h"
#include "musicdbcheck.h"
#include "musicplayer.h"
#include "config.h"
#include "mainvisual.h"
Expand Down Expand Up @@ -89,7 +89,7 @@ static bool checkStorageGroup(void)

if (hostList.isEmpty())
{
ShowOkPopup(qApp->translate("(MythMusicMain)",
ShowOkPopup(QCoreApplication::translate("(MythMusicMain)",
"No directories found in the 'Music' storage group. "
"Please run mythtv-setup on the backend machine to add one."));
return false;
Expand All @@ -112,7 +112,7 @@ static bool checkStorageGroup(void)

if (hostList.isEmpty())
{
ShowOkPopup(qApp->translate("(MythMusicMain)",
ShowOkPopup(QCoreApplication::translate("(MythMusicMain)",
"No directories found in the 'MusicArt' storage group. "
"Please run mythtv-setup on the backend machine to add one."));
return false;
Expand All @@ -137,7 +137,7 @@ static bool checkMusicAvailable(void)

if (!foundMusic)
{
ShowOkPopup(qApp->translate("(MythMusicMain)",
ShowOkPopup(QCoreApplication::translate("(MythMusicMain)",
"No music has been found.\n"
"Please select 'Scan For New Music' "
"to perform a scan for music."));
Expand Down Expand Up @@ -218,7 +218,7 @@ static void startRipper(void)
delete rip;

#else
ShowOkPopup(qApp->translate("(MythMusicMain)",
ShowOkPopup(QCoreApplication::translate("(MythMusicMain)",
"MythMusic hasn't been built with libcdio "
"support so ripping CDs is not possible"));
#endif
Expand Down Expand Up @@ -475,7 +475,7 @@ static QStringList BuildFileList(const QString &dir, const QStringList &filters)
if (fi.isDir())
{
ret += BuildFileList(fi.absoluteFilePath(), filters);
qApp->processEvents();
QCoreApplication::processEvents();
}
else
{
Expand Down Expand Up @@ -540,7 +540,7 @@ static void handleMedia(MythMediaDevice *cd)

MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");

QString message = qApp->translate("(MythMusicMain)",
QString message = QCoreApplication::translate("(MythMusicMain)",
"Searching for music files...");
auto *busy = new MythUIBusyDialog( message, popupStack, "musicscanbusydialog");
if (busy->Create())
Expand All @@ -562,7 +562,7 @@ static void handleMedia(MythMediaDevice *cd)
if (trackList.isEmpty())
return;

message = qApp->translate("(MythMusicMain)", "Loading music tracks");
message = QCoreApplication::translate("(MythMusicMain)", "Loading music tracks");
auto *progress = new MythUIProgressDialog( message, popupStack,
"scalingprogressdialog");
if (progress->Create())
Expand Down Expand Up @@ -590,7 +590,7 @@ static void handleMedia(MythMediaDevice *cd)
if (progress)
{
progress->SetProgress(track);
qApp->processEvents();
QCoreApplication::processEvents();
}
}
LOG(VB_MEDIA, LOG_INFO, QString("MythMusic: %1 tracks scanned").arg(track));
Expand Down Expand Up @@ -686,7 +686,7 @@ static void handleCDMedia(MythMediaDevice *cd)
while (!gMusicData->m_all_playlists->doneLoading()
|| !gMusicData->m_all_music->doneLoading())
{
qApp->processEvents();
QCoreApplication::processEvents();
usleep(50000);
}

Expand Down Expand Up @@ -722,7 +722,7 @@ static void handleCDMedia(MythMediaDevice *cd)
parenttitle += track->Album();
else
{
parenttitle = " " + qApp->translate("(MythMusicMain)",
parenttitle = " " + QCoreApplication::translate("(MythMusicMain)",
"Unknown");
LOG(VB_GENERAL, LOG_INFO, "Couldn't find your "
" CD. It may not be in the freedb database.\n"
Expand Down
9 changes: 4 additions & 5 deletions mythplugins/mythmusic/mythmusic/mainvisual.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// warranty, or liability of any kind.
//

#ifndef __mainvisual_h
#define __mainvisual_h
#ifndef MAINVISUAL_H
#define MAINVISUAL_H

#include <vector>
using namespace std;
Expand Down Expand Up @@ -56,7 +56,7 @@ class MainVisual : public QObject, public MythTV::Visual

QStringList getVisualizations(void) { return m_visualizers; }

int getCurrentVisual(void) { return m_currentVisualizer; }
int getCurrentVisual(void) const { return m_currentVisualizer; }

public slots:
void timeout();
Expand All @@ -74,5 +74,4 @@ class MainVisual : public QObject, public MythTV::Visual
QTimer *m_updateTimer {nullptr};
};

#endif // __mainvisual_h

#endif // MAINVISUAL_H
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/musiccommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ bool MusicCommon::keyPressEvent(QKeyEvent *e)
return handled;
}

void MusicCommon::changeVolume(bool up)
void MusicCommon::changeVolume(bool up) const
{
if (m_controlVolume && gPlayer->getOutput())
{
Expand All @@ -897,7 +897,7 @@ void MusicCommon::changeSpeed(bool up)
}
}

void MusicCommon::toggleMute()
void MusicCommon::toggleMute() const
{
if (m_controlVolume)
{
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/musiccommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ class MPUBLIC MusicCommon : public MythScreenType
void updateRepeatMode(void);
void updateShuffleMode(bool updateUIList = false);

void changeVolume(bool up);
void changeVolume(bool up) const;
static void changeSpeed(bool up);
void toggleMute(void);
void toggleMute(void) const;
static void toggleUpmix(void);
static void showVolume(void);
void updateVolume(void);
Expand Down
10 changes: 5 additions & 5 deletions mythplugins/mythmusic/mythmusic/musicdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void MusicData::scanMusic (void)
}

/// reload music after a scan, rip or import
void MusicData::reloadMusic(void)
void MusicData::reloadMusic(void) const
{
if (!m_all_music || !m_all_playlists)
return;
Expand Down Expand Up @@ -82,7 +82,7 @@ void MusicData::reloadMusic(void)
m_all_music->startLoading();
while (!m_all_music->doneLoading())
{
qApp->processEvents();
QCoreApplication::processEvents();
usleep(50000);
}

Expand All @@ -95,14 +95,14 @@ void MusicData::reloadMusic(void)
gPlayer->restorePosition();
}

void MusicData::loadMusic(void)
void MusicData::loadMusic(void) const
{
// only do this once
if (m_initialized)
return;

MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
QString message = qApp->translate("(MythMusicMain)",
QString message = QCoreApplication::translate("(MythMusicMain)",
"Loading Music. Please wait ...");

auto *busy = new MythUIBusyDialog(message, popupStack, "musicscanbusydialog");
Expand All @@ -128,7 +128,7 @@ void MusicData::loadMusic(void)
while (!gMusicData->m_all_playlists->doneLoading()
|| !gMusicData->m_all_music->doneLoading())
{
qApp->processEvents();
QCoreApplication::processEvents();
usleep(50000);
}

Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/musicdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class MusicData : public QObject
~MusicData() override;

static void scanMusic(void);
void loadMusic(void);
void loadMusic(void) const;

public slots:
void reloadMusic(void);
void reloadMusic(void) const;

public:
PlaylistContainer *m_all_playlists {nullptr};
Expand Down

Large diffs are not rendered by default.

File renamed without changes.
6 changes: 3 additions & 3 deletions mythplugins/mythmusic/mythmusic/musicplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ void MusicPlayer::customEvent(QEvent *event)
QObject::customEvent(event);
}

void MusicPlayer::getBufferStatus(int *bufferAvailable, int *bufferSize)
void MusicPlayer::getBufferStatus(int *bufferAvailable, int *bufferSize) const
{
*bufferAvailable = m_bufferAvailable;
*bufferSize = m_bufferSize;
Expand Down Expand Up @@ -1113,7 +1113,7 @@ void MusicPlayer::seek(int pos)
}
}

void MusicPlayer::showMiniPlayer(void)
void MusicPlayer::showMiniPlayer(void) const
{
if (m_canShowPlayer)
{
Expand Down Expand Up @@ -1409,7 +1409,7 @@ MuteState MusicPlayer::getMuteState(void) const
return kMuteOff;
}

void MusicPlayer::toMap(InfoMap &map)
void MusicPlayer::toMap(InfoMap &map) const
{
map["volumemute"] = isMuted() ? tr("%1% (Muted)", "Zero Audio Volume").arg(getVolume()) :
QString("%1%").arg(getVolume());
Expand Down
18 changes: 9 additions & 9 deletions mythplugins/mythmusic/mythmusic/musicplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class MusicPlayer : public QObject, public MythObservable
void setSpeed(float speed);
void incSpeed();
void decSpeed();
float getSpeed() { return m_playSpeed; }
float getSpeed() const { return m_playSpeed; }

void play(void);
void stop(bool stopAll = false);
Expand All @@ -99,18 +99,18 @@ class MusicPlayer : public QObject, public MythObservable

void nextAuto(void);

bool isPlaying(void) { return m_isPlaying; }
bool isPlaying(void) const { return m_isPlaying; }
bool isPaused(void) { return getOutput() ? getOutput()->IsPaused() : false; }
bool isStopped(void) { return !(isPlaying() || isPaused()); }
bool hasClient(void) { return hasListeners(); }

/// This will allow/disallow the mini player showing on track changes
void autoShowPlayer(bool autoShow) { m_autoShowPlayer = autoShow; }
bool getAutoShowPlayer(void) { return m_autoShowPlayer; }
bool getAutoShowPlayer(void) const { return m_autoShowPlayer; }

/// This will allow/disallow the mini player showing even using its jumppoint
void canShowPlayer(bool canShow) { m_canShowPlayer = canShow; }
bool getCanShowPlayer(void) { return m_canShowPlayer; }
bool getCanShowPlayer(void) const { return m_canShowPlayer; }

Decoder *getDecoder(void) { return m_decoderHandler ? m_decoderHandler->getDecoder() : nullptr; }
DecoderHandler *getDecoderHandler(void) { return m_decoderHandler; }
Expand All @@ -129,11 +129,11 @@ class MusicPlayer : public QObject, public MythObservable

QList<MusicMetadata*> &getPlayedTracksList(void) { return m_playedList; }

int getCurrentTrackPos(void) { return m_currentTrack; }
int getCurrentTrackPos(void) const { return m_currentTrack; }
bool setCurrentTrackPos(int pos);
void changeCurrentTrack(int trackNo);

int getCurrentTrackTime(void) { return m_currentTime; }
int getCurrentTrackTime(void) const { return m_currentTime; }

void activePlaylistChanged(int trackID, bool deleted);
void playlistChanged(int playlistID);
Expand All @@ -151,9 +151,9 @@ class MusicPlayer : public QObject, public MythObservable
void sendTrackUnavailableEvent(int trackID);
void sendCDChangedEvent(void);

void toMap(InfoMap &infoMap);
void toMap(InfoMap &infoMap) const;

void showMiniPlayer(void);
void showMiniPlayer(void) const;
enum RepeatMode
{ REPEAT_OFF = 0,
REPEAT_TRACK,
Expand Down Expand Up @@ -187,7 +187,7 @@ class MusicPlayer : public QObject, public MythObservable

ResumeMode getResumeMode(void);

void getBufferStatus(int *bufferAvailable, int *bufferSize);
void getBufferStatus(int *bufferAvailable, int *bufferSize) const;

public slots:
void StartPlayback(void);
Expand Down
2 changes: 0 additions & 2 deletions mythplugins/mythmusic/mythmusic/mythgoom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ using namespace std;
#include <mythcontext.h>
#include <mythlogging.h>

extern "C" {
#include "goom_tools.h"
#include "goom_core.h"
}

Goom::Goom()
{
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/mythmusic.pro
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ HEADERS += decoder.h flacencoder.h mainvisual.h
HEADERS += playlist.h polygon.h
HEADERS += synaesthesia.h encoder.h visualize.h avfdecoder.h
HEADERS += vorbisencoder.h polygon.h
HEADERS += bumpscope.h lameencoder.h dbcheck.h
HEADERS += bumpscope.h lameencoder.h musicdbcheck.h
HEADERS += importmusic.h
HEADERS += mythgoom.h
HEADERS += editmetadata.h smartplaylist.h genres.h
Expand All @@ -48,7 +48,7 @@ HEADERS += remoteavformatcontext.h lyricsview.h
SOURCES += decoder.cpp
SOURCES += flacencoder.cpp main.cpp
SOURCES += mainvisual.cpp playlist.cpp
SOURCES += encoder.cpp dbcheck.cpp
SOURCES += encoder.cpp musicdbcheck.cpp
SOURCES += synaesthesia.cpp lameencoder.cpp
SOURCES += vorbisencoder.cpp visualize.cpp bumpscope.cpp
SOURCES += genres.cpp importmusic.cpp
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythmusic/mythmusic/playlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,20 @@ class Playlist : public QObject

void copyTracks(Playlist *to_ptr, bool update_display);

bool hasChanged(void) { return m_changed; }
bool hasChanged(void) const { return m_changed; }
void changed(void);

/// whether any changes should be saved to the DB
void disableSaves(void) { m_doSave = false; }
void enableSaves(void) { m_doSave = true; }
bool doSaves(void) { return m_doSave; }
bool doSaves(void) const { return m_doSave; }

QString getName(void) { return m_name; }
void setName(QString a_name) { m_name = std::move(a_name); }

bool isActivePlaylist(void) { return m_name == DEFAULT_PLAYLIST_NAME; }

int getID(void) { return m_playlistid; }
int getID(void) const { return m_playlistid; }
void setID(int x) { m_playlistid = x; }

void getStats(uint *trackCount, uint *totalLength, uint currentTrack = 0, uint *playedLength = nullptr) const;
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/playlistcontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PlaylistContainer::~PlaylistContainer()
}

void PlaylistContainer::FillIntelliWeights(int &rating, int &playcount,
int &lastplay, int &random)
int &lastplay, int &random) const
{
rating = m_randomWeight;
playcount = m_playCountWeight;
Expand Down
10 changes: 5 additions & 5 deletions mythplugins/mythmusic/mythmusic/playlistcontainer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _PLAYLIST_CONTAINER_H_
#define _PLAYLIST_CONTAINER_H_
#ifndef PLAYLIST_CONTAINER_H
#define PLAYLIST_CONTAINER_H

// qt
#include <QCoreApplication>
Expand Down Expand Up @@ -62,12 +62,12 @@ class PlaylistContainer

void clearActive();

bool doneLoading(){return m_doneLoading;}
bool doneLoading() const{return m_doneLoading;}

bool cleanOutThreads();

void FillIntelliWeights(int &rating, int &playcount,
int &lastplay, int &random);
int &lastplay, int &random) const;
QList<Playlist*> *getPlaylists(void) { return m_allPlaylists; }
QStringList getPlaylistNames(void);

Expand All @@ -86,4 +86,4 @@ class PlaylistContainer
int m_randomWeight {2};
};

#endif // _PLAYLIST_CONTAINER_H_
#endif // PLAYLIST_CONTAINER_H
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/playlisteditorview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void PlaylistEditorView::customEvent(QEvent *event)
}
else if (event->type() == DialogCompletionEvent::kEventType)
{
auto *dce = static_cast<DialogCompletionEvent*>(event);
auto *dce = dynamic_cast<DialogCompletionEvent*>(event);

// make sure the user didn't ESCAPE out of the menu
if ((dce == nullptr) || (dce->GetResult() < 0))
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/pls.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PlayListFileEntry

QString File(void) { return m_file; }
QString Title(void) { return m_title; }
int Length(void) { return m_length; }
int Length(void) const { return m_length; }

void setFile(const QString &f) { m_file = f; }
void setTitle(const QString &t) { m_title = t; }
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythmusic/mythmusic/smartplaylist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ QString getSQLFieldName(const QString &fieldName)
///////////////////////////////////////////////////////////////////////
*/

QString SmartPLCriteriaRow::getSQL(void)
QString SmartPLCriteriaRow::getSQL(void) const
{
if (m_field.isEmpty())
return QString();
Expand All @@ -300,7 +300,7 @@ QString SmartPLCriteriaRow::getSQL(void)
}

// return false on error
bool SmartPLCriteriaRow::saveToDatabase(int smartPlaylistID)
bool SmartPLCriteriaRow::saveToDatabase(int smartPlaylistID) const
{
// save playlistitem to database

Expand All @@ -326,7 +326,7 @@ bool SmartPLCriteriaRow::saveToDatabase(int smartPlaylistID)
return true;
}

QString SmartPLCriteriaRow::toString(void)
QString SmartPLCriteriaRow::toString(void) const
{
SmartPLOperator *PLOperator = lookupOperator(m_operator);
if (PLOperator)
Expand Down
14 changes: 7 additions & 7 deletions mythplugins/mythmusic/mythmusic/smartplaylist.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ class SmartPLCriteriaRow

public:

SmartPLCriteriaRow(QString _Field, QString _Operator,
QString _Value1, QString _Value2)
: m_field(std::move(_Field)), m_operator(std::move(_Operator)),
m_value1(std::move(_Value1)), m_value2(std::move(_Value2)) {}
SmartPLCriteriaRow(QString field, QString op,
QString value1, QString value2)
: m_field(std::move(field)), m_operator(std::move(op)),
m_value1(std::move(value1)), m_value2(std::move(value2)) {}
SmartPLCriteriaRow(void) = default;
~SmartPLCriteriaRow(void) = default;

QString getSQL(void);
QString getSQL(void) const;

bool saveToDatabase(int smartPlaylistID);
bool saveToDatabase(int smartPlaylistID) const;

QString toString(void);
QString toString(void) const;

public:
QString m_field;
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/streamview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ void SearchStream::streamClicked(MythUIButtonListItem *item)
if (!item)
return;

MusicMetadata mdata = item->GetData().value<MusicMetadata>();
auto mdata = item->GetData().value<MusicMetadata>();
m_parent->changeStreamMetadata(&mdata);

Close();
Expand All @@ -861,7 +861,7 @@ void SearchStream::streamVisible(MythUIButtonListItem *item)
if (!item)
return;

MusicMetadata mdata = item->GetData().value<MusicMetadata>();
auto mdata = item->GetData().value<MusicMetadata>();
if (!mdata.LogoUrl().isEmpty() && mdata.LogoUrl() != "-")
{
if (item->GetText("dummy") == " ")
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythmusic/mythmusic/synaesthesia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void Synaesthesia::coreInit(void)
#define lastOutput ((unsigned char*)m_lastOutputBmp.data)
#define lastLastOutput ((unsigned char*)m_lastLastOutputBmp.data)

void Synaesthesia::addPixel(int x, int y, int br1, int br2)
void Synaesthesia::addPixel(int x, int y, int br1, int br2) const
{
if (x < 0 || x > m_outWidth || y < 0 || y >= m_outHeight)
return;
Expand Down Expand Up @@ -250,15 +250,15 @@ void Synaesthesia::addPixelFast(unsigned char *p, int br1, int br2)
p[1] = 255;
}

unsigned char Synaesthesia::getPixel(int x, int y, int where)
unsigned char Synaesthesia::getPixel(int x, int y, int where) const
{
if (x < 0 || y < 0 || x >= m_outWidth || y >= m_outHeight)
return 0;

return lastOutput[where];
}

void Synaesthesia::fadeFade(void)
void Synaesthesia::fadeFade(void) const
{
auto *ptr = (uint32_t *)output;
int i = m_outWidth * m_outHeight * 2 / sizeof(uint32_t);
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythmusic/mythmusic/synaesthesia.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class Synaesthesia : public VisualBase
void fft(double *x, double *y);
void setStarSize(double lsize);

inline void addPixel(int x, int y, int br1, int br2);
inline void addPixel(int x, int y, int br1, int br2) const;
static inline void addPixelFast(unsigned char *p, int br1, int br2);
inline unsigned char getPixel(int x, int y, int where);
inline unsigned char getPixel(int x, int y, int where) const;

inline void fadePixelWave(int x, int y, int where, int step);
void fadeWave(void);
inline void fadePixelHeat(int x, int y, int where, int step);
void fadeHeat(void);
void fadeFade(void);
void fadeFade(void) const;
void fade(void);

QSize m_size {0,0};
Expand Down
8 changes: 4 additions & 4 deletions mythplugins/mythmusic/mythmusic/visualize.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class VisFactory
VisFactory* m_pNextVisFactory {nullptr};
};

#define RUBBERBAND 0
#define RUBBERBAND false
#define TWOCOLOUR 0

class StereoScope : public VisualBase
Expand All @@ -131,7 +131,7 @@ class StereoScope : public VisualBase
protected:
QColor m_startColor {Qt::green};
QColor m_targetColor {Qt::red};
vector<double> m_magnitudes;
vector<double> m_magnitudes {};
QSize m_size;
bool const m_rubberband {RUBBERBAND};
double const m_falloff {1.0};
Expand Down Expand Up @@ -284,15 +284,15 @@ struct piano_key_data {
QColor m_blackStartColor {10,10,10};
QColor m_blackTargetColor {Qt::red};

vector<QRect> m_rects;
vector<QRect> m_rects {};
QSize m_size;

unsigned long m_offset_processed {0};

piano_key_data *m_piano_data {nullptr};
piano_audio *m_audio_data {nullptr};

vector<double> m_magnitude;
vector<double> m_magnitude {};
};

class AlbumArt : public VisualBase
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythnetvision/mythnetvision/nettree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void NetTree::UpdateItem(MythUIButtonListItem *item)

if (QFile::exists(dlfile))
item->SetImage(dlfile);
else if (video->GetThumbnail().startsWith("http"))
else if (m_imageDownload && video->GetThumbnail().startsWith("http"))
m_imageDownload->addThumb(video->GetTitle(), video->GetThumbnail(),
QVariant::fromValue<uint>(pos));
}
Expand All @@ -287,7 +287,7 @@ void NetTree::UpdateItem(MythUIButtonListItem *item)
node->GetText());
if (QFile::exists(dlfile))
item->SetImage(dlfile);
else
else if (m_imageDownload)
m_imageDownload->addThumb(node->GetText(), tpath,
QVariant::fromValue<uint>(pos));
}
Expand Down
108 changes: 0 additions & 108 deletions mythplugins/mythnews/mythnews/dbcheck.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion mythplugins/mythnews/mythnews/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <mythmainwindow.h>

// MythNews headers
#include "dbcheck.h"
#include "newsdbcheck.h"
#include "mythnews.h"
#include "mythnewsconfig.h"

Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythnews/mythnews/mythnews.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ INSTALLS += installfiles
# Input
HEADERS += mythnews.h mythnewsconfig.h mythnewseditor.h
HEADERS += newssite.h newsarticle.h
HEADERS += newsdbutil.h dbcheck.h
HEADERS += newsdbutil.h newsdbcheck.h
SOURCES += mythnews.cpp mythnewsconfig.cpp mythnewseditor.cpp
SOURCES += newssite.cpp newsarticle.cpp
SOURCES += newsdbutil.cpp dbcheck.cpp
SOURCES += newsdbutil.cpp newsdbcheck.cpp
SOURCES += main.cpp

DEFINES += MPLUGIN_API
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythnews/mythnews/newsarticle.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NEWSARTICLE_H_
#define _NEWSARTICLE_H_
#ifndef NEWSARTICLE_H
#define NEWSARTICLE_H

// C++ headers
#include <vector>
Expand Down Expand Up @@ -37,4 +37,4 @@ class NewsArticle
QString m_enclosureType;
};

#endif // _NEWSARTICLE_H_
#endif // NEWSARTICLE_H
59 changes: 59 additions & 0 deletions mythplugins/mythnews/mythnews/newsdbcheck.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// C++ headers
#include <iostream>

// QT headers
#include <QString>
#include <QSqlError>

// Myth headers
#include <mythcontext.h>
#include <mythdb.h>
#include <mythdbcheck.h>

// MythNews headers
#include "newsdbcheck.h"

const QString currentDatabaseVersion = "1001";
const QString MythNewsVersionName = "NewsDBSchemaVer";

bool UpgradeNewsDatabaseSchema(void)
{
QString dbver = gCoreContext->GetSetting("NewsDBSchemaVer");

if (dbver == currentDatabaseVersion)
return true;

if (dbver.isEmpty())
{
LOG(VB_GENERAL, LOG_NOTICE,
"Inserting MythNews initial database information.");

DBUpdates updates
{
"CREATE TABLE IF NOT EXISTS newssites "
"( name VARCHAR(100) NOT NULL PRIMARY KEY,"
" category VARCHAR(255) NOT NULL,"
" url VARCHAR(255) NOT NULL,"
" ico VARCHAR(255),"
" updated INT UNSIGNED);"
};
if (!performActualUpdate("MythNews", MythNewsVersionName,
updates, "1000", dbver))
return false;
}

if (dbver == "1000")
{
DBUpdates updates
{
"ALTER TABLE `newssites` ADD `podcast` BOOL NOT NULL DEFAULT '0';"
};

if (!performActualUpdate("MythNews", MythNewsVersionName,
updates, "1001", dbver))
return false;
}

return true;
}

File renamed without changes.
2 changes: 1 addition & 1 deletion mythplugins/mythnews/mythnews/newsdbutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ bool findInDB(const QString &name);
bool insertInDB(NewsSiteItem *site);
bool insertInDB(const QString &name, const QString &url,
const QString &icon, const QString &category,
const bool podcast);
bool podcast);

bool removeFromDB(NewsSiteItem *site);
bool removeFromDB(const QString &name);
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythnews/mythnews/newssite.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NEWSSITE_H_
#define _NEWSSITE_H_
#ifndef NEWSSITE_H
#define NEWSSITE_H

// C++ headers
#include <vector>
Expand Down Expand Up @@ -134,4 +134,4 @@ class NewsSite : public QObject
};
Q_DECLARE_METATYPE(NewsSite*)

#endif // _NEWSSITE_H_
#endif // NEWSSITE_H
2 changes: 1 addition & 1 deletion mythplugins/mythweather/mythweather/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "weather.h"
#include "weatherSetup.h"
#include "sourceManager.h"
#include "dbcheck.h"
#include "weatherdbcheck.h"

SourceManager *srcMan = nullptr;

Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythweather/mythweather/mythweather.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ datafiles.files = weather-screens.xml
INSTALLS += datafiles

# Input
HEADERS += weather.h weatherSource.h sourceManager.h weatherScreen.h dbcheck.h
HEADERS += weather.h weatherSource.h sourceManager.h weatherScreen.h weatherdbcheck.h
HEADERS += weatherSetup.h weatherUtils.h
SOURCES += main.cpp weather.cpp weatherSource.cpp sourceManager.cpp weatherScreen.cpp
SOURCES += dbcheck.cpp weatherSetup.cpp weatherUtils.cpp
SOURCES += weatherdbcheck.cpp weatherSetup.cpp weatherUtils.cpp

DEFINES += MPLUGIN_API

Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythweather/mythweather/sourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ bool SourceManager::findScripts()
busyPopup = nullptr;
}

qApp->processEvents();
QCoreApplication::processEvents();

recurseDirs(dir);

Expand Down Expand Up @@ -360,7 +360,7 @@ void SourceManager::recurseDirs( QDir dir )

for (const auto & file : files)
{
qApp->processEvents();
QCoreApplication::processEvents();
if (file.isDir())
{
QDir recurseTo(file.filePath());
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythweather/mythweather/sourceManager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _SOURCEMANAGER_H_
#define _SOURCEMANAGER_H_
#ifndef SOURCEMANAGER_H
#define SOURCEMANAGER_H

// QT headers
#include <QDir>
Expand Down Expand Up @@ -46,4 +46,4 @@ class SourceManager : public QObject
void recurseDirs(QDir dir);
};

#endif
#endif /* SOURCEMANAGER_H */
12 changes: 6 additions & 6 deletions mythplugins/mythweather/mythweather/weatherScreen.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _WEATHERSCREEN_H_
#define _WEATHERSCREEN_H_
#ifndef WEATHERSCREEN_H
#define WEATHERSCREEN_H

// QT headers
#include <QStringList>
Expand Down Expand Up @@ -42,11 +42,11 @@ class WeatherScreen : public MythScreenType
bool containsKey(const QString &key) { return m_dataValueMap.contains(key); }
virtual bool canShowScreen();
void setUnits(units_t units) { m_units = units; }
units_t getUnits() { return m_units; }
units_t getUnits() const { return m_units; }
virtual bool usingKeys() { return false; }
bool inUse() { return m_inuse; }
bool inUse() const { return m_inuse; }
void setInUse(bool inuse) { m_inuse = inuse; }
int getId() { return m_id; }
int getId() const { return m_id; }

signals:
void screenReady(WeatherScreen *);
Expand Down Expand Up @@ -74,4 +74,4 @@ class WeatherScreen : public MythScreenType
int m_id;
};

#endif
#endif // WEATHERSCREEN_H
6 changes: 3 additions & 3 deletions mythplugins/mythweather/mythweather/weatherSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ void LocationDialog::doSearch()
QString searchingresults = tr("Searching... Results: %1");

m_resultsText->SetText(searchingresults.arg(0));
qApp->processEvents();
QCoreApplication::processEvents();

QList<ScriptInfo *> sources;
// if a screen makes it this far, theres at least one source for it
Expand All @@ -949,7 +949,7 @@ void LocationDialog::doSearch()
result_cache[si] = results;
numresults += results.size();
m_resultsText->SetText(searchingresults.arg(numresults));
qApp->processEvents();
QCoreApplication::processEvents();
}
}

Expand Down Expand Up @@ -977,7 +977,7 @@ void LocationDialog::doSearch()
ri->idstr = tmp[0];
ri->src = si;
item->SetData(QVariant::fromValue(ri));
qApp->processEvents();
QCoreApplication::processEvents();
}
}

Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythweather/mythweather/weatherSetup.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _WEATHER_SETUP_H_
#define _WEATHER_SETUP_H_
#ifndef WEATHER_SETUP_H
#define WEATHER_SETUP_H

// QT headers
#include <QList>
Expand Down Expand Up @@ -166,4 +166,4 @@ class LocationDialog : public MythScreenType
MythUIText *m_sourceText;
};

#endif
#endif /* WEATHER_SETUP_H */
12 changes: 6 additions & 6 deletions mythplugins/mythweather/mythweather/weatherSource.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __WEATHER_SOURCE_H__
#define __WEATHER_SOURCE_H__
#ifndef WEATHER_SOURCE_H
#define WEATHER_SOURCE_H

#include <QStringList>
#include <QObject>
Expand Down Expand Up @@ -47,12 +47,12 @@ class WeatherSource : public QObject
explicit WeatherSource(ScriptInfo *info);
~WeatherSource() override;

bool isReady() { return m_ready; }
bool isReady() const { return m_ready; }
QString getVersion() { return m_info->version; }
QString getName() { return m_info->name; }
QString getAuthor() { return m_info->author; }
QString getEmail() { return m_info->email; }
units_t getUnits() { return m_units; }
units_t getUnits() const { return m_units; }
void setUnits(units_t units) { m_units = units; }
QStringList getLocationList(const QString &str);
void setLocale(const QString &locale) { m_locale = locale; }
Expand All @@ -69,7 +69,7 @@ class WeatherSource : public QObject
void startUpdateTimer() { m_updateTimer->start(m_info->updateTimeout); }
void stopUpdateTimer() { m_updateTimer->stop(); }

bool inUse() { return m_inuse; }
bool inUse() const { return m_inuse; }
void setInUse(bool inuse) { m_inuse = inuse; }

int getId() { return m_info->id; }
Expand Down Expand Up @@ -101,4 +101,4 @@ class WeatherSource : public QObject
DataMap m_data;
};

#endif
#endif /* WEATHER_SOURCE_H */
6 changes: 3 additions & 3 deletions mythplugins/mythweather/mythweather/weatherUtils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _WEATHERUTILS_H_
#define _WEATHERUTILS_H_
#ifndef WEATHERUTILS_H
#define WEATHERUTILS_H

#include <utility>

Expand Down Expand Up @@ -73,4 +73,4 @@ ScreenListMap loadScreens();
QStringList loadScreen(const QDomElement& ScreenListInfo);
bool doLoadScreens(const QString &filename, ScreenListMap &screens);

#endif
#endif /* WEATHERUTILS_H */
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,12 @@

#include <mythcontext.h>
#include <mythdb.h>
#include <mythdbcheck.h>

#include "dbcheck.h"
#include "weatherdbcheck.h"

const QString currentDatabaseVersion = "1006";

static bool UpdateDBVersionNumber(const QString &newnumber)
{
if (!gCoreContext->SaveSettingOnHost("WeatherDBSchemaVer",newnumber,nullptr))
{
LOG(VB_GENERAL, LOG_ERR,
QString("DB Error (Setting new DB version number): %1\n")
.arg(newnumber));

return false;
}

return true;
}

static bool performActualUpdate(const QStringList& updates, const QString& version,
QString &dbver)
{
LOG(VB_GENERAL, LOG_NOTICE,
"Upgrading to MythWeather schema version " + version);

MSqlQuery query(MSqlQuery::InitCon());

QStringList::const_iterator it = updates.begin();

while (it != updates.end())
{
QString thequery = *it;
if (!query.exec(thequery))
{
QString msg =
QString("DB Error (Performing database upgrade): \n"
"Query was: %1 \nError was: %2 \nnew version: %3")
.arg(thequery)
.arg(MythDB::DBErrorMessage(query.lastError()))
.arg(version);
LOG(VB_GENERAL, LOG_ERR, msg);
return false;
}
++it;
}

if (!UpdateDBVersionNumber(version))
return false;

dbver = version;
return true;
}
const QString MythWeatherVersionName = "WeatherDBSchemaVer";

/*
* TODO Probably the biggest change to simplify things would be to get rid of
Expand All @@ -75,8 +29,8 @@ bool InitializeDatabase()
{
LOG(VB_GENERAL, LOG_NOTICE,
"Inserting MythWeather initial database information.");
QStringList updates;
updates << "CREATE TABLE IF NOT EXISTS weathersourcesettings ("
DBUpdates updates {
"CREATE TABLE IF NOT EXISTS weathersourcesettings ("
"sourceid INT UNSIGNED NOT NULL AUTO_INCREMENT,"
"source_name VARCHAR(64) NOT NULL,"
"update_timeout INT UNSIGNED NOT NULL DEFAULT '600',"
Expand All @@ -87,15 +41,15 @@ bool InitializeDatabase()
"version VARCHAR(32) NULL,"
"email VARCHAR(255) NULL,"
"types MEDIUMTEXT NULL,"
"PRIMARY KEY(sourceid)) ENGINE=InnoDB;"
<< "CREATE TABLE IF NOT EXISTS weatherscreens ("
"PRIMARY KEY(sourceid)) ENGINE=InnoDB;",
"CREATE TABLE IF NOT EXISTS weatherscreens ("
"screen_id INT UNSIGNED NOT NULL AUTO_INCREMENT,"
"draworder INT UNSIGNED NOT NULL,"
"container VARCHAR(64) NOT NULL,"
"hostname VARCHAR(255) NULL,"
"units TINYINT UNSIGNED NOT NULL,"
"PRIMARY KEY(screen_id)) ENGINE=InnoDB;"
<< "CREATE TABLE IF NOT EXISTS weatherdatalayout ("
"PRIMARY KEY(screen_id)) ENGINE=InnoDB;",
"CREATE TABLE IF NOT EXISTS weatherdatalayout ("
"location VARCHAR(64) NOT NULL,"
"dataitem VARCHAR(64) NOT NULL,"
"weatherscreens_screen_id INT UNSIGNED NOT NULL,"
Expand All @@ -111,67 +65,73 @@ bool InitializeDatabase()
"FOREIGN KEY(weathersourcesettings_sourceid) "
"REFERENCES weathersourcesettings(sourceid) "
"ON DELETE RESTRICT "
"ON UPDATE CASCADE) ENGINE=InnoDB;";
"ON UPDATE CASCADE) ENGINE=InnoDB;"
};
/*
* TODO Possible want to delete old stuff (i.e. agressiveness, locale..)
* that we don't use any more
*/

if (!performActualUpdate(updates, "1000", dbver))
if (!performActualUpdate("MythWeather", MythWeatherVersionName,
updates, "1000", dbver))
return false;
}

if (dbver == "1000")
{
QStringList updates;
updates << "ALTER TABLE weathersourcesettings ADD COLUMN updated "
DBUpdates updates {
"ALTER TABLE weathersourcesettings ADD COLUMN updated "
"TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP "
" ON UPDATE CURRENT_TIMESTAMP;";
" ON UPDATE CURRENT_TIMESTAMP;"
};

if (!performActualUpdate(updates, "1001", dbver))
if (!performActualUpdate("MythWeather", MythWeatherVersionName,
updates, "1001", dbver))
return false;
}



if (dbver == "1001")
{
QStringList updates;
updates << QString("ALTER DATABASE %1 DEFAULT CHARACTER SET latin1;")
.arg(gContext->GetDatabaseParams().m_dbName) <<
DBUpdates updates {
qPrintable(QString("ALTER DATABASE %1 DEFAULT CHARACTER SET latin1;")
.arg(gContext->GetDatabaseParams().m_dbName)),
"ALTER TABLE weatherdatalayout"
" MODIFY location varbinary(64) NOT NULL,"
" MODIFY dataitem varbinary(64) NOT NULL;" <<
" MODIFY dataitem varbinary(64) NOT NULL;",
"ALTER TABLE weatherscreens"
" MODIFY container varbinary(64) NOT NULL,"
" MODIFY hostname varbinary(64) default NULL;" <<
" MODIFY hostname varbinary(64) default NULL;",
"ALTER TABLE weathersourcesettings"
" MODIFY source_name varbinary(64) NOT NULL,"
" MODIFY hostname varbinary(64) default NULL,"
" MODIFY path varbinary(255) default NULL,"
" MODIFY author varbinary(128) default NULL,"
" MODIFY version varbinary(32) default NULL,"
" MODIFY email varbinary(255) default NULL,"
" MODIFY types mediumblob;";
" MODIFY types mediumblob;"
};

if (!performActualUpdate(updates, "1002", dbver))
if (!performActualUpdate("MythWeather", MythWeatherVersionName,
updates, "1002", dbver))
return false;
}


if (dbver == "1002")
{
QStringList updates;
updates << QString("ALTER DATABASE %1 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;")
.arg(gContext->GetDatabaseParams().m_dbName) <<
DBUpdates updates {
qPrintable(QString("ALTER DATABASE %1 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;")
.arg(gContext->GetDatabaseParams().m_dbName)),
"ALTER TABLE weatherdatalayout"
" DEFAULT CHARACTER SET default,"
" MODIFY location varchar(64) CHARACTER SET utf8 NOT NULL,"
" MODIFY dataitem varchar(64) CHARACTER SET utf8 NOT NULL;" <<
" MODIFY dataitem varchar(64) CHARACTER SET utf8 NOT NULL;",
"ALTER TABLE weatherscreens"
" DEFAULT CHARACTER SET default,"
" MODIFY container varchar(64) CHARACTER SET utf8 NOT NULL,"
" MODIFY hostname varchar(64) CHARACTER SET utf8 default NULL;" <<
" MODIFY hostname varchar(64) CHARACTER SET utf8 default NULL;",
"ALTER TABLE weathersourcesettings"
" DEFAULT CHARACTER SET default,"
" MODIFY source_name varchar(64) CHARACTER SET utf8 NOT NULL,"
Expand All @@ -180,40 +140,48 @@ bool InitializeDatabase()
" MODIFY author varchar(128) CHARACTER SET utf8 default NULL,"
" MODIFY version varchar(32) CHARACTER SET utf8 default NULL,"
" MODIFY email varchar(255) CHARACTER SET utf8 default NULL,"
" MODIFY types mediumtext CHARACTER SET utf8;";
" MODIFY types mediumtext CHARACTER SET utf8;"
};

if (!performActualUpdate(updates, "1003", dbver))
if (!performActualUpdate("MythWeather", MythWeatherVersionName,
updates, "1003", dbver))
return false;
}

if (dbver == "1003")
{
QStringList updates;
updates << "DELETE FROM keybindings "
" WHERE action = 'DELETE' AND context = 'Weather';";
DBUpdates updates {
"DELETE FROM keybindings "
" WHERE action = 'DELETE' AND context = 'Weather';"
};

if (!performActualUpdate(updates, "1004", dbver))
if (!performActualUpdate("MythWeather", MythWeatherVersionName,
updates, "1004", dbver))
return false;
}

if (dbver == "1004")
{
QStringList updates;
updates << "ALTER TABLE weatherdatalayout"
" MODIFY location varchar(128) CHARACTER SET utf8 NOT NULL;";
DBUpdates updates {
"ALTER TABLE weatherdatalayout"
" MODIFY location varchar(128) CHARACTER SET utf8 NOT NULL;"
};

if (!performActualUpdate(updates, "1005", dbver))
if (!performActualUpdate("MythWeather", MythWeatherVersionName,
updates, "1005", dbver))
return false;
}

if (dbver == "1005")
{
QStringList updates;
updates << "ALTER TABLE weathersourcesettings MODIFY COLUMN updated "
" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP "
" ON UPDATE CURRENT_TIMESTAMP;";

if (!performActualUpdate(updates, "1006", dbver))
DBUpdates updates {
"ALTER TABLE weathersourcesettings MODIFY COLUMN updated "
" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP "
" ON UPDATE CURRENT_TIMESTAMP;"
};

if (!performActualUpdate("MythWeather", MythWeatherVersionName,
updates, "1006", dbver))
return false;
}

Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions mythplugins/mythzoneminder/mythzmserver/zmserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void connectToDatabase(void)
if (!mysql_init(&g_dbConn))
{
cout << "Error: Can't initialise structure: " << mysql_error(&g_dbConn) << endl;
exit(mysql_errno(&g_dbConn));
exit(static_cast<int>(mysql_errno(&g_dbConn)));
}

reconnect_t reconnect = 1;
Expand All @@ -198,13 +198,13 @@ void connectToDatabase(void)
g_password.c_str(), nullptr, 0, nullptr, 0))
{
cout << "Error: Can't connect to server: " << mysql_error(&g_dbConn) << endl;
exit(mysql_errno( &g_dbConn));
exit(static_cast<int>(mysql_errno( &g_dbConn)));
}

if (mysql_select_db(&g_dbConn, g_database.c_str()))
{
cout << "Error: Can't select database: " << mysql_error(&g_dbConn) << endl;
exit(mysql_errno(&g_dbConn));
exit(static_cast<int>(mysql_errno(&g_dbConn)));
}
}

Expand Down Expand Up @@ -237,7 +237,7 @@ void kickDatabase(bool debug)

void MONITOR::initMonitor(bool debug, const string &mmapPath, int shmKey)
{
int shared_data_size = 0;
size_t shared_data_size = 0;
int frame_size = m_width * m_height * m_bytesPerPixel;

if (!m_enabled)
Expand Down Expand Up @@ -765,7 +765,7 @@ void ZMServer::handleGetServerStatus(void)
long long used = 0;
string eventsDir = g_webPath + "/events/";
getDiskSpace(eventsDir, total, used);
sprintf(buf, "%d%%", (int) ((100.0F / ((float) total / used))));
sprintf(buf, "%d%%", static_cast<int>((used * 100) / total));
ADD_STR(outStr, buf)

send(outStr);
Expand Down Expand Up @@ -1875,7 +1875,7 @@ int ZMServer::getFrame(unsigned char *buffer, int bufferSize, MONITOR *monitor)
return monitor->m_width * monitor->m_height * 3;
}

string ZMServer::getZMSetting(const string &setting)
string ZMServer::getZMSetting(const string &setting) const
{
string result;
string sql("SELECT Name, Value FROM Config ");
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythzoneminder/mythzmserver/zmserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class ZMServer
bool processRequest(char* buf, int nbytes);

private:
string getZMSetting(const string &setting);
string getZMSetting(const string &setting) const;
bool send(const string &s) const;
bool send(const string &s, const unsigned char *buffer, int dataLen) const;
void sendError(const string &error);
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythzoneminder/mythzoneminder/zmclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ void ZMClient::customEvent (QEvent* event)
QObject::customEvent(event);
}

void ZMClient::showMiniPlayer(int monitorID)
void ZMClient::showMiniPlayer(int monitorID) const
{
if (!isMiniPlayerEnabled())
return;
Expand Down
6 changes: 3 additions & 3 deletions mythplugins/mythzoneminder/mythzoneminder/zmclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class MPUBLIC ZMClient : public QObject

// Used to actually connect to an ZM server
bool connectToHost(const QString &hostname, unsigned int port);
bool connected(void) { return m_bConnected; }
bool connected(void) const { return m_bConnected; }

bool checkProtoVersion(void);

Expand Down Expand Up @@ -61,11 +61,11 @@ class MPUBLIC ZMClient : public QObject
void setMonitorFunction(int monitorID, const QString &function, bool enabled);
bool updateAlarmStates(void);

bool isMiniPlayerEnabled(void) { return m_isMiniPlayerEnabled; }
bool isMiniPlayerEnabled(void) const { return m_isMiniPlayerEnabled; }
void setIsMiniPlayerEnabled(bool enabled) { m_isMiniPlayerEnabled = enabled; }

void saveNotificationMonitors(void);
void showMiniPlayer(int monitorID);
void showMiniPlayer(int monitorID) const;

private slots:
void restartConnection(void); // Try to re-establish the connection to
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythzoneminder/mythzoneminder/zmevents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ void ZMEvents::playerExited(void)
{
// refresh the grid and restore the saved position

if (m_savedPosition > (int)m_eventList->size() - 1)
if (m_savedPosition > m_eventList->size() - 1)
m_savedPosition = m_eventList->size() - 1;

updateUIList();
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythzoneminder/mythzoneminder/zmevents.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ZMEvents : public MythScreenType

std::vector<Event *> *m_eventList {nullptr};
QStringList m_dateList;
int m_savedPosition {0};
size_t m_savedPosition {0};
int m_currentCamera {-1};
int m_currentDate {-1};

Expand Down
14 changes: 7 additions & 7 deletions mythplugins/mythzoneminder/mythzoneminder/zmplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ using namespace std;
#include "zmclient.h"

ZMPlayer::ZMPlayer(MythScreenStack *parent, const char *name,
vector<Event *> *eventList, int *currentEvent)
vector<Event *> *eventList, size_t *currentEvent)
:MythScreenType(parent, name),
m_currentEvent(currentEvent),
m_eventList(eventList), m_frameList(new vector<Frame*>),
Expand Down Expand Up @@ -128,7 +128,7 @@ void ZMPlayer::getEventInfo()
{
m_frameTimer->stop();

if (*m_currentEvent == -1)
if (*m_currentEvent == static_cast<size_t>(-1))
{
stopPlayer();

Expand Down Expand Up @@ -284,7 +284,7 @@ void ZMPlayer::playPressed()

void ZMPlayer::deletePressed()
{
if (m_eventList->empty() || *m_currentEvent > (int) m_eventList->size() - 1)
if (m_eventList->empty() || (*m_currentEvent > m_eventList->size() - 1))
return;

Event *event = m_eventList->at(*m_currentEvent);
Expand All @@ -296,8 +296,8 @@ void ZMPlayer::deletePressed()
zm->deleteEvent(event->eventID());

m_eventList->erase(m_eventList->begin() + *m_currentEvent);
if (*m_currentEvent > (int)m_eventList->size() - 1)
*m_currentEvent = m_eventList->size() - 1;
if (*m_currentEvent > (m_eventList->size() - 1))
*m_currentEvent = (m_eventList->size() - 1);

getEventInfo();

Expand All @@ -314,7 +314,7 @@ void ZMPlayer::nextPressed()
if (m_eventList->empty())
return;

if (*m_currentEvent >= (int) m_eventList->size() - 1)
if (*m_currentEvent >= (m_eventList->size() - 1))
return;

(*m_currentEvent)++;
Expand All @@ -333,7 +333,7 @@ void ZMPlayer::prevPressed()
if (*m_currentEvent <= 0)
return;

if (*m_currentEvent > (int) m_eventList->size())
if (*m_currentEvent > m_eventList->size())
*m_currentEvent = m_eventList->size();

(*m_currentEvent)--;
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythzoneminder/mythzoneminder/zmplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ZMPlayer : public MythScreenType

public:
ZMPlayer(MythScreenStack *parent, const char *name,
std::vector<Event *> *eventList, int *currentEvent);
std::vector<Event *> *eventList, size_t *currentEvent);
~ZMPlayer() override;

bool Create(void) override; // MythScreenType
Expand Down Expand Up @@ -69,7 +69,7 @@ class ZMPlayer : public MythScreenType
MythUIButton *m_nextButton {nullptr};
MythUIButton *m_prevButton {nullptr};

int *m_currentEvent {nullptr};
size_t *m_currentEvent {nullptr};
std::vector<Event *> *m_eventList {nullptr};

std::vector<Frame *> *m_frameList {nullptr};
Expand Down
19 changes: 2 additions & 17 deletions mythtv/configure
Original file line number Diff line number Diff line change
Expand Up @@ -4574,8 +4574,6 @@ if test "$?" != 0; then
die "C compiler test failed."
fi

add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
#add_cxxflags -D__STDC_CONSTANT_MACROS
check_cxxflags -std=$CPP_STANDARD -faligned-new

# some compilers silently accept -std=c11, so we also need to check that the
Expand All @@ -4600,16 +4598,10 @@ fi


check_cppflags -D_FILE_OFFSET_BITS=64
check_cppflags -D_LARGEFILE_SOURCE
check_cxx -D_FILE_OFFSET_BITS=64 <<EOF && add_cxxppflags -D_FILE_OFFSET_BITS=64
#include <stdlib.h>
EOF
check_cxx -D_LARGEFILE_SOURCE <<EOF && add_cxxppflags -D_LARGEFILE_SOURCE
#include <stdlib.h>
EOF

add_host_cppflags -D_ISOC99_SOURCE
check_host_cflags -std=c99
check_host_cflags -Wall
check_host_cflags $host_cflags_speed

Expand Down Expand Up @@ -4701,7 +4693,7 @@ case $target_os in
enabled_all suncc x86 &&
echo "hwcap_1 = OVERRIDE;" > mapfile &&
add_ldflags -Wl,-M,mapfile
add_cxxppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
add_cxxppflags -D__EXTENSIONS__
nm_default='nm -P -g'
version_script='-M'
VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
Expand All @@ -4711,8 +4703,6 @@ case $target_os in
oss_indev_extralibs="-lossaudio"
oss_outdev_extralibs="-lossaudio"
enabled gcc || check_ldflags -Wl,-zmuldefs
add_cppflags -D_XOPEN_SOURCE=600
add_cxxppflags -D_XOPEN_SOURCE=600
;;
openbsd|bitrig)
disable symver
Expand Down Expand Up @@ -4894,7 +4884,6 @@ case $target_os in
enabled x86_64 && objformat="win64" || objformat="win32"
enable dos_paths
enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
;;
*-dos|freedos|opendos)
disable ffserver
Expand Down Expand Up @@ -4926,7 +4915,6 @@ case $target_os in
strip="lxlite -CS"
striptype=""
objformat="aout"
add_cppflags -D_GNU_SOURCE
add_ldflags -Zomf -Zbin-files -Zargs-wild -Zhigh-mem -Zmap
SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
LIBSUF="_s.a"
Expand Down Expand Up @@ -5081,7 +5069,7 @@ EOF
eval ${pfx}libc_type=bionic
elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
eval ${pfx}libc_type=solaris
add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
add_${pfx}cppflags -D__EXTENSIONS__
fi
check_${pfx}cc <<EOF
#include <time.h>
Expand Down Expand Up @@ -6274,9 +6262,6 @@ check_cxxflags -Wpointer-arith
if disabled deprecation_warnings; then
check_cxxflags -Wno-deprecated-declarations
fi
#needed for INT64_C in libs/libavformat under g++
check_cxxflags -D__STDC_CONSTANT_MACROS
check_cxxflags -D__STDC_LIMIT_MACROS

# add some linker flags
check_ldflags -Wl,--warn-common
Expand Down
1 change: 0 additions & 1 deletion mythtv/external/FFmpeg/configure
Original file line number Diff line number Diff line change
Expand Up @@ -5144,7 +5144,6 @@ if test "$?" != 0; then
fi

add_cppflags -D_ISOC99_SOURCE
add_cxxflags -D__STDC_CONSTANT_MACROS
check_cxxflags -std=c++11 || check_cxxflags -std=c++0x

# some compilers silently accept -std=c11, so we also need to check that the
Expand Down
4 changes: 0 additions & 4 deletions mythtv/external/FFmpeg/libavutil/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
#ifndef AVUTIL_COMMON_H
#define AVUTIL_COMMON_H

#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C)
#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
#endif

#include <errno.h>
#include <inttypes.h>
#include <limits.h>
Expand Down
4 changes: 0 additions & 4 deletions mythtv/external/FFmpeg/libavutil/timestamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@

#include "common.h"

#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64)
#error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS
#endif

#define AV_TS_MAX_STRING_SIZE 32

/**
Expand Down
6 changes: 3 additions & 3 deletions mythtv/external/libmythbluray/src/libbluray/bluray.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ static void _update_textst_timer(BLURAY *bd)
gc_run(bd->graphics_controller, GC_CTRL_PG_UPDATE, bd->gc_wakeup_time, &cmds);

bd->gc_wakeup_time = cmds.wakeup_time;
bd->gc_wakeup_pos = (uint64_t)(int64_t)-1; /* no wakeup */
bd->gc_wakeup_pos = UINT64_MAX; /* no wakeup */

/* next event in this clip ? */
if (cmds.wakeup_time >= bd->st0.clip->in_time && cmds.wakeup_time < bd->st0.clip->out_time) {
Expand Down Expand Up @@ -1538,7 +1538,7 @@ static void _find_next_playmark(BLURAY *bd)
unsigned ii;

bd->next_mark = -1;
bd->next_mark_pos = (uint64_t)-1;
bd->next_mark_pos = UINT64_MAX;
for (ii = 0; ii < bd->title->mark_list.count; ii++) {
uint64_t pos = (uint64_t)bd->title->mark_list.mark[ii].title_pkt * 192L;
if (pos > bd->s_pos) {
Expand All @@ -1564,7 +1564,7 @@ static void _playmark_reached(BLURAY *bd)
bd->next_mark_pos = (uint64_t)bd->title->mark_list.mark[bd->next_mark].title_pkt * 192L;
} else {
bd->next_mark = -1;
bd->next_mark_pos = (uint64_t)-1;
bd->next_mark_pos = UINT64_MAX;
}

/* chapter tracking */
Expand Down
8 changes: 4 additions & 4 deletions mythtv/external/libmythbluray/src/libbluray/hdmv/hdmv_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ static int _save_state(HDMV_VM *p, uint32_t *s)
s[0] = (uint32_t)(p->playing_object - p->movie_objects->objects);
s[1] = p->playing_pc;
} else {
s[0] = (uint32_t)-1;
s[0] = UINT32_MAX;
}

if (p->suspended_object) {
s[2] = (uint32_t)(p->suspended_object - p->movie_objects->objects);
s[3] = p->suspended_pc;
} else {
s[2] = (uint32_t)-1;
s[2] = UINT32_MAX;
}

/* nv timer ? */
Expand All @@ -118,7 +118,7 @@ static int _save_state(HDMV_VM *p, uint32_t *s)

static int _restore_state(HDMV_VM *p, const uint32_t *s)
{
if (s[0] == (uint32_t)-1) {
if (s[0] == UINT32_MAX) {
p->playing_object = NULL;
} else if (s[0] >= p->movie_objects->num_objects) {
BD_DEBUG(DBG_HDMV | DBG_CRIT, "_restore_state() failed: invalid playing object index\n");
Expand All @@ -128,7 +128,7 @@ static int _restore_state(HDMV_VM *p, const uint32_t *s)
}
p->playing_pc = s[1];

if (s[2] == (uint32_t)-1) {
if (s[2] == UINT32_MAX) {
p->suspended_object = NULL;
} else if (s[2] >= p->movie_objects->num_objects) {
BD_DEBUG(DBG_HDMV | DBG_CRIT, "_restore_state() failed: invalid suspended object index\n");
Expand Down
4 changes: 2 additions & 2 deletions mythtv/external/libmythbluray/src/util/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <stdarg.h>
#include <string.h>

uint32_t debug_mask = (uint32_t)-1; /* set all bits to make sure bd_debug() is called for initialization */
uint32_t debug_mask = UINT32_MAX; /* set all bits to make sure bd_debug() is called for initialization */
static BD_LOG_FUNC log_func = NULL;

void bd_set_debug_handler(BD_LOG_FUNC f)
Expand Down Expand Up @@ -60,7 +60,7 @@ void bd_debug(const char *file, int line, uint32_t mask, const char *format, ...
logfile = stderr;

char *env = NULL;
if (debug_mask == (uint32_t)-1) {
if (debug_mask == UINT32_MAX) {
/* might be set by application with bd_set_debug_mask() */
debug_mask = DBG_CRIT;
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/external/libmythbluray/src/util/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static uint64_t _bd_get_scr_impl(void)

uint64_t bd_get_scr(void)
{
static uint64_t t0 = (uint64_t)-1;
static uint64_t t0 = UINT64_MAX;

uint64_t now = _bd_get_scr_impl();

Expand Down
Loading