mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-10 09:19:01 +00:00
Changed: Fixed the 'QMetaObject' linking error and commented out most of the old code to be replaced.
This commit is contained in:
parent
db0ef3fb3d
commit
f49b178b78
3 changed files with 69 additions and 63 deletions
|
@ -10,7 +10,8 @@ SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
|
||||
|
||||
SET(OVQT_PLUG_MISSION_COMPILER_HDR mission_compiler_plugin.h
|
||||
mission_compiler_main_window.h)
|
||||
mission_compiler_main_window.h
|
||||
mission_compiler_settings_page.h)
|
||||
|
||||
SET(OVQT_PLUG_MISSION_COMPILER_UIS mission_compiler_main_window.ui server_entry_dialog.ui mission_compiler_settings_page.ui)
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "../core/core_constants.h"
|
||||
#include "../core/icore.h"
|
||||
|
||||
#include "ui_server_entry_dialog.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/path.h>
|
||||
|
||||
|
@ -27,6 +29,7 @@
|
|||
#include <QtCore/QSettings>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QTreeWidgetItem>
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
@ -79,7 +82,7 @@ QWidget *MissionCompilerSettingsPage::createPage(QWidget *parent)
|
|||
connect(m_ui.removeToolButton, SIGNAL(clicked()), this, SLOT(delPath()));
|
||||
connect(m_ui.upToolButton, SIGNAL(clicked()), this, SLOT(upPath()));
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -119,94 +122,96 @@ void MissionCompilerSettingsPage::applySearchPaths()
|
|||
|
||||
void MissionCompilerSettingsPage::addPath()
|
||||
{
|
||||
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;
|
||||
}
|
||||
Ui::ServerEntryDialog serverEntryDialog;
|
||||
|
||||
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()
|
||||
{
|
||||
QTreeWidgetItem *removeItem = m_ui.serversTreeWidget->takeItem(m_ui.serversTreeWidget->currentRow());
|
||||
if (!removeItem)
|
||||
delete removeItem;
|
||||
//QTreeWidgetItem *removeItem = m_ui.serversTreeWidget->takeItem(m_ui.serversTreeWidget->currentRow());
|
||||
//if (!removeItem)
|
||||
// delete removeItem;
|
||||
|
||||
checkEnabledButton();
|
||||
//checkEnabledButton();
|
||||
}
|
||||
|
||||
void MissionCompilerSettingsPage::upPath()
|
||||
{
|
||||
int currentRow = m_ui.serversTreeWidget->currentRow();
|
||||
if (!(currentRow == 0))
|
||||
{
|
||||
QListWidgetItem *item = m_ui.serversListWidget->takeItem(currentRow);
|
||||
m_ui.serversListWidget->insertItem(--currentRow, item);
|
||||
m_ui.serversListWidget->setCurrentRow(currentRow);
|
||||
}
|
||||
//int currentRow = m_ui.serversTreeWidget->currentRow();
|
||||
//if (!(currentRow == 0))
|
||||
//{
|
||||
// QListWidgetItem *item = m_ui.serversListWidget->takeItem(currentRow);
|
||||
// m_ui.serversListWidget->insertItem(--currentRow, item);
|
||||
// m_ui.serversListWidget->setCurrentRow(currentRow);
|
||||
//}
|
||||
}
|
||||
|
||||
void MissionCompilerSettingsPage::downPath()
|
||||
{
|
||||
int currentRow = m_ui.serversListWidget->currentRow();
|
||||
if (!(currentRow == m_ui.serversListWidget->count()-1))
|
||||
{
|
||||
QListWidgetItem *item = m_ui.serversListWidget->takeItem(currentRow);
|
||||
m_ui.serversTreeWidget->insertItem(++currentRow, item);
|
||||
m_ui.serversTreeWidget->setCurrentRow(currentRow);
|
||||
}
|
||||
//int currentRow = m_ui.serversListWidget->currentRow();
|
||||
//if (!(currentRow == m_ui.serversListWidget->count()-1))
|
||||
//{
|
||||
// QListWidgetItem *item = m_ui.serversListWidget->takeItem(currentRow);
|
||||
// m_ui.serversTreeWidget->insertItem(++currentRow, item);
|
||||
// m_ui.serversTreeWidget->setCurrentRow(currentRow);
|
||||
//}
|
||||
}
|
||||
|
||||
void MissionCompilerSettingsPage::readSettings()
|
||||
{
|
||||
QStringList paths;
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||
if (m_recurse)
|
||||
paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList();
|
||||
else
|
||||
paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
|
||||
settings->endGroup();
|
||||
Q_FOREACH(QString path, paths)
|
||||
{
|
||||
QListWidgetItem *newItem = new QListWidgetItem;
|
||||
newItem->setText(path);
|
||||
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
m_ui.serversTreeWidget->addItem(newItem);
|
||||
}
|
||||
//QStringList paths;
|
||||
//QSettings *settings = Core::ICore::instance()->settings();
|
||||
//settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||
//if (m_recurse)
|
||||
// paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList();
|
||||
//else
|
||||
// paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
|
||||
//settings->endGroup();
|
||||
//Q_FOREACH(QString path, paths)
|
||||
//{
|
||||
// QListWidgetItem *newItem = new QListWidgetItem;
|
||||
// newItem->setText(path);
|
||||
// newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
// m_ui.serversTreeWidget->addItem(newItem);
|
||||
//}
|
||||
}
|
||||
|
||||
void MissionCompilerSettingsPage::writeSettings()
|
||||
{
|
||||
QStringList paths;
|
||||
for (int i = 0; i < m_ui.serversTreeWidget->count(); ++i)
|
||||
paths << m_ui.serversTreeWidget->item(i)->text();
|
||||
//QStringList paths;
|
||||
//for (int i = 0; i < m_ui.serversTreeWidget->count(); ++i)
|
||||
// paths << m_ui.serversTreeWidget->item(i)->text();
|
||||
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||
if (m_recurse)
|
||||
settings->setValue(Core::Constants::RECURSIVE_SEARCH_PATHS, paths);
|
||||
else
|
||||
settings->setValue(Core::Constants::SEARCH_PATHS, paths);
|
||||
settings->endGroup();
|
||||
settings->sync();
|
||||
//QSettings *settings = Core::ICore::instance()->settings();
|
||||
//settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||
//if (m_recurse)
|
||||
// settings->setValue(Core::Constants::RECURSIVE_SEARCH_PATHS, paths);
|
||||
//else
|
||||
// settings->setValue(Core::Constants::SEARCH_PATHS, paths);
|
||||
//settings->endGroup();
|
||||
//settings->sync();
|
||||
}
|
||||
|
||||
void MissionCompilerSettingsPage::checkEnabledButton()
|
||||
{
|
||||
bool bEnabled = true;
|
||||
if (m_ui.serversTreeWidget->count() == 0)
|
||||
bEnabled = false;
|
||||
//bool bEnabled = true;
|
||||
//if (m_ui.serversTreeWidget->count() == 0)
|
||||
// bEnabled = false;
|
||||
|
||||
m_ui.removeToolButton->setEnabled(bEnabled);
|
||||
m_ui.upToolButton->setEnabled(bEnabled);
|
||||
m_ui.downToolButton->setEnabled(bEnabled);
|
||||
//m_ui.removeToolButton->setEnabled(bEnabled);
|
||||
//m_ui.upToolButton->setEnabled(bEnabled);
|
||||
//m_ui.downToolButton->setEnabled(bEnabled);
|
||||
}
|
||||
|
||||
} /* namespace Plugin */
|
|
@ -183,7 +183,7 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="publishHorizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
|
Loading…
Reference in a new issue