Skip to content

Commit

Permalink
src/{exdeath,main}: smarter versioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
VulpineAmethyst committed Aug 10, 2022
1 parent 9399655 commit 07ab5e3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
23 changes: 21 additions & 2 deletions src/exdeath.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include <QApplication>
#include <QTextStream>

#include "exdeath.hh"

Expand Down Expand Up @@ -268,8 +269,20 @@ void Exdeath::initPreview(void) {

void Exdeath::initConfig(void) {
QString version = QApplication::applicationVersion();
QStringList parts = version.split(".");
if (parts.length() > 2) {
parts.removeLast();
version = parts.join(".");
}
QString cfgVersion = _cfg->value("main/version").toString();
parts = cfgVersion.split(".");
if (parts.length() > 2) {
parts.removeLast();
cfgVersion = parts.join(".");
}
// don't load config from old versions.
if (!version.compare(_cfg->value("main/version", version).toString())) {
if (version.compare(cfgVersion) != 0) {
out << "doesn't match!\n";
return;
}
QString temp = _cfg->value("rom/filename", "").toString();
Expand Down Expand Up @@ -335,7 +348,13 @@ void Exdeath::selMode_index(int idx) {
}

void Exdeath::btnSave_clicked(bool trigger) {
_cfg->setValue("main/version", QApplication::applicationVersion());
QString version = QApplication::applicationVersion();
QStringList parts = version.split(".");
if (parts.length() > 2) {
parts.removeLast();
version = parts.join(".");
}
_cfg->setValue("main/version", version);
_cfg->setValue("rom/filename", filename);
_cfg->setValue("main/mode", selMode->currentIndex());
_cfg->setValue("main/ned", selNED->currentIndex());
Expand Down
2 changes: 1 addition & 1 deletion src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main(int argc, char **argv) {
QApplication::setOrganizationDomain("aerdan.org");
QApplication::setApplicationName("Exdeath");
QApplication::setApplicationDisplayName("Exdeath");
QApplication::setApplicationVersion("0.9.0");
QApplication::setApplicationVersion("0.9.1");

QSettings *cfg = new QSettings();
Exdeath *win = new Exdeath(cfg);
Expand Down

0 comments on commit 07ab5e3

Please sign in to comment.