|
|
@ -44,6 +44,8 @@ CUninstallWizardDialog::CUninstallWizardDialog(QWidget *parent):QDialog(parent),
|
|
|
|
|
|
|
|
|
|
|
|
model->setHorizontalHeaderLabels(columns);
|
|
|
|
model->setHorizontalHeaderLabels(columns);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QStandardItem *item = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
// clients
|
|
|
|
// clients
|
|
|
|
for (int row = 0; row < serverCount; ++row)
|
|
|
|
for (int row = 0; row < serverCount; ++row)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -53,9 +55,8 @@ CUninstallWizardDialog::CUninstallWizardDialog(QWidget *parent):QDialog(parent),
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_serversIndices[row] = model->rowCount();
|
|
|
|
m_serversIndices[row] = model->rowCount();
|
|
|
|
|
|
|
|
|
|
|
|
QStandardItem *item = new QStandardItem(tr("Client for %1").arg(server.name));
|
|
|
|
item = new QStandardItem(tr("Client for %1").arg(server.name));
|
|
|
|
item->setCheckable(true);
|
|
|
|
item->setCheckable(true);
|
|
|
|
item->setCheckState(Qt::Checked);
|
|
|
|
|
|
|
|
model->appendRow(item);
|
|
|
|
model->appendRow(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -69,7 +70,7 @@ CUninstallWizardDialog::CUninstallWizardDialog(QWidget *parent):QDialog(parent),
|
|
|
|
|
|
|
|
|
|
|
|
const CProfile &profile = config->getProfile(row);
|
|
|
|
const CProfile &profile = config->getProfile(row);
|
|
|
|
|
|
|
|
|
|
|
|
QStandardItem *item = new QStandardItem(tr("Profile #%1: %2").arg(profile.id).arg(profile.name));
|
|
|
|
item = new QStandardItem(tr("Profile #%1: %2").arg(profile.id).arg(profile.name));
|
|
|
|
item->setCheckable(true);
|
|
|
|
item->setCheckable(true);
|
|
|
|
model->appendRow(item);
|
|
|
|
model->appendRow(item);
|
|
|
|
|
|
|
|
|
|
|
@ -77,79 +78,110 @@ CUninstallWizardDialog::CUninstallWizardDialog(QWidget *parent):QDialog(parent),
|
|
|
|
|
|
|
|
|
|
|
|
m_installerIndex = model->rowCount();
|
|
|
|
m_installerIndex = model->rowCount();
|
|
|
|
|
|
|
|
|
|
|
|
QStandardItem *item = new QStandardItem(tr("Ryzom Installer"));
|
|
|
|
item = new QStandardItem(tr("Ryzom Installer"));
|
|
|
|
item->setCheckable(true);
|
|
|
|
item->setCheckable(true);
|
|
|
|
item->setCheckState(Qt::Checked);
|
|
|
|
|
|
|
|
model->appendRow(item);
|
|
|
|
model->appendRow(item);
|
|
|
|
|
|
|
|
|
|
|
|
componentsTreeView->setModel(model);
|
|
|
|
componentsTreeView->setModel(model);
|
|
|
|
componentsTreeView->resizeColumnToContents(0);
|
|
|
|
componentsTreeView->resizeColumnToContents(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
adjustSize();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// click signals
|
|
|
|
connect(uninstallButton, SIGNAL(clicked()), SLOT(accept()));
|
|
|
|
connect(uninstallButton, SIGNAL(clicked()), SLOT(accept()));
|
|
|
|
connect(quitButton, SIGNAL(clicked()), SLOT(reject()));
|
|
|
|
connect(quitButton, SIGNAL(clicked()), SLOT(reject()));
|
|
|
|
connect(model, SIGNAL(itemChanged(QStandardItem *)), SLOT(onItemChanged(QStandardItem *)));
|
|
|
|
connect(model, SIGNAL(itemChanged(QStandardItem *)), SLOT(onItemChanged(QStandardItem *)));
|
|
|
|
|
|
|
|
|
|
|
|
adjustSize();
|
|
|
|
// semi-hack to not update UI on another thread
|
|
|
|
|
|
|
|
connect(this, SIGNAL(updateSize(int, QString)), SLOT(onUpdateSize(int, QString)));
|
|
|
|
QtConcurrent::run(this, &CUninstallWizardDialog::updateSizes);
|
|
|
|
connect(this, SIGNAL(updateLayout()), SLOT(onUpdateLayout()));
|
|
|
|
|
|
|
|
|
|
|
|
updateButtons();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CUninstallWizardDialog::~CUninstallWizardDialog()
|
|
|
|
CUninstallWizardDialog::~CUninstallWizardDialog()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QVector<int> CUninstallWizardDialog::getSelectedServers() const
|
|
|
|
void CUninstallWizardDialog::showEvent(QShowEvent *event)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QVector<int> res;
|
|
|
|
QDialog::showEvent(event);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QtConcurrent::run(this, &CUninstallWizardDialog::updateSizes);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CUninstallWizardDialog::setSelectedComponents(const SUninstallComponents &components)
|
|
|
|
|
|
|
|
{
|
|
|
|
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(componentsTreeView->model());
|
|
|
|
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(componentsTreeView->model());
|
|
|
|
if (model == NULL) return res;
|
|
|
|
if (model == NULL) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QStandardItem *item = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// servers
|
|
|
|
QMap<int, int>::const_iterator it = m_serversIndices.begin(), iend = m_serversIndices.end();
|
|
|
|
QMap<int, int>::const_iterator it = m_serversIndices.begin(), iend = m_serversIndices.end();
|
|
|
|
|
|
|
|
|
|
|
|
while (it != iend)
|
|
|
|
while (it != iend)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QStandardItem *item = model->item(m_installerIndex);
|
|
|
|
item = model->item(it.value());
|
|
|
|
|
|
|
|
|
|
|
|
if (item && item->checkState() == Qt::Checked) res << it.value();
|
|
|
|
if (item) item->setCheckState(components.servers.indexOf(it.key()) > -1 ? Qt::Checked : Qt::Unchecked);
|
|
|
|
|
|
|
|
|
|
|
|
++it;
|
|
|
|
++it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
// profiles
|
|
|
|
|
|
|
|
it = m_profilesIndices.begin(), iend = m_profilesIndices.end();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (it != iend)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
item = model->item(it.value());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (item) item->setCheckState(components.profiles.indexOf(it.key()) > -1 ? Qt::Checked : Qt::Unchecked);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
++it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QVector<int> CUninstallWizardDialog::getSelectedProfiles() const
|
|
|
|
// installer
|
|
|
|
|
|
|
|
item = model->item(m_installerIndex);
|
|
|
|
|
|
|
|
if (item) item->setCheckState(components.installer ? Qt::Checked : Qt::Unchecked);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SUninstallComponents CUninstallWizardDialog::getSelectedCompenents() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QVector<int> res;
|
|
|
|
SUninstallComponents res;
|
|
|
|
|
|
|
|
|
|
|
|
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(componentsTreeView->model());
|
|
|
|
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(componentsTreeView->model());
|
|
|
|
if (model == NULL) return res;
|
|
|
|
if (model == NULL) return res;
|
|
|
|
|
|
|
|
|
|
|
|
QMap<int, int>::const_iterator it = m_profilesIndices.begin(), iend = m_profilesIndices.end();
|
|
|
|
QStandardItem *item = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// servers
|
|
|
|
|
|
|
|
QMap<int, int>::const_iterator it = m_serversIndices.begin(), iend = m_serversIndices.end();
|
|
|
|
|
|
|
|
|
|
|
|
while (it != iend)
|
|
|
|
while (it != iend)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QStandardItem *item = model->item(m_installerIndex);
|
|
|
|
item = model->item(it.value());
|
|
|
|
|
|
|
|
|
|
|
|
if (item && item->checkState() == Qt::Checked) res << it.value();
|
|
|
|
if (item && item->checkState() == Qt::Checked) res.servers << it.key();
|
|
|
|
|
|
|
|
|
|
|
|
++it;
|
|
|
|
++it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
// profiles
|
|
|
|
}
|
|
|
|
it = m_profilesIndices.begin(), iend = m_profilesIndices.end();
|
|
|
|
|
|
|
|
|
|
|
|
bool CUninstallWizardDialog::isInstallerSelected() const
|
|
|
|
while (it != iend)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(componentsTreeView->model());
|
|
|
|
item = model->item(it.value());
|
|
|
|
if (model == NULL) return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QStandardItem *item = model->item(m_installerIndex);
|
|
|
|
if (item && item->checkState() == Qt::Checked) res.profiles << it.key();
|
|
|
|
|
|
|
|
|
|
|
|
return item && item->checkState() == Qt::Checked;
|
|
|
|
++it;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// installer
|
|
|
|
|
|
|
|
item = model->item(m_installerIndex);
|
|
|
|
|
|
|
|
res.installer = item && item->checkState() == Qt::Checked;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CUninstallWizardDialog::accept()
|
|
|
|
void CUninstallWizardDialog::accept()
|
|
|
@ -162,10 +194,26 @@ void CUninstallWizardDialog::onItemChanged(QStandardItem * /* item */)
|
|
|
|
updateButtons();
|
|
|
|
updateButtons();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CUninstallWizardDialog::updateSizes()
|
|
|
|
void CUninstallWizardDialog::onUpdateSize(int row, const QString &text)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(componentsTreeView->model());
|
|
|
|
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(componentsTreeView->model());
|
|
|
|
|
|
|
|
if (model == NULL) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QStandardItem *item = new QStandardItem(text);
|
|
|
|
|
|
|
|
model->setItem(row, 1, item);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CUninstallWizardDialog::onUpdateLayout()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
componentsTreeView->resizeColumnToContents(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateButtons();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
adjustSize();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CUninstallWizardDialog::updateSizes()
|
|
|
|
|
|
|
|
{
|
|
|
|
CConfigFile *config = CConfigFile::getInstance();
|
|
|
|
CConfigFile *config = CConfigFile::getInstance();
|
|
|
|
|
|
|
|
|
|
|
|
// clients
|
|
|
|
// clients
|
|
|
@ -177,8 +225,7 @@ void CUninstallWizardDialog::updateSizes()
|
|
|
|
|
|
|
|
|
|
|
|
qint64 bytes = getDirectorySize(config->getInstallationDirectory() + "/" + server.id);
|
|
|
|
qint64 bytes = getDirectorySize(config->getInstallationDirectory() + "/" + server.id);
|
|
|
|
|
|
|
|
|
|
|
|
QStandardItem *item = new QStandardItem(qBytesToHumanReadable(bytes));
|
|
|
|
emit updateSize(it.value(), qBytesToHumanReadable(bytes));
|
|
|
|
model->setItem(it.value(), 1, item);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
++it;
|
|
|
|
++it;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -192,13 +239,12 @@ void CUninstallWizardDialog::updateSizes()
|
|
|
|
|
|
|
|
|
|
|
|
qint64 bytes = getDirectorySize(config->getProfileDirectory() + "/" + profile.id);
|
|
|
|
qint64 bytes = getDirectorySize(config->getProfileDirectory() + "/" + profile.id);
|
|
|
|
|
|
|
|
|
|
|
|
QStandardItem *item = new QStandardItem(qBytesToHumanReadable(bytes));
|
|
|
|
emit updateSize(it.value(), qBytesToHumanReadable(bytes));
|
|
|
|
model->setItem(it.value(), 1, item);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
++it;
|
|
|
|
++it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentsTreeView->resizeColumnToContents(1);
|
|
|
|
emit updateLayout();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CUninstallWizardDialog::updateButtons()
|
|
|
|
void CUninstallWizardDialog::updateButtons()
|
|
|
|