commit
86084649a2
@ -0,0 +1,128 @@
|
|||||||
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// 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/>.
|
||||||
|
|
||||||
|
#include "stdpch.h"
|
||||||
|
#include "migratewizarddialog.h"
|
||||||
|
#include "configfile.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include "nel/misc/system_info.h"
|
||||||
|
#include "nel/misc/common.h"
|
||||||
|
|
||||||
|
#ifdef DEBUG_NEW
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CMigrateWizardDialog::CMigrateWizardDialog():QDialog()
|
||||||
|
{
|
||||||
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
|
setupUi(this);
|
||||||
|
|
||||||
|
// if launched from current directory, it means we just patched files
|
||||||
|
m_currentDirectory = CConfigFile::getInstance()->getCurrentDirectory();
|
||||||
|
|
||||||
|
if (!CConfigFile::getInstance()->isRyzomInstalledIn(m_currentDirectory))
|
||||||
|
{
|
||||||
|
// Ryzom is in the same directory as Ryzom Installer
|
||||||
|
m_currentDirectory = CConfigFile::getInstance()->getApplicationDirectory();
|
||||||
|
|
||||||
|
if (!CConfigFile::getInstance()->isRyzomInstalledIn(m_currentDirectory))
|
||||||
|
{
|
||||||
|
m_currentDirectory.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_dstDirectory = CConfigFile::getNewInstallationDirectory();
|
||||||
|
|
||||||
|
updateDestinationText();
|
||||||
|
|
||||||
|
// check whether OS architecture is 32 or 64 bits
|
||||||
|
// TODO: 64 bits client only supported under Vista+
|
||||||
|
if (CConfigFile::has64bitsOS())
|
||||||
|
{
|
||||||
|
clientArchGroupBox->setVisible(true);
|
||||||
|
clientArch64RadioButton->setChecked(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clientArchGroupBox->setVisible(false);
|
||||||
|
clientArch32RadioButton->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const CServer &server = CConfigFile::getInstance()->getServer();
|
||||||
|
|
||||||
|
destinationGroupBox->setTitle(tr("Files will be installed to (requires %1):").arg(qBytesToHumanReadable(server.dataUncompressedSize)));
|
||||||
|
|
||||||
|
connect(destinationBrowseButton, SIGNAL(clicked()), SLOT(onDestinationBrowseButtonClicked()));
|
||||||
|
connect(continueButton, SIGNAL(clicked()), SLOT(accept()));
|
||||||
|
connect(quitButton, SIGNAL(clicked()), SLOT(reject()));
|
||||||
|
|
||||||
|
// TODO: if found a folder with initial data, get its total size and check if at least that size is free on the disk
|
||||||
|
|
||||||
|
// by default, advanced parameters are hidden
|
||||||
|
onShowAdvancedParameters(Qt::Unchecked);
|
||||||
|
|
||||||
|
connect(advancedCheckBox, SIGNAL(stateChanged(int)), SLOT(onShowAdvancedParameters(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
CMigrateWizardDialog::~CMigrateWizardDialog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMigrateWizardDialog::onShowAdvancedParameters(int state)
|
||||||
|
{
|
||||||
|
advancedFrame->setVisible(state != Qt::Unchecked);
|
||||||
|
|
||||||
|
adjustSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMigrateWizardDialog::onDestinationBrowseButtonClicked()
|
||||||
|
{
|
||||||
|
QString directory = QFileDialog::getExistingDirectory(this, tr("Please choose directory where to install Ryzom"));
|
||||||
|
|
||||||
|
if (directory.isEmpty()) return;
|
||||||
|
|
||||||
|
m_dstDirectory = directory;
|
||||||
|
|
||||||
|
updateDestinationText();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMigrateWizardDialog::updateDestinationText()
|
||||||
|
{
|
||||||
|
destinationLabel->setText(m_dstDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMigrateWizardDialog::accept()
|
||||||
|
{
|
||||||
|
// check free disk space
|
||||||
|
qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData());
|
||||||
|
|
||||||
|
const CServer &server = CConfigFile::getInstance()->getServer();
|
||||||
|
|
||||||
|
if (freeSpace < server.dataUncompressedSize)
|
||||||
|
{
|
||||||
|
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Not enough free disk space"), tr("You don't have enough free space on this disk, please make more space or choose a directory on another disk."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CConfigFile::getInstance()->setSrcServerDirectory(m_currentDirectory);
|
||||||
|
CConfigFile::getInstance()->setInstallationDirectory(m_dstDirectory);
|
||||||
|
CConfigFile::getInstance()->setUse64BitsClient(clientArch64RadioButton->isChecked());
|
||||||
|
CConfigFile::getInstance()->save();
|
||||||
|
|
||||||
|
QDialog::accept();
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
|
||||||
|
#include "ui_migratewizard.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wizard displayed at first launch, that asks user to choose source and destination directories.
|
||||||
|
*
|
||||||
|
* \author Cedric 'Kervala' OCHS
|
||||||
|
* \date 2016
|
||||||
|
*/
|
||||||
|
class CMigrateWizardDialog : public QDialog, public Ui::MigrateWizardDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CMigrateWizardDialog();
|
||||||
|
virtual ~CMigrateWizardDialog();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onShowAdvancedParameters(int state);
|
||||||
|
void onDestinationBrowseButtonClicked();
|
||||||
|
|
||||||
|
void accept();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateDestinationText();
|
||||||
|
|
||||||
|
QString m_currentDirectory;
|
||||||
|
QString m_dstDirectory;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,183 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MigrateWizardDialog</class>
|
||||||
|
<widget class="QDialog" name="MigrateWizardDialog">
|
||||||
|
<property name="windowModality">
|
||||||
|
<enum>Qt::ApplicationModal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>402</width>
|
||||||
|
<height>331</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Ryzom Installer</string>
|
||||||
|
</property>
|
||||||
|
<property name="modal">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0,0,0">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="messageLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Welcome to Ryzom Installer!
|
||||||
|
|
||||||
|
This program will migrate Ryzom version 2.1 to 3.0. Your files will be updated, cleaned and moved to a new location.
|
||||||
|
|
||||||
|
Just press Continue button and follow the different steps until everything is done.</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignJustify|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="advancedLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="advancedHorizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="advancedCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show advanced parameters (expert)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="advancedFrame">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="advancedMainLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="destinationGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Files will be installed to (requires 10 GiB):</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="destinationLayout" stretch="1,0">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="destinationLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>c:\</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="destinationBrowseButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Browse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="clientArchGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Do you prefer to use a 64 or 32 bits client?</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="clientArch64RadioButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>64 bits (recommended)</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="clientArch32RadioButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>32 bits</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="buttonsLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="continueButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Continue</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="quitButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Quit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>destinationBrowseButton</tabstop>
|
||||||
|
<tabstop>clientArch64RadioButton</tabstop>
|
||||||
|
<tabstop>clientArch32RadioButton</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Reference in New Issue