|
|
@ -20,6 +20,8 @@
|
|
|
|
#include "../core/core_constants.h"
|
|
|
|
#include "../core/core_constants.h"
|
|
|
|
#include "../core/icore.h"
|
|
|
|
#include "../core/icore.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "ui_server_entry_dialog.h"
|
|
|
|
|
|
|
|
|
|
|
|
// NeL includes
|
|
|
|
// NeL includes
|
|
|
|
#include <nel/misc/path.h>
|
|
|
|
#include <nel/misc/path.h>
|
|
|
|
|
|
|
|
|
|
|
@ -27,6 +29,7 @@
|
|
|
|
#include <QtCore/QSettings>
|
|
|
|
#include <QtCore/QSettings>
|
|
|
|
#include <QtGui/QWidget>
|
|
|
|
#include <QtGui/QWidget>
|
|
|
|
#include <QtGui/QFileDialog>
|
|
|
|
#include <QtGui/QFileDialog>
|
|
|
|
|
|
|
|
#include <QtGui/QTreeWidgetItem>
|
|
|
|
|
|
|
|
|
|
|
|
namespace Plugin
|
|
|
|
namespace Plugin
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -79,7 +82,7 @@ QWidget *MissionCompilerSettingsPage::createPage(QWidget *parent)
|
|
|
|
connect(m_ui.removeToolButton, SIGNAL(clicked()), this, SLOT(delPath()));
|
|
|
|
connect(m_ui.removeToolButton, SIGNAL(clicked()), this, SLOT(delPath()));
|
|
|
|
connect(m_ui.upToolButton, SIGNAL(clicked()), this, SLOT(upPath()));
|
|
|
|
connect(m_ui.upToolButton, SIGNAL(clicked()), this, SLOT(upPath()));
|
|
|
|
connect(m_ui.downToolButton, SIGNAL(clicked()), this, SLOT(downPath()));
|
|
|
|
connect(m_ui.downToolButton, SIGNAL(clicked()), this, SLOT(downPath()));
|
|
|
|
connect(m_ui.resetToolButton, SIGNAL(clicked()), m_ui.serversTreeWidget, SLOT(clear()));
|
|
|
|
//connect(m_ui.resetToolButton, SIGNAL(clicked()), m_ui.serversTreeWidget, SLOT(clear()));
|
|
|
|
return m_page;
|
|
|
|
return m_page;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -119,94 +122,96 @@ void MissionCompilerSettingsPage::applySearchPaths()
|
|
|
|
|
|
|
|
|
|
|
|
void MissionCompilerSettingsPage::addPath()
|
|
|
|
void MissionCompilerSettingsPage::addPath()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QString newPath = QFileDialog::getExistingDirectory(m_page, "", lastDir);
|
|
|
|
Ui::ServerEntryDialog serverEntryDialog;
|
|
|
|
if (!newPath.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QTreeWidgetItem *newItem = new QTreeWidgetItem;
|
|
|
|
|
|
|
|
newItem->setText(newPath);
|
|
|
|
|
|
|
|
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
|
|
|
|
|
|
m_ui.serversTreeWidget->addItem(newItem);
|
|
|
|
|
|
|
|
lastDir = newPath;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
checkEnabledButton();
|
|
|
|
//QString newPath = QFileDialog::getExistingDirectory(m_page, "", lastDir);
|
|
|
|
|
|
|
|
//if (!newPath.isEmpty())
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// QTreeWidgetItem *newItem = new QTreeWidgetItem;
|
|
|
|
|
|
|
|
// newItem->setText(newPath);
|
|
|
|
|
|
|
|
// newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
|
|
|
|
|
|
// m_ui.serversTreeWidget->addItem(newItem);
|
|
|
|
|
|
|
|
// lastDir = newPath;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//checkEnabledButton();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MissionCompilerSettingsPage::delPath()
|
|
|
|
void MissionCompilerSettingsPage::delPath()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QTreeWidgetItem *removeItem = m_ui.serversTreeWidget->takeItem(m_ui.serversTreeWidget->currentRow());
|
|
|
|
//QTreeWidgetItem *removeItem = m_ui.serversTreeWidget->takeItem(m_ui.serversTreeWidget->currentRow());
|
|
|
|
if (!removeItem)
|
|
|
|
//if (!removeItem)
|
|
|
|
delete removeItem;
|
|
|
|
// delete removeItem;
|
|
|
|
|
|
|
|
|
|
|
|
checkEnabledButton();
|
|
|
|
//checkEnabledButton();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MissionCompilerSettingsPage::upPath()
|
|
|
|
void MissionCompilerSettingsPage::upPath()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int currentRow = m_ui.serversTreeWidget->currentRow();
|
|
|
|
//int currentRow = m_ui.serversTreeWidget->currentRow();
|
|
|
|
if (!(currentRow == 0))
|
|
|
|
//if (!(currentRow == 0))
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
QListWidgetItem *item = m_ui.serversListWidget->takeItem(currentRow);
|
|
|
|
// QListWidgetItem *item = m_ui.serversListWidget->takeItem(currentRow);
|
|
|
|
m_ui.serversListWidget->insertItem(--currentRow, item);
|
|
|
|
// m_ui.serversListWidget->insertItem(--currentRow, item);
|
|
|
|
m_ui.serversListWidget->setCurrentRow(currentRow);
|
|
|
|
// m_ui.serversListWidget->setCurrentRow(currentRow);
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MissionCompilerSettingsPage::downPath()
|
|
|
|
void MissionCompilerSettingsPage::downPath()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int currentRow = m_ui.serversListWidget->currentRow();
|
|
|
|
//int currentRow = m_ui.serversListWidget->currentRow();
|
|
|
|
if (!(currentRow == m_ui.serversListWidget->count()-1))
|
|
|
|
//if (!(currentRow == m_ui.serversListWidget->count()-1))
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
QListWidgetItem *item = m_ui.serversListWidget->takeItem(currentRow);
|
|
|
|
// QListWidgetItem *item = m_ui.serversListWidget->takeItem(currentRow);
|
|
|
|
m_ui.serversTreeWidget->insertItem(++currentRow, item);
|
|
|
|
// m_ui.serversTreeWidget->insertItem(++currentRow, item);
|
|
|
|
m_ui.serversTreeWidget->setCurrentRow(currentRow);
|
|
|
|
// m_ui.serversTreeWidget->setCurrentRow(currentRow);
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MissionCompilerSettingsPage::readSettings()
|
|
|
|
void MissionCompilerSettingsPage::readSettings()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QStringList paths;
|
|
|
|
//QStringList paths;
|
|
|
|
QSettings *settings = Core::ICore::instance()->settings();
|
|
|
|
//QSettings *settings = Core::ICore::instance()->settings();
|
|
|
|
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
|
|
|
//settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
|
|
|
if (m_recurse)
|
|
|
|
//if (m_recurse)
|
|
|
|
paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList();
|
|
|
|
// paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList();
|
|
|
|
else
|
|
|
|
//else
|
|
|
|
paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
|
|
|
|
// paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
|
|
|
|
settings->endGroup();
|
|
|
|
//settings->endGroup();
|
|
|
|
Q_FOREACH(QString path, paths)
|
|
|
|
//Q_FOREACH(QString path, paths)
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
QListWidgetItem *newItem = new QListWidgetItem;
|
|
|
|
// QListWidgetItem *newItem = new QListWidgetItem;
|
|
|
|
newItem->setText(path);
|
|
|
|
// newItem->setText(path);
|
|
|
|
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
|
|
// newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
|
|
m_ui.serversTreeWidget->addItem(newItem);
|
|
|
|
// m_ui.serversTreeWidget->addItem(newItem);
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MissionCompilerSettingsPage::writeSettings()
|
|
|
|
void MissionCompilerSettingsPage::writeSettings()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QStringList paths;
|
|
|
|
//QStringList paths;
|
|
|
|
for (int i = 0; i < m_ui.serversTreeWidget->count(); ++i)
|
|
|
|
//for (int i = 0; i < m_ui.serversTreeWidget->count(); ++i)
|
|
|
|
paths << m_ui.serversTreeWidget->item(i)->text();
|
|
|
|
// paths << m_ui.serversTreeWidget->item(i)->text();
|
|
|
|
|
|
|
|
|
|
|
|
QSettings *settings = Core::ICore::instance()->settings();
|
|
|
|
//QSettings *settings = Core::ICore::instance()->settings();
|
|
|
|
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
|
|
|
//settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
|
|
|
if (m_recurse)
|
|
|
|
//if (m_recurse)
|
|
|
|
settings->setValue(Core::Constants::RECURSIVE_SEARCH_PATHS, paths);
|
|
|
|
// settings->setValue(Core::Constants::RECURSIVE_SEARCH_PATHS, paths);
|
|
|
|
else
|
|
|
|
//else
|
|
|
|
settings->setValue(Core::Constants::SEARCH_PATHS, paths);
|
|
|
|
// settings->setValue(Core::Constants::SEARCH_PATHS, paths);
|
|
|
|
settings->endGroup();
|
|
|
|
//settings->endGroup();
|
|
|
|
settings->sync();
|
|
|
|
//settings->sync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MissionCompilerSettingsPage::checkEnabledButton()
|
|
|
|
void MissionCompilerSettingsPage::checkEnabledButton()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool bEnabled = true;
|
|
|
|
//bool bEnabled = true;
|
|
|
|
if (m_ui.serversTreeWidget->count() == 0)
|
|
|
|
//if (m_ui.serversTreeWidget->count() == 0)
|
|
|
|
bEnabled = false;
|
|
|
|
// bEnabled = false;
|
|
|
|
|
|
|
|
|
|
|
|
m_ui.removeToolButton->setEnabled(bEnabled);
|
|
|
|
//m_ui.removeToolButton->setEnabled(bEnabled);
|
|
|
|
m_ui.upToolButton->setEnabled(bEnabled);
|
|
|
|
//m_ui.upToolButton->setEnabled(bEnabled);
|
|
|
|
m_ui.downToolButton->setEnabled(bEnabled);
|
|
|
|
//m_ui.downToolButton->setEnabled(bEnabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} /* namespace Plugin */
|
|
|
|
} /* namespace Plugin */
|