Merge with develop

This commit is contained in:
kervala 2016-06-12 15:44:48 +02:00
parent 8f9d7078bd
commit 3ae8a19af1
33 changed files with 304 additions and 187 deletions

View file

@ -8,17 +8,7 @@ SET(RZ_SERVER_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/server/src)
ADD_SUBDIRECTORY(common)
ADD_SUBDIRECTORY(tools)
IF(WITH_RYZOM_CLIENT)
IF(NOT WITH_GUI)
MESSAGE( FATAL_ERROR "The client cannot be built without the NeL GUI Library (WITH_GUI)")
ENDIF()
ADD_SUBDIRECTORY(client)
ELSEIF(WITH_RYZOM_TOOLS)
# Need clientsheets lib for sheets packer tool
ADD_SUBDIRECTORY(client)
ENDIF()
IF(WITH_RYZOM_SERVER OR WITH_RYZOM_TOOLS)
# Need servershare for build packed collision tool

View file

@ -1,4 +1,5 @@
# Need clientsheets lib for sheets packer tool
# Need seven_zip for patch_gen and ryzom_installer
ADD_SUBDIRECTORY(src)
IF(WITH_RYZOM_CLIENT)

View file

@ -1,10 +1,18 @@
IF(WITH_RYZOM_TOOLS OR WITH_RYZOM_CLIENT)
# Need clientsheets lib for sheets packer tool
ADD_SUBDIRECTORY(client_sheets)
ENDIF()
IF(WITH_RYZOM_TOOLS OR WITH_RYZOM_CLIENT OR WITH_RYZOM_INSTALLER)
# Need seven_zip lib for patch_gen tool
ADD_SUBDIRECTORY(seven_zip)
ENDIF()
IF(WITH_RYZOM_CLIENT)
IF(NOT WITH_GUI)
MESSAGE(FATAL_ERROR "The client cannot be built without the NeL GUI Library (WITH_GUI)")
ENDIF()
# Patch should never be enabled on Steam
IF(WITH_RYZOM_STEAM)
ADD_DEFINITIONS(-DRZ_USE_STEAM)

View file

@ -6,13 +6,13 @@ IF(WITH_RYZOM_CLIENT)
IF(WITH_QT OR WITH_QT5)
ADD_SUBDIRECTORY(client_config_qt)
ENDIF()
IF(WITH_RYZOM_INSTALLER)
ENDIF()
IF(WITH_QT5 AND WITH_RYZOM_INSTALLER)
ADD_SUBDIRECTORY(ryzom_installer)
ENDIF()
ENDIF()
ENDIF()
IF(WITH_RYZOM_TOOLS)
ADD_SUBDIRECTORY(r2_islands_textures)

View file

@ -258,6 +258,11 @@ const CServer& CConfigFile::getServer(const QString &id) const
return getServer();
}
void CConfigFile::backupProfiles()
{
m_backupProfiles = m_profiles;
}
int CConfigFile::getProfilesCount() const
{
return m_profiles.size();
@ -497,6 +502,8 @@ bool CConfigFile::isRyzomInstalledIn(const QString &directory) const
bool CConfigFile::areRyzomDataInstalledIn(const QString &directory) const
{
if (directory.isEmpty()) return false;
QDir dir(directory);
// directory doesn't exist
@ -523,6 +530,8 @@ bool CConfigFile::areRyzomDataInstalledIn(const QString &directory) const
bool CConfigFile::isRyzomClientInstalledIn(const QString &directory) const
{
if (directory.isEmpty()) return false;
QDir dir(directory);
// directory doesn't exist
@ -552,6 +561,8 @@ bool CConfigFile::isRyzomClientInstalledIn(const QString &directory) const
bool CConfigFile::foundTemporaryFiles(const QString &directory) const
{
if (directory.isEmpty()) return false;
QDir dir(directory);
// directory doesn't exist

View file

@ -118,6 +118,9 @@ public:
CProfiles getProfiles() const { return m_profiles; }
void setProfiles(const CProfiles &profiles) { m_profiles = profiles; }
CProfiles getBackupProfiles() const { return m_backupProfiles; }
void backupProfiles();
int getProfilesCount() const;
CProfile getProfile(int i = -1) const;
void setProfile(int i, const CProfile &profile);
@ -193,6 +196,7 @@ private:
CServers m_servers;
CProfiles m_profiles;
CProfiles m_backupProfiles;
QString m_installationDirectory;
QString m_srcDirectory;

View file

@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "operation.h"
#include "downloader.h"
#include "nel/misc/system_info.h"
@ -24,9 +25,9 @@
#define new DEBUG_NEW
#endif
CDownloader::CDownloader(QObject *parent):QObject(parent), m_manager(NULL), m_reply(NULL), m_timer(NULL),
CDownloader::CDownloader(QObject *parent, IOperationProgressListener *listener):QObject(parent), m_listener(listener), m_manager(NULL), m_reply(NULL), m_timer(NULL),
m_offset(0), m_size(0), m_supportsAcceptRanges(false), m_supportsContentRange(false),
m_downloadAfterHead(false), m_aborted(false), m_file(NULL)
m_downloadAfterHead(false), m_file(NULL)
{
m_manager = new QNetworkAccessManager(this);
m_timer = new QTimer(this);
@ -60,7 +61,7 @@ bool CDownloader::prepareFile(const QString &url, const QString &fullPath)
m_downloadAfterHead = false;
emit downloadPrepare();
if (m_listener) m_listener->operationPrepare();
m_fullPath = fullPath;
m_url = url;
@ -86,15 +87,6 @@ bool CDownloader::getFile()
return true;
}
bool CDownloader::stop()
{
if (!m_reply) return false;
m_reply->abort();
return true;
}
void CDownloader::startTimer()
{
stopTimer();
@ -154,12 +146,12 @@ void CDownloader::getFileHead()
if (checkDownloadedFile())
{
// file is already downloaded
emit downloadSuccess(m_size);
if (m_listener) m_listener->operationSuccess(m_size);
}
else
{
// or has wrong size
emit downloadFail(tr("File (%1B) is larger than expected (%2B)").arg(m_offset).arg(m_size));
if (m_listener) m_listener->operationFail(tr("File (%1B) is larger than expected (%2B)").arg(m_offset).arg(m_size));
}
return;
@ -189,13 +181,13 @@ void CDownloader::downloadFile()
if (freeSpace < m_size - m_offset)
{
// we have not enough free disk space to continue download
emit downloadFail(tr("You only have %1 bytes left on device, but %2 bytes are required.").arg(freeSpace).arg(m_size - m_offset));
if (m_listener) m_listener->operationFail(tr("You only have %1 bytes left on device, but %2 bytes are required.").arg(freeSpace).arg(m_size - m_offset));
return;
}
if (!openFile())
{
emit downloadFail(tr("Unable to write file"));
if (m_listener) m_listener->operationFail(tr("Unable to write file"));
return;
}
@ -214,7 +206,7 @@ void CDownloader::downloadFile()
connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), SLOT(onDownloadProgress(qint64, qint64)));
connect(m_reply, SIGNAL(readyRead()), SLOT(onDownloadRead()));
emit downloadStart();
if (m_listener) m_listener->operationStart();
startTimer();
}
@ -230,7 +222,7 @@ void CDownloader::onTimeout()
{
qDebug() << "Timeout";
emit downloadFail(tr("Timeout"));
if (m_listener) m_listener->operationFail(tr("Timeout"));
}
void CDownloader::onHtmlPageFinished()
@ -267,7 +259,7 @@ void CDownloader::onHeadFinished()
{
if (redirection.isEmpty())
{
emit downloadFail(tr("Redirection URL is not defined"));
if (m_listener) m_listener->operationFail(tr("Redirection URL is not defined"));
return;
}
@ -289,7 +281,7 @@ void CDownloader::onHeadFinished()
else if (status == 200)
{
// update size
emit downloadInit(0, m_size);
if (m_listener) m_listener->operationInit(0, m_size);
if (!m_supportsAcceptRanges && acceptRanges == "bytes")
{
@ -321,7 +313,7 @@ void CDownloader::onHeadFinished()
m_size = regexp.cap(3).toLongLong();
// update offset and size
emit downloadInit(m_offset, m_size);
if (m_listener) m_listener->operationInit(m_offset, m_size);
}
else
{
@ -332,7 +324,7 @@ void CDownloader::onHeadFinished()
// other status
else
{
emit downloadFail(tr("Wrong status code: %1").arg(status));
if (m_listener) m_listener->operationFail(tr("Wrong status code: %1").arg(status));
return;
}
@ -356,28 +348,29 @@ void CDownloader::onDownloadFinished()
closeFile();
if (m_aborted)
if (m_listener && m_listener->operationShouldStop())
{
m_aborted = false;
emit downloadStop();
m_listener->operationStop();
}
else
{
bool ok = NLMISC::CFile::setFileModificationDate(m_fullPath.toUtf8().constData(), m_lastModified.toTime_t());
emit downloadSuccess(m_size);
if (m_listener) m_listener->operationSuccess(m_size);
}
}
void CDownloader::onError(QNetworkReply::NetworkError error)
{
if (!m_listener) return;
if (error == QNetworkReply::OperationCanceledError)
{
m_aborted = true;
m_listener->operationStop();
}
else
{
emit downloadFail(tr("Network error: %1").arg(error));
m_listener->operationFail(tr("Network error: %1").arg(error));
}
}
@ -385,7 +378,12 @@ void CDownloader::onDownloadProgress(qint64 current, qint64 total)
{
stopTimer();
emit downloadProgress(m_offset + current);
if (!m_listener) return;
m_listener->operationProgress(m_offset + current, ""); // TODO: put file
// abort download
if (m_listener->operationShouldStop() && m_reply) m_reply->abort();
}
void CDownloader::onDownloadRead()

View file

@ -17,6 +17,8 @@
#ifndef DOWNLOADER_H
#define DOWNLOADER_H
class IOperationProgressListener;
/**
* Files downloader, please note that only one file can be downloaded at once.
*
@ -28,41 +30,19 @@ class CDownloader : public QObject
Q_OBJECT
public:
CDownloader(QObject *parent);
CDownloader(QObject *parent, IOperationProgressListener *listener);
virtual ~CDownloader();
bool getHtmlPageContent(const QString &url);
bool prepareFile(const QString &url, const QString &fullPath);
bool getFile();
bool stop();
bool supportsResume() const { return m_supportsAcceptRanges && m_supportsContentRange; }
bool isDownloading() const { return m_file != NULL; }
signals:
// emitted when requesting real URL
void downloadPrepare();
// emitted when we got the initial (local) and total (remote) size of file
void downloadInit(qint64 current, qint64 total);
// emitted when we begin to download
void downloadStart();
// emitted when the download stopped
void downloadStop();
// emittd when downloading
void downloadProgress(qint64 current);
// emitted when the whole file is downloaded
void downloadSuccess(qint64 total);
// emitted when an error occurs
void downloadFail(const QString &error);
void htmlPageContent(const QString &html);
private slots:
@ -75,6 +55,8 @@ private slots:
void onDownloadRead();
protected:
IOperationProgressListener *m_listener;
void startTimer();
void stopTimer();
@ -102,7 +84,6 @@ protected:
bool m_supportsContentRange;
bool m_downloadAfterHead;
bool m_aborted;
QFile *m_file;
};

View file

@ -52,6 +52,8 @@ void CFilesCleaner::setDirectory(const QString &src)
bool CFilesCleaner::exec()
{
if (m_directory.isEmpty()) return false;
if (m_listener) m_listener->operationPrepare();
QDir dir(m_directory);

View file

@ -110,6 +110,7 @@ void CFilesCopier::getFilesList(FilesToCopy &files)
file.dst = dstPath;
file.size = it.fileInfo().size();
file.date = it.fileInfo().lastModified().toTime_t();
file.permissions = it.fileInfo().permissions();
files << file;
}

View file

@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "installwizarddialog.h"
#include "installdialog.h"
#include "configfile.h"
#include "utils.h"
@ -26,7 +26,7 @@
#define new DEBUG_NEW
#endif
CInstallWizardDialog::CInstallWizardDialog():QDialog()
CInstallDialog::CInstallDialog():QDialog()
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
@ -82,18 +82,18 @@ CInstallWizardDialog::CInstallWizardDialog():QDialog()
connect(advancedCheckBox, SIGNAL(stateChanged(int)), SLOT(onShowAdvancedParameters(int)));
}
CInstallWizardDialog::~CInstallWizardDialog()
CInstallDialog::~CInstallDialog()
{
}
void CInstallWizardDialog::onShowAdvancedParameters(int state)
void CInstallDialog::onShowAdvancedParameters(int state)
{
advancedFrame->setVisible(state != Qt::Unchecked);
adjustSize();
}
void CInstallWizardDialog::onAnotherLocationBrowseButtonClicked()
void CInstallDialog::onAnotherLocationBrowseButtonClicked()
{
QString directory;
@ -116,7 +116,7 @@ void CInstallWizardDialog::onAnotherLocationBrowseButtonClicked()
updateAnotherLocationText();
}
void CInstallWizardDialog::onDestinationBrowseButtonClicked()
void CInstallDialog::onDestinationBrowseButtonClicked()
{
QString directory = QFileDialog::getExistingDirectory(this, tr("Please choose directory where to install Ryzom"));
@ -127,17 +127,17 @@ void CInstallWizardDialog::onDestinationBrowseButtonClicked()
updateDestinationText();
}
void CInstallWizardDialog::updateAnotherLocationText()
void CInstallDialog::updateAnotherLocationText()
{
anotherLocationRadioButton->setText(tr("Another location: %1").arg(m_anotherDirectory.isEmpty() ? tr("Undefined"):m_anotherDirectory));
}
void CInstallWizardDialog::updateDestinationText()
void CInstallDialog::updateDestinationText()
{
destinationLabel->setText(m_dstDirectory);
}
void CInstallWizardDialog::accept()
void CInstallDialog::accept()
{
// check free disk space
qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData());

View file

@ -14,10 +14,10 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef INSTALLWIZARDDIALOG_H
#define INSTALLWIZARDDIALOG_H
#ifndef INSTALLDIALOG_H
#define INSTALLDIALOG_H
#include "ui_installwizard.h"
#include "ui_installdialog.h"
/**
* Wizard displayed at first launch, that asks user to choose source and destination directories.
@ -25,13 +25,13 @@
* \author Cedric 'Kervala' OCHS
* \date 2016
*/
class CInstallWizardDialog : public QDialog, public Ui::InstallWizardDialog
class CInstallDialog : public QDialog, public Ui::InstallDialog
{
Q_OBJECT
public:
CInstallWizardDialog();
virtual ~CInstallWizardDialog();
CInstallDialog();
virtual ~CInstallDialog();
private slots:
void onShowAdvancedParameters(int state);

View file

@ -17,9 +17,9 @@
#include "stdpch.h"
#include "mainwindow.h"
#include "configfile.h"
#include "migratewizarddialog.h"
#include "installwizarddialog.h"
#include "uninstallwizarddialog.h"
#include "migratedialog.h"
#include "installdialog.h"
#include "uninstalldialog.h"
#include "operationdialog.h"
#ifdef HAVE_CONFIG_H
@ -120,7 +120,7 @@ int main(int argc, char *argv[])
// show uninstall wizard dialog if not in silent mode
if (!parser.isSet(silentOption))
{
CUninstallWizardDialog dialog;
CUninstallDialog dialog;
dialog.setSelectedComponents(components);
@ -142,7 +142,7 @@ int main(int argc, char *argv[])
if (step == CConfigFile::ShowMigrateWizard)
{
CMigrateWizardDialog dialog;
CMigrateDialog dialog;
if (!dialog.exec()) return 1;
@ -150,7 +150,7 @@ int main(int argc, char *argv[])
}
else if (step == CConfigFile::ShowInstallWizard)
{
CInstallWizardDialog dialog;
CInstallDialog dialog;
if (!dialog.exec()) return 1;

View file

@ -18,7 +18,8 @@
#include "mainwindow.h"
#include "downloader.h"
#include "profilesdialog.h"
#include "uninstallwizarddialog.h"
#include "settingsdialog.h"
#include "uninstalldialog.h"
#include "operationdialog.h"
#include "configfile.h"
#include "config.h"
@ -35,11 +36,12 @@ CMainWindow::CMainWindow():QMainWindow()
setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint);
// downloader
m_downloader = new CDownloader(this);
m_downloader = new CDownloader(this, NULL);
connect(m_downloader, SIGNAL(htmlPageContent(QString)), SLOT(onHtmlPageContent(QString)));
connect(actionProfiles, SIGNAL(triggered()), SLOT(onProfiles()));
connect(actionSettings, SIGNAL(triggered()), SLOT(onSettings()));
connect(actionUninstall, SIGNAL(triggered()), SLOT(onUninstall()));
connect(actionQuit, SIGNAL(triggered()), SLOT(onQuit()));
@ -51,6 +53,12 @@ CMainWindow::CMainWindow():QMainWindow()
connect(profilesComboBox, SIGNAL(currentIndexChanged(int)), SLOT(onProfileChanged(int)));
// resize layout depending on content and constraints
adjustSize();
// fix height because to left bitmap
setFixedHeight(height());
updateProfiles();
}
@ -85,17 +93,21 @@ void CMainWindow::onPlayClicked()
const CProfile &profile = config->getProfile(profileIndex);
// get full path of client executable
QString executable = config->getProfileClientFullPath(profileIndex);
if (executable.isEmpty() || !QFile::exists(executable)) return;
// create arguments list
QStringList arguments;
arguments << "-p";
arguments << profile.id;
arguments << profile.arguments.split(' ');
// launch the game with all arguments
bool started = QProcess::startDetached(executable, arguments);
// define this profile as default one
CConfigFile::getInstance()->setDefaultProfileIndex(profileIndex);
}
@ -123,12 +135,56 @@ void CMainWindow::onConfigureClicked()
}
void CMainWindow::onProfiles()
{
bool updated = false;
{
CProfilesDialog dialog(this);
if (dialog.exec())
{
updateProfiles();
updated = true;
}
}
if (updated)
{
COperationDialog dialog(this);
dialog.setOperation(COperationDialog::OperationUpdateProfiles);
if (!dialog.exec())
{
// aborted
}
}
}
void CMainWindow::onSettings()
{
bool updated = false;
{
CSettingsDialog dialog(this);
if (dialog.exec())
{
updated = true;
}
}
if (updated)
{
// COperationDialog dialog(this);
// dialog.setOperation(COperationDialog::OperationUpdateProfiles);
// if (!dialog.exec())
// {
// aborted
// }
}
}
@ -145,7 +201,7 @@ void CMainWindow::onUninstall()
}
{
CUninstallWizardDialog dialog(this);
CUninstallDialog dialog(this);
dialog.setSelectedComponents(components);
@ -176,9 +232,9 @@ void CMainWindow::onAbout()
QMessageBox::about(this,
tr("About %1").arg("Ryzom Installer"),
QString("Ryzom Installer %1").arg(QApplication::applicationVersion()) + br +
tr("Program to install, download and manage Ryzom configurations.") +
tr("Program to install, download and manage Ryzom profiles.") +
br+br+
tr("Author: %1").arg("Cedric 'Kervala' OCHS") + br +
tr("Author: %1").arg("C&eacute;dric 'Kervala' OCHS") + br +
tr("Copyright: %1").arg(COPYRIGHT) + br +
tr("Support: %1").arg("<a href=\"https://bitbucket.org/ryzom/ryzomcore/issues?status=new&status=open\">Ryzom Core on Bitbucket</a>"));
}

View file

@ -38,13 +38,17 @@ public:
virtual ~CMainWindow();
public slots:
// main window buttons
void onPlayClicked();
void onConfigureClicked();
// settings menu
void onProfiles();
void onSettings();
void onUninstall();
void onQuit();
// help menu
void onAbout();
void onAboutQt();

View file

@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "migratewizarddialog.h"
#include "migratedialog.h"
#include "configfile.h"
#include "utils.h"
@ -26,7 +26,7 @@
#define new DEBUG_NEW
#endif
CMigrateWizardDialog::CMigrateWizardDialog():QDialog()
CMigrateDialog::CMigrateDialog():QDialog()
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
@ -79,18 +79,18 @@ CMigrateWizardDialog::CMigrateWizardDialog():QDialog()
connect(advancedCheckBox, SIGNAL(stateChanged(int)), SLOT(onShowAdvancedParameters(int)));
}
CMigrateWizardDialog::~CMigrateWizardDialog()
CMigrateDialog::~CMigrateDialog()
{
}
void CMigrateWizardDialog::onShowAdvancedParameters(int state)
void CMigrateDialog::onShowAdvancedParameters(int state)
{
advancedFrame->setVisible(state != Qt::Unchecked);
adjustSize();
}
void CMigrateWizardDialog::onDestinationBrowseButtonClicked()
void CMigrateDialog::onDestinationBrowseButtonClicked()
{
QString directory = QFileDialog::getExistingDirectory(this, tr("Please choose directory where to install Ryzom"));
@ -101,12 +101,12 @@ void CMigrateWizardDialog::onDestinationBrowseButtonClicked()
updateDestinationText();
}
void CMigrateWizardDialog::updateDestinationText()
void CMigrateDialog::updateDestinationText()
{
destinationLabel->setText(m_dstDirectory);
}
void CMigrateWizardDialog::accept()
void CMigrateDialog::accept()
{
// check free disk space
qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData());

View file

@ -14,10 +14,10 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef MIGRATEWIZARDDIALOG_H
#define MIGRATEWIZARDDIALOG_H
#ifndef MIGRATEDIALOG_H
#define MIGRATEDIALOG_H
#include "ui_migratewizard.h"
#include "ui_migratedialog.h"
/**
* Wizard displayed at first launch, that asks user to choose source and destination directories.
@ -25,13 +25,13 @@
* \author Cedric 'Kervala' OCHS
* \date 2016
*/
class CMigrateWizardDialog : public QDialog, public Ui::MigrateWizardDialog
class CMigrateDialog : public QDialog, public Ui::MigrateDialog
{
Q_OBJECT
public:
CMigrateWizardDialog();
virtual ~CMigrateWizardDialog();
CMigrateDialog();
virtual ~CMigrateDialog();
private slots:
void onShowAdvancedParameters(int state);

View file

@ -55,15 +55,7 @@ COperationDialog::COperationDialog(QWidget *parent):QDialog(parent), m_aborting(
// connect(stopButton, SIGNAL(clicked()), SLOT(onStopClicked()));
// downloader
m_downloader = new CDownloader(this);
connect(m_downloader, SIGNAL(downloadPrepare()), SLOT(onProgressPrepare()));
connect(m_downloader, SIGNAL(downloadInit(qint64, qint64)), SLOT(onProgressInit(qint64, qint64)));
connect(m_downloader, SIGNAL(downloadStart()), SLOT(onProgressStart()));
connect(m_downloader, SIGNAL(downloadStop()), SLOT(onProgressStop()));
connect(m_downloader, SIGNAL(downloadProgress(qint64, QString)), SLOT(onProgressProgress(qint64, QString)));
connect(m_downloader, SIGNAL(downloadSuccess(qint64)), SLOT(onProgressSuccess(qint64)));
connect(m_downloader, SIGNAL(downloadFail(QString)), SLOT(onProgressFail(QString)));
m_downloader = new CDownloader(this, this);
connect(operationButtonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(onAbortClicked()));
@ -102,6 +94,10 @@ void COperationDialog::processNextStep()
processMigrateNextStep();
break;
case OperationUpdateProfiles:
processUpdateProfilesNextStep();
break;
case OperationInstall:
processInstallNextStep();
break;
@ -201,8 +197,16 @@ void COperationDialog::processMigrateNextStep()
}
}
void COperationDialog::processUpdateProfilesNextStep()
{
// TODO: check all servers are downloaded
// TODO: delete profiles directories that are not used anymore
// TODO: create shortcuts
}
void COperationDialog::processInstallNextStep()
{
// TODO: implement
}
void COperationDialog::processUninstallNextStep()
@ -466,6 +470,21 @@ void COperationDialog::extractBnpClient()
env.insert("STARTUPPATH", "");
process.setProcessEnvironment(env);
// permissions to execute script
QFileDevice::Permissions permissions;
permissions |= QFileDevice::ExeOther;
permissions |= QFileDevice::ExeOwner;
permissions |= QFileDevice::ExeUser;
permissions |= QFileDevice::ReadOther;
permissions |= QFileDevice::ReadOwner;
permissions |= QFileDevice::ReadUser;
permissions |= QFileDevice::WriteOwner;
if (!QFile::setPermissions(upgradeScript, permissions))
{
qDebug() << "Unable to set executable flag to" << upgradeScript;
}
process.start(upgradeScript);
while (process.waitForFinished())

View file

@ -42,6 +42,7 @@ public:
{
OperationNone,
OperationMigrate,
OperationUpdateProfiles,
OperationInstall,
OperationUninstall
};
@ -92,6 +93,7 @@ protected:
void processNextStep();
void processMigrateNextStep();
void processUpdateProfilesNextStep();
void processInstallNextStep();
void processUninstallNextStep();

View file

@ -17,7 +17,7 @@
#ifndef PROFILESDIALOG_H
#define PROFILESDIALOG_H
#include "ui_profiles.h"
#include "ui_profilesdialog.h"
class CProfilesModel;
class CServersModel;

View file

@ -57,6 +57,7 @@ bool CProfilesModel::removeRows(int row, int count, const QModelIndex &parent)
bool CProfilesModel::save() const
{
CConfigFile::getInstance()->backupProfiles();
CConfigFile::getInstance()->setProfiles(m_profiles);
CConfigFile::getInstance()->save();

View file

@ -16,14 +16,31 @@
#include "stdpch.h"
#include "settingsdialog.h"
#include "configfile.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
CSettingsDialog::CSettingsDialog():QDialog()
CSettingsDialog::CSettingsDialog(QWidget *parent):QDialog(parent)
{
setupUi(this);
CConfigFile *config = CConfigFile::getInstance();
// only 64 bits OS can switch between 32 and 64 bits
use64bitsClientsCheckBox->setEnabled(config->has64bitsOS());
// read value from config
use64bitsClientsCheckBox->setChecked(config->use64BitsClient());
connect(installationDirectoryButton, SIGNAL(clicked()), SLOT(onInstallationDirectoryButtonClicked()));
// resize layout depending on content and constraints
adjustSize();
// fix height because to left bitmap
setFixedHeight(height());
}
CSettingsDialog::~CSettingsDialog()
@ -36,3 +53,14 @@ void CSettingsDialog::accept()
QDialog::accept();
}
void CSettingsDialog::onInstallationDirectoryButtonClicked()
{
QString directory = QFileDialog::getExistingDirectory(this, tr("Please choose directory where to install Ryzom"));
if (directory.isEmpty()) return;
// m_dstDirectory = directory;
// updateDestinationText();
}

View file

@ -17,7 +17,7 @@
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#include "ui_settings.h"
#include "ui_settingsdialog.h"
/**
* Settings dialog
@ -30,9 +30,12 @@ class CSettingsDialog : public QDialog, public Ui::SettingsDialog
Q_OBJECT
public:
CSettingsDialog();
CSettingsDialog(QWidget *parent = NULL);
virtual ~CSettingsDialog();
public slots:
void onInstallationDirectoryButtonClicked();
private slots:
void accept();
};

View file

@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "uninstallwizarddialog.h"
#include "uninstalldialog.h"
#include "configfile.h"
#include "utils.h"
@ -26,7 +26,7 @@
#define new DEBUG_NEW
#endif
CUninstallWizardDialog::CUninstallWizardDialog(QWidget *parent):QDialog(parent), m_installerIndex(-1)
CUninstallDialog::CUninstallDialog(QWidget *parent):QDialog(parent), m_installerIndex(-1)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
@ -76,6 +76,7 @@ CUninstallWizardDialog::CUninstallWizardDialog(QWidget *parent):QDialog(parent),
}
// installer
m_installerIndex = model->rowCount();
item = new QStandardItem(tr("Ryzom Installer"));
@ -85,11 +86,15 @@ CUninstallWizardDialog::CUninstallWizardDialog(QWidget *parent):QDialog(parent),
componentsTreeView->setModel(model);
componentsTreeView->resizeColumnToContents(0);
// resize layout depending on content and constraints
adjustSize();
// fix height because to left bitmap
setFixedHeight(height());
// click signals
connect(uninstallButton, SIGNAL(clicked()), SLOT(accept()));
connect(quitButton, SIGNAL(clicked()), SLOT(reject()));
connect(cancelButton, SIGNAL(clicked()), SLOT(reject()));
connect(model, SIGNAL(itemChanged(QStandardItem *)), SLOT(onItemChanged(QStandardItem *)));
// semi-hack to not update UI on another thread
@ -97,18 +102,19 @@ CUninstallWizardDialog::CUninstallWizardDialog(QWidget *parent):QDialog(parent),
connect(this, SIGNAL(updateLayout()), SLOT(onUpdateLayout()));
}
CUninstallWizardDialog::~CUninstallWizardDialog()
CUninstallDialog::~CUninstallDialog()
{
}
void CUninstallWizardDialog::showEvent(QShowEvent *event)
void CUninstallDialog::showEvent(QShowEvent *event)
{
QDialog::showEvent(event);
QtConcurrent::run(this, &CUninstallWizardDialog::updateSizes);
// update size of all components sizes in a thread to not block interface
QtConcurrent::run(this, &CUninstallDialog::updateSizes);
}
void CUninstallWizardDialog::setSelectedComponents(const SUninstallComponents &components)
void CUninstallDialog::setSelectedComponents(const SUninstallComponents &components)
{
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(componentsTreeView->model());
if (model == NULL) return;
@ -144,7 +150,7 @@ void CUninstallWizardDialog::setSelectedComponents(const SUninstallComponents &c
if (item) item->setCheckState(components.installer ? Qt::Checked : Qt::Unchecked);
}
SUninstallComponents CUninstallWizardDialog::getSelectedCompenents() const
SUninstallComponents CUninstallDialog::getSelectedCompenents() const
{
SUninstallComponents res;
@ -184,35 +190,34 @@ SUninstallComponents CUninstallWizardDialog::getSelectedCompenents() const
return res;
}
void CUninstallWizardDialog::accept()
void CUninstallDialog::accept()
{
QDialog::accept();
}
void CUninstallWizardDialog::onItemChanged(QStandardItem * /* item */)
void CUninstallDialog::onItemChanged(QStandardItem * /* item */)
{
updateButtons();
}
void CUninstallWizardDialog::onUpdateSize(int row, const QString &text)
void CUninstallDialog::onUpdateSize(int row, const QString &text)
{
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(componentsTreeView->model());
if (model == NULL) return;
// set size for a component
QStandardItem *item = new QStandardItem(text);
model->setItem(row, 1, item);
}
void CUninstallWizardDialog::onUpdateLayout()
void CUninstallDialog::onUpdateLayout()
{
componentsTreeView->resizeColumnToContents(1);
updateButtons();
adjustSize();
}
void CUninstallWizardDialog::updateSizes()
void CUninstallDialog::updateSizes()
{
CConfigFile *config = CConfigFile::getInstance();
@ -247,17 +252,18 @@ void CUninstallWizardDialog::updateSizes()
emit updateLayout();
}
void CUninstallWizardDialog::updateButtons()
void CUninstallDialog::updateButtons()
{
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(componentsTreeView->model());
if (model == NULL) return;
int checkedCount = 0;
// Uninstall button should be enabled only if at least one component is selected
for (int i = 0; i < model->rowCount(); ++i)
{
if (model->item(i)->checkState() == Qt::Checked) ++checkedCount;
}
// Uninstall button should be enabled only if at least one component is checked
uninstallButton->setEnabled(checkedCount > 0);
}

View file

@ -14,25 +14,26 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef UNINSTALLWIZARDDIALOG_H
#define UNINSTALLWIZARDDIALOG_H
#ifndef UNINSTALLDIALOG_H
#define UNINSTALLDIALOG_H
#include "ui_uninstallwizard.h"
#include "ui_uninstalldialog.h"
#include "operation.h"
/**
* Wizard displayed at first launch, that asks user to choose source and destination directories.
* Wizard displayed when uninstalling components from Add/Remove Program under Windows
* or when user clicks on Uninstall in main menu.
*
* \author Cedric 'Kervala' OCHS
* \date 2016
*/
class CUninstallWizardDialog : public QDialog, public Ui::UninstallWizardDialog
class CUninstallDialog : public QDialog, public Ui::UninstallDialog
{
Q_OBJECT
public:
CUninstallWizardDialog(QWidget *parent = NULL);
virtual ~CUninstallWizardDialog();
CUninstallDialog(QWidget *parent = NULL);
virtual ~CUninstallDialog();
void setSelectedComponents(const SUninstallComponents &components);
SUninstallComponents getSelectedCompenents() const;

View file

@ -37,6 +37,9 @@ QString qBytesToHumanReadable(qint64 bytes)
qint64 getDirectorySize(const QString &directory)
{
qint64 size = 0;
if (!directory.isEmpty())
{
QDir dir(directory);
if (dir.exists())
@ -57,6 +60,7 @@ qint64 getDirectorySize(const QString &directory)
}
}
}
}
return size;
}

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InstallWizardDialog</class>
<widget class="QDialog" name="InstallWizardDialog">
<class>InstallDialog</class>
<widget class="QDialog" name="InstallDialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
@ -219,7 +219,7 @@ Just follow the different steps and make your choice between the different propo
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>InstallWizardDialog</receiver>
<receiver>InstallDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@ -235,7 +235,7 @@ Just follow the different steps and make your choice between the different propo
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>InstallWizardDialog</receiver>
<receiver>InstallDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>547</width>
<width>596</width>
<height>386</height>
</rect>
</property>
@ -22,12 +22,6 @@
<height>386</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>547</width>
<height>386</height>
</size>
</property>
<property name="windowTitle">
<string>Ryzom Installer</string>
</property>
@ -115,7 +109,7 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>547</width>
<width>596</width>
<height>21</height>
</rect>
</property>
@ -124,7 +118,7 @@ p, li { white-space: pre-wrap; }
<string>&amp;Settings</string>
</property>
<addaction name="actionProfiles"/>
<addaction name="actionDirectories"/>
<addaction name="actionSettings"/>
<addaction name="actionUninstall"/>
<addaction name="separator"/>
<addaction name="actionQuit"/>
@ -154,9 +148,9 @@ p, li { white-space: pre-wrap; }
<string>&amp;Profiles</string>
</property>
</action>
<action name="actionDirectories">
<action name="actionSettings">
<property name="text">
<string>&amp;Directories</string>
<string>&amp;Settings</string>
</property>
</action>
<action name="actionQuit">

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MigrateWizardDialog</class>
<widget class="QDialog" name="MigrateWizardDialog">
<class>MigrateDialog</class>
<widget class="QDialog" name="MigrateDialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>

View file

@ -24,7 +24,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBox"/>
<widget class="QComboBox" name="languageComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
@ -34,7 +34,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="installationDirectoryButton">
<property name="text">
<string>Browse...</string>
</property>
@ -55,7 +55,7 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox">
<widget class="QCheckBox" name="use64bitsClientsCheckBox">
<property name="text">
<string>Use 64 bits client</string>
</property>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>UninstallWizardDialog</class>
<widget class="QDialog" name="UninstallWizardDialog">
<class>UninstallDialog</class>
<widget class="QDialog" name="UninstallDialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
@ -107,12 +107,15 @@
<property name="text">
<string>Uninstall</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="quitButton">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Quit</string>
<string>Cancel</string>
</property>
</widget>
</item>