summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-06-07 23:42:22 +0200
committerPetr Mrázek <peterix@gmail.com>2015-06-09 00:03:42 +0200
commit166813cb918ebd029325e12377989bfdc2021074 (patch)
tree19a1a5a7e3503ccb85c9ac46bcb45e1bef19361e /application
parent38e42ad79493afb759181fa5cead90c9b3483655 (diff)
downloadMultiMC-166813cb918ebd029325e12377989bfdc2021074.tar
MultiMC-166813cb918ebd029325e12377989bfdc2021074.tar.gz
MultiMC-166813cb918ebd029325e12377989bfdc2021074.tar.lz
MultiMC-166813cb918ebd029325e12377989bfdc2021074.tar.xz
MultiMC-166813cb918ebd029325e12377989bfdc2021074.zip
GH-1060 remove some old updater bits and pieces
Diffstat (limited to 'application')
-rw-r--r--application/BuildConfig.cpp.in3
-rw-r--r--application/BuildConfig.h6
-rw-r--r--application/CMakeLists.txt16
-rw-r--r--application/MainWindow.cpp17
-rw-r--r--application/MainWindow.h2
-rw-r--r--application/MultiMC.cpp46
-rw-r--r--application/MultiMC.h15
-rw-r--r--application/dialogs/UpdateDialog.cpp6
-rw-r--r--application/dialogs/UpdateDialog.h2
-rw-r--r--application/dialogs/UpdateDialog.ui12
10 files changed, 10 insertions, 115 deletions
diff --git a/application/BuildConfig.cpp.in b/application/BuildConfig.cpp.in
index 04cfbf05..16920cb2 100644
--- a/application/BuildConfig.cpp.in
+++ b/application/BuildConfig.cpp.in
@@ -17,9 +17,6 @@ Config::Config()
NOTIFICATION_URL = "@MultiMC_NOTIFICATION_URL@";
FULL_VERSION_STR = "@MultiMC_VERSION_MAJOR@.@MultiMC_VERSION_MINOR@.@MultiMC_VERSION_BUILD@";
- UPDATER_DRY_RUN = @MultiMC_UPDATER_DRY_RUN_value@;
- UPDATER_FORCE_LOCAL = @MultiMC_UPDATER_FORCE_LOCAL_value@;
-
GIT_COMMIT = "@MultiMC_GIT_COMMIT@";
VERSION_STR = "@MultiMC_VERSION_STRING@";
NEWS_RSS_URL = "@MultiMC_NEWS_RSS_URL@";
diff --git a/application/BuildConfig.h b/application/BuildConfig.h
index 60aefeb4..8a6a76b5 100644
--- a/application/BuildConfig.h
+++ b/application/BuildConfig.h
@@ -35,12 +35,6 @@ public:
/// Used for matching notifications
QString FULL_VERSION_STR;
- /// enabled for updater dry run
- bool UPDATER_DRY_RUN;
-
- /// enabled for updater dry run
- bool UPDATER_FORCE_LOCAL;
-
/// The commit hash of this build
QString GIT_COMMIT;
diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt
index d3962819..a9ee1da6 100644
--- a/application/CMakeLists.txt
+++ b/application/CMakeLists.txt
@@ -75,22 +75,6 @@ if(MultiMC_UPDATER)
message(STATUS "Updater is enabled. Channel list URL: ${MultiMC_CHANLIST_URL}")
endif()
-#### Updater-related build config options ####
-option(MultiMC_UPDATER_DRY_RUN "Enable updater dry-run mode -- for updater development." OFF)
-option(MultiMC_UPDATER_FORCE_LOCAL "Do not download updated updater -- for updater development." OFF)
-
-if(MultiMC_UPDATER_DRY_RUN)
- set(MultiMC_UPDATER_DRY_RUN_value "true")
-else()
- set(MultiMC_UPDATER_DRY_RUN_value "false")
-endif()
-
-if(MultiMC_UPDATER_FORCE_LOCAL)
- set(MultiMC_UPDATER_FORCE_LOCAL_value "true")
-else()
- set(MultiMC_UPDATER_FORCE_LOCAL_value "false")
-endif()
-
######## Configure header ########
configure_file("${PROJECT_SOURCE_DIR}/BuildConfig.cpp.in" "${PROJECT_BINARY_DIR}/BuildConfig.cpp")
diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp
index 99c94bf8..933c4dbc 100644
--- a/application/MainWindow.cpp
+++ b/application/MainWindow.cpp
@@ -933,9 +933,6 @@ void MainWindow::updateAvailable(GoUpdate::Status status)
case UPDATE_NOW:
downloadUpdates(status);
break;
- case UPDATE_ONEXIT:
- downloadUpdates(status, true);
- break;
}
}
@@ -985,13 +982,9 @@ void MainWindow::notificationsChanged()
MMC->settings()->set("ShownNotifications", intListToString(shownNotifications));
}
-void MainWindow::downloadUpdates(GoUpdate::Status status, bool installOnExit)
+void MainWindow::downloadUpdates(GoUpdate::Status status)
{
qDebug() << "Downloading updates.";
- // TODO: If the user chooses to update on exit, we should download updates in the
- // background.
- // Doing so is a bit complicated, because we'd have to make sure it finished downloading
- // before actually exiting MultiMC.
ProgressDialog updateDlg(this);
status.rootPath = MMC->rootPath;
@@ -999,13 +992,7 @@ void MainWindow::downloadUpdates(GoUpdate::Status status, bool installOnExit)
// If the task succeeds, install the updates.
if (updateDlg.exec(&updateTask))
{
- UpdateFlags baseFlags = None;
- if (BuildConfig.UPDATER_DRY_RUN)
- baseFlags |= DryRun;
- if (installOnExit)
- MMC->installUpdates(updateTask.updateFilesDir(), baseFlags | OnExit);
- else
- MMC->installUpdates(updateTask.updateFilesDir(), baseFlags | RestartOnFinish);
+ MMC->installUpdates(updateTask.updateFilesDir());
}
else
{
diff --git a/application/MainWindow.h b/application/MainWindow.h
index 97111e04..33a5a4ed 100644
--- a/application/MainWindow.h
+++ b/application/MainWindow.h
@@ -177,7 +177,7 @@ slots:
/*!
* Runs the DownloadTask and installs updates.
*/
- void downloadUpdates(GoUpdate::Status status, bool installOnExit = false);
+ void downloadUpdates(GoUpdate::Status status);
protected:
bool eventFilter(QObject *obj, QEvent *ev);
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index 2c6b387c..67b50b40 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -583,61 +583,27 @@ std::shared_ptr<JavaVersionList> MultiMC::javalist()
return m_javalist;
}
-void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags)
+void MultiMC::installUpdates(const QString updateFilesDir)
{
- // if we are going to update on exit, save the params now
- if (flags & OnExit)
- {
- m_updateOnExitPath = updateFilesDir;
- m_updateOnExitFlags = flags & ~OnExit;
- return;
- }
- // otherwise if there already were some params for on exit update, clear them and continue
- else if (m_updateOnExitPath.size())
- {
- m_updateOnExitFlags = None;
- m_updateOnExitPath.clear();
- }
qDebug() << "Installing updates.";
#ifdef WINDOWS
QString finishCmd = applicationFilePath();
- QString updaterBinary = PathCombine(applicationDirPath(), "updater.exe");
#elif LINUX
QString finishCmd = PathCombine(root(), "MultiMC");
- QString updaterBinary = PathCombine(applicationDirPath(), "updater");
#elif OSX
QString finishCmd = applicationFilePath();
- QString updaterBinary = PathCombine(applicationDirPath(), "updater");
#else
#error Unsupported operating system.
#endif
QStringList args;
- // ./updater --install-dir $INSTALL_DIR --package-dir $UPDATEFILES_DIR --script
- // $UPDATEFILES_DIR/file_list.xml --wait $PID --mode main
args << "--install-dir" << root();
args << "--package-dir" << updateFilesDir;
args << "--script" << PathCombine(updateFilesDir, "file_list.xml");
args << "--wait" << QString::number(applicationPid());
- if (flags & DryRun)
- args << "--dry-run";
- if (flags & RestartOnFinish)
- {
- args << "--finish-cmd" << finishCmd;
- args << "--finish-dir" << dataPath;
- }
- qDebug() << "Running updater with command" << updaterBinary << args.join(" ");
- QFile::setPermissions(updaterBinary, (QFileDevice::Permission)0x7755);
-
- if (!QProcess::startDetached(updaterBinary, args /*, root()*/))
- {
- qCritical() << "Failed to start the updater process!";
- return;
- }
-
- ENV.destroy();
- // Now that we've started the updater, quit MultiMC.
- quit();
+ args << "--finish-cmd" << finishCmd;
+ args << "--finish-dir" << dataPath;
+ qDebug() << "Running updater with args" << args.join(" ");
}
void MultiMC::setIconTheme(const QString& name)
@@ -657,10 +623,6 @@ void MultiMC::onExit()
{
m_instances->saveGroupList();
}
- if (m_updateOnExitPath.size())
- {
- installUpdates(m_updateOnExitPath, m_updateOnExitFlags);
- }
ENV.destroy();
if(logFile)
{
diff --git a/application/MultiMC.h b/application/MultiMC.h
index e4a54115..f815b8e4 100644
--- a/application/MultiMC.h
+++ b/application/MultiMC.h
@@ -29,16 +29,6 @@ class TranslationDownloader;
#endif
#define MMC (static_cast<MultiMC *>(QCoreApplication::instance()))
-enum UpdateFlag
-{
- None = 0x0,
- RestartOnFinish = 0x1,
- DryRun = 0x2,
- OnExit = 0x4
-};
-Q_DECLARE_FLAGS(UpdateFlags, UpdateFlag);
-Q_DECLARE_OPERATORS_FOR_FLAGS(UpdateFlags);
-
class MultiMC : public QApplication
{
// friends for the purpose of limiting access to deprecated stuff
@@ -115,7 +105,7 @@ public:
}
// APPLICATION ONLY
- void installUpdates(const QString updateFilesDir, UpdateFlags flags = None);
+ void installUpdates(const QString updateFilesDir);
/*!
* Opens a json file using either a system default editor, or, if note empty, the editor
@@ -173,9 +163,6 @@ private:
QMap<QString, std::shared_ptr<BaseProfilerFactory>> m_profilers;
QMap<QString, std::shared_ptr<BaseDetachedToolFactory>> m_tools;
- QString m_updateOnExitPath;
- UpdateFlags m_updateOnExitFlags = None;
-
QString rootPath;
QString staticDataPath;
QString dataPath;
diff --git a/application/dialogs/UpdateDialog.cpp b/application/dialogs/UpdateDialog.cpp
index d8f5d8ac..4240e3d5 100644
--- a/application/dialogs/UpdateDialog.cpp
+++ b/application/dialogs/UpdateDialog.cpp
@@ -21,7 +21,6 @@ UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), u
{
ui->label->setText(tr("No %1 updates found. You are running the latest version.").arg(channel));
ui->btnUpdateNow->setDisabled(true);
- ui->btnUpdateOnExit->setDisabled(true);
}
loadChangelog();
}
@@ -129,8 +128,3 @@ void UpdateDialog::on_btnUpdateNow_clicked()
{
done(UPDATE_NOW);
}
-
-void UpdateDialog::on_btnUpdateOnExit_clicked()
-{
- done(UPDATE_ONEXIT);
-}
diff --git a/application/dialogs/UpdateDialog.h b/application/dialogs/UpdateDialog.h
index b92c7473..5237df5c 100644
--- a/application/dialogs/UpdateDialog.h
+++ b/application/dialogs/UpdateDialog.h
@@ -28,7 +28,6 @@ enum UpdateAction
{
UPDATE_LATER = QDialog::Rejected,
UPDATE_NOW = QDialog::Accepted,
- UPDATE_ONEXIT = 2
};
class UpdateDialog : public QDialog
@@ -43,7 +42,6 @@ private:
Ui::UpdateDialog *ui;
public slots:
void on_btnUpdateNow_clicked();
- void on_btnUpdateOnExit_clicked();
void on_btnUpdateLater_clicked();
/// Starts loading the changelog
diff --git a/application/dialogs/UpdateDialog.ui b/application/dialogs/UpdateDialog.ui
index 06f4f086..cbe1ef74 100644
--- a/application/dialogs/UpdateDialog.ui
+++ b/application/dialogs/UpdateDialog.ui
@@ -46,8 +46,8 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Bitstream Vera Sans'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:22pt;&quot;&gt;Loading changelog...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Oxygen-Sans'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Bitstream Vera Sans'; font-size:22pt;&quot;&gt;Loading changelog...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
@@ -70,13 +70,6 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item>
- <widget class="QPushButton" name="btnUpdateOnExit">
- <property name="text">
- <string>Update after MultiMC closes</string>
- </property>
- </widget>
- </item>
- <item>
<widget class="QPushButton" name="btnUpdateLater">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -96,7 +89,6 @@ p, li { white-space: pre-wrap; }
<tabstops>
<tabstop>changelogBrowser</tabstop>
<tabstop>btnUpdateNow</tabstop>
- <tabstop>btnUpdateOnExit</tabstop>
<tabstop>btnUpdateLater</tabstop>
</tabstops>
<resources>