Merged in hotfix (pull request #115)

Merging hotfix branch

--HG--
branch : compatibility
hg/compatibility
dfighter1985 10 years ago
commit ab2a455db2

@ -25,6 +25,8 @@ extern "C"
#include "WWWInit.h" #include "WWWInit.h"
} }
#include "nel/misc/rgba.h"
namespace NLGUI namespace NLGUI
{ {
class CCtrlBaseButton; class CCtrlBaseButton;

@ -507,6 +507,13 @@ public:
*/ */
static bool makePathRelative (const char *basePath, std::string &relativePath); static bool makePathRelative (const char *basePath, std::string &relativePath);
/** Make path absolute
* \param relativePath - The relative path
* \param directory - the directory to which the path is relative to
* returns the absolute path, or empty if something went wrong.
*/
static std::string makePathAbsolute (const std::string &relativePath, const std::string &directory );
/** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning. /** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning.
*/ */
static void addIgnoredDoubleFile(const std::string &ignoredFile); static void addIgnoredDoubleFile(const std::string &ignoredFile);

@ -2544,6 +2544,57 @@ bool CPath::makePathRelative (const char *basePath, std::string &relativePath)
return false; return false;
} }
std::string CPath::makePathAbsolute( const std::string &relativePath, const std::string &directory )
{
if( relativePath.empty() )
return "";
if( directory.empty() )
return "";
#ifdef NL_OS_WINDOWS
// Windows network address. Eg.: \\someshare\path
if( ( relativePath[ 0 ] == '\\' ) && ( relativePath[ 1 ] == '\\' ) )
return relativePath;
// Normal Windows absolute path. Eg.: C:\something
//
if( isalpha( relativePath[ 0 ] ) && ( relativePath[ 1 ] == ':' ) && ( ( relativePath[ 2 ] == '\\' ) || ( relativePath[ 2 ] == '/' ) ) )
return relativePath;
#else
// Unix filesystem absolute path
if( relativePath[ 0 ] == '/' )
return relativePath;
#endif
// Add a slash to the directory if necessary.
// If the relative path starts with dots we need a slash.
// If the relative path starts with a slash we don't.
// If it starts with neither, we need a slash.
bool needSlash = true;
char c = relativePath[ 0 ];
if( ( c == '\\' ) || ( c == '/' ) )
needSlash = false;
bool hasSlash = false;
std::string npath = directory;
c = npath[ npath.size() - 1 ];
if( ( c == '\\' ) || ( c == '/' ) )
hasSlash = true;
if( needSlash && !hasSlash )
npath += '/';
else
if( hasSlash && !needSlash )
npath.resize( npath.size() - 1 );
// Now build the new absolute path
npath += relativePath;
npath = standardizePath( npath, false );
return npath;
}
bool CFile::setRWAccess(const std::string &filename) bool CFile::setRWAccess(const std::string &filename)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS

@ -10,15 +10,18 @@ IF(WIN32)
SET(OVQT_PLUGIN_SPECS_DIR "plugins") SET(OVQT_PLUGIN_SPECS_DIR "plugins")
SET(OVQT_PLUGIN_DIR "plugins") SET(OVQT_PLUGIN_DIR "plugins")
SET(OVQT_DATA_DIR ".") SET(OVQT_DATA_DIR ".")
SET(OVQT_IMP_DATA_DIR "${OVQT_DATA_DIR}")
ELSEIF(APPLE) ELSEIF(APPLE)
# TODO: under Mac OS X, don't install but copy files in application package # TODO: under Mac OS X, don't install but copy files in application package
SET(OVQT_PLUGIN_SPECS_DIR "plugins") SET(OVQT_PLUGIN_SPECS_DIR "plugins")
SET(OVQT_PLUGIN_DIR "plugins") SET(OVQT_PLUGIN_DIR "plugins")
SET(OVQT_DATA_DIR ".") SET(OVQT_DATA_DIR ".")
SET(OVQT_IMP_DATA_DIR "${OVQT_DATA_DIR}")
ELSE(WIN32) ELSE(WIN32)
SET(OVQT_PLUGIN_SPECS_DIR ${NL_SHARE_PREFIX}/studio/plugins) SET(OVQT_PLUGIN_SPECS_DIR ${NL_SHARE_PREFIX}/studio/plugins)
SET(OVQT_PLUGIN_DIR ${NL_LIB_PREFIX}/studio) SET(OVQT_PLUGIN_DIR ${NL_LIB_PREFIX}/studio)
SET(OVQT_DATA_DIR ${NL_SHARE_PREFIX}/studio/data) SET(OVQT_DATA_DIR ${NL_SHARE_PREFIX}/studio/data)
SET(OVQT_IMP_DATA_DIR "${CMAKE_INSTALL_PREFIX}/${OVQT_DATA_DIR}")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ovqt_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/ovqt_config.h) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ovqt_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/ovqt_config.h)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

@ -11,7 +11,7 @@ FILE(GLOB STUDIO_SRC extension_system/*.h
SET(STUDIO_HDR extension_system/iplugin_manager.h SET(STUDIO_HDR extension_system/iplugin_manager.h
extension_system/plugin_manager.h extension_system/plugin_manager.h
settings_dialog.h startup_settings_dlg.h
splash_screen.h splash_screen.h
pm_watcher.h ) pm_watcher.h )
@ -22,7 +22,7 @@ SET(STUDIO_TS translations/object_viewer_qt_en.ts
translations/object_viewer_qt_de.ts translations/object_viewer_qt_de.ts
translations/object_viewer_qt_ru.ts) translations/object_viewer_qt_ru.ts)
SET(STUDIO_PLUGIN_UIS settings_dialog.ui ) SET(STUDIO_PLUGIN_UIS startup_settings_dlg.ui )
SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE) SET(QT_USE_QTOPENGL TRUE)

@ -41,7 +41,7 @@
#include <QtGui/QFileDialog> #include <QtGui/QFileDialog>
#include <QtGui/QInputDialog> #include <QtGui/QInputDialog>
#include "settings_dialog.h" #include "startup_settings_dlg.h"
#include "splash_screen.h" #include "splash_screen.h"
#include "pm_watcher.h" #include "pm_watcher.h"
@ -160,7 +160,7 @@ int main(int argc, char **argv)
{ {
settings->setValue( "FirstRun", false ); settings->setValue( "FirstRun", false );
SettingsDialog sd; StartupSettingsDlg sd;
sd.setSettings( settings ); sd.setSettings( settings );
sd.load(); sd.load();
sd.exec(); sd.exec();

@ -38,6 +38,10 @@ SET(OVQT_CORE_PLUGIN_UIS settings_dialog.ui
SET(OVQT_CORE_PLUGIN_RCS core.qrc) SET(OVQT_CORE_PLUGIN_RCS core.qrc)
IF(NOT WIN32)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/core_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/core_config.h)
ENDIF(NOT WIN32)
SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE) SET(QT_USE_QTOPENGL TRUE)

@ -0,0 +1,7 @@
#ifndef CORE_CONFIG_H
#define CORE_CONFIG_H
#define STUDIO_DATA_DIR "${OVQT_IMP_DATA_DIR}"
#endif

@ -28,6 +28,10 @@
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QtGui/QFileDialog> #include <QtGui/QFileDialog>
#if !defined NL_OS_WINDOWS
#include "core_config.h"
#endif
namespace Core namespace Core
{ {
@ -118,6 +122,10 @@ void SearchPathsSettingsPage::applySearchPaths()
for (int i = 1; i < remapExt.size(); i += 2) for (int i = 1; i < remapExt.size(); i += 2)
NLMISC::CPath::remapExtension(remapExt.at(i - 1).toUtf8().constData(), remapExt.at(i).toUtf8().constData(), true); NLMISC::CPath::remapExtension(remapExt.at(i - 1).toUtf8().constData(), remapExt.at(i).toUtf8().constData(), true);
#if !defined NL_OS_WINDOWS
NLMISC::CPath::addSearchPath(std::string(STUDIO_DATA_DIR), false, false);
#endif
Q_FOREACH(QString path, paths) Q_FOREACH(QString path, paths)
{ {
NLMISC::CPath::addSearchPath(path.toUtf8().constData(), m_recurse, false); NLMISC::CPath::addSearchPath(path.toUtf8().constData(), m_recurse, false);

@ -145,11 +145,17 @@ void SettingsDialog::pageSelected()
void SettingsDialog::accept() void SettingsDialog::accept()
{ {
m_applied = true; m_applied = true;
setCursor( Qt::WaitCursor );
Q_FOREACH(IOptionsPage *page, m_pages) Q_FOREACH(IOptionsPage *page, m_pages)
{ {
page->apply(); page->apply();
page->finish(); page->finish();
} }
setCursor( Qt::ArrowCursor );
done(QDialog::Accepted); done(QDialog::Accepted);
} }
@ -162,8 +168,13 @@ void SettingsDialog::reject()
void SettingsDialog::apply() void SettingsDialog::apply()
{ {
setCursor( Qt::WaitCursor );
Q_FOREACH(IOptionsPage *page, m_pages) Q_FOREACH(IOptionsPage *page, m_pages)
page->apply(); page->apply();
setCursor( Qt::ArrowCursor );
m_applied = true; m_applied = true;
} }

@ -19,7 +19,7 @@
#ifndef SETTINGS_DIALOG_H #ifndef SETTINGS_DIALOG_H
#define SETTINGS_DIALOG_H #define SETTINGS_DIALOG_H
#include "../core/ui_settings_dialog.h" #include "ui_settings_dialog.h"
// Qt includes // Qt includes
#include <QtCore/QList> #include <QtCore/QList>

@ -4,6 +4,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}
${QT_INCLUDES} ${QT_INCLUDES}
${LUA_INCLUDE_DIR}) ${LUA_INCLUDE_DIR})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/gui_editor_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/gui_editor_config.h)
FILE(GLOB SRC *.cpp *.h) FILE(GLOB SRC *.cpp *.h)
SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
@ -112,3 +114,11 @@ ELSE(WIN32)
ENDIF(WIN32) ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_gui_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_gui_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)
FILE(GLOB widgets "${CMAKE_CURRENT_SOURCE_DIR}/widgets/*.xml")
FILE(GLOB expressions "${CMAKE_CURRENT_SOURCE_DIR}/expressions/*.xml")
INSTALL(FILES ${widgets} DESTINATION "${OVQT_DATA_DIR}/widgets" COMPONENT tools3d)
INSTALL(FILES ${expressions} DESTINATION "${OVQT_DATA_DIR}/expressions" COMPONENT tools3d)
INSTALL(DIRECTORY fonts/ DESTINATION ${OVQT_DATA_DIR} COMPONENT data)

@ -21,6 +21,7 @@
#include "expression_loader.h" #include "expression_loader.h"
#include <QMap> #include <QMap>
#include <QDir> #include <QDir>
#include "gui_editor_config.h"
class ExpressionStorePvt class ExpressionStorePvt
{ {
@ -50,7 +51,7 @@ ExpressionStore::~ExpressionStore()
bool ExpressionStore::load() bool ExpressionStore::load()
{ {
QDir d( "expressions" ); QDir d( EXPRESSIONS_DIR );
if( !d.exists() ) if( !d.exists() )
return false; return false;

@ -0,0 +1,8 @@
#ifndef GUI_EDITOR_CONFIG_H
#define GUI_EDITOR_CONFIG_H
#define WIDGETS_DIR "${OVQT_IMP_DATA_DIR}/widgets"
#define EXPRESSIONS_DIR "${OVQT_IMP_DATA_DIR}/expressions"
#endif

@ -20,6 +20,7 @@
#include <QStringList> #include <QStringList>
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include "widget_info_tree.h" #include "widget_info_tree.h"
#include "gui_editor_config.h"
using namespace NLMISC; using namespace NLMISC;
@ -36,7 +37,7 @@ namespace GUIEditor
void CWidgetPropParser::parseGUIWidgets() void CWidgetPropParser::parseGUIWidgets()
{ {
QDir d( "widgets" ); QDir d( WIDGETS_DIR );
if( !d.exists() ) if( !d.exists() )
{ {
nlwarning( "GUI widgets directory doesn't exist!" ); nlwarning( "GUI widgets directory doesn't exist!" );
@ -55,7 +56,7 @@ namespace GUIEditor
QStringListIterator itr( files ); QStringListIterator itr( files );
while( itr.hasNext() ) while( itr.hasNext() )
parseGUIWidget( "widgets/" + itr.next() ); parseGUIWidget( QString( WIDGETS_DIR ) + QString( "/" ) + itr.next() );
buildWidgetInfoTree(); buildWidgetInfoTree();

@ -59,6 +59,8 @@ bool loadWorldEditFile(const std::string &fileName, WorldEditList &worldEditList
lastError = ""; lastError = "";
std::string p = NLMISC::CFile::getPath( fileName );
// Load the document // Load the document
NLMISC::CIFile file; NLMISC::CIFile file;
if (file.open(fileName)) if (file.open(fileName))
@ -122,6 +124,8 @@ bool loadWorldEditFile(const std::string &fileName, WorldEditList &worldEditList
{ {
std::string dataDir; std::string dataDir;
NLMISC::CIXml::getPropertyString(dataDir, node, "VALUE"); NLMISC::CIXml::getPropertyString(dataDir, node, "VALUE");
dataDir = NLMISC::CPath::makePathAbsolute( dataDir, p );
worldEditList.push_back(WorldEditItem(DataDirectoryType, dataDir)); worldEditList.push_back(WorldEditItem(DataDirectoryType, dataDir));
} }
@ -149,6 +153,9 @@ bool loadWorldEditFile(const std::string &fileName, WorldEditList &worldEditList
std::string filenameChild; std::string filenameChild;
if ( NLMISC::CIXml::getPropertyString(filenameChild, node, "FILENAME")) if ( NLMISC::CIXml::getPropertyString(filenameChild, node, "FILENAME"))
{ {
filenameChild = NLMISC::CPath::makePathAbsolute( filenameChild, p );
// Is it a landscape ? // Is it a landscape ?
if (type == "landscape") if (type == "landscape")
{ {

@ -17,9 +17,11 @@
// Project includes // Project includes
#include "world_editor_settings_page.h" #include "world_editor_settings_page.h"
#include "world_editor_constants.h" #include "world_editor_constants.h"
#include "../core/icore.h"
// Qt includes // Qt includes
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QSettings>
// NeL includes // NeL includes
@ -61,11 +63,31 @@ QWidget *WorldEditorSettingsPage::createPage(QWidget *parent)
{ {
m_currentPage = new QWidget(parent); m_currentPage = new QWidget(parent);
m_ui.setupUi(m_currentPage); m_ui.setupUi(m_currentPage);
readSettings();
return m_currentPage; return m_currentPage;
} }
void WorldEditorSettingsPage::readSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::WORLD_EDITOR_SECTION);
bool b = false;
b = settings->value( Constants::WORLD_EDITOR_USE_OPENGL, true ).toBool();
m_ui.glCB->setChecked( b );
settings->endGroup();
}
void WorldEditorSettingsPage::apply() void WorldEditorSettingsPage::apply()
{ {
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::WORLD_EDITOR_SECTION);
bool b = false;
b = m_ui.glCB->isChecked();
settings->setValue( Constants::WORLD_EDITOR_USE_OPENGL, b );
settings->endGroup();
} }
} /* namespace WorldEditor */ } /* namespace WorldEditor */

@ -46,6 +46,7 @@ public:
QIcon categoryIcon() const; QIcon categoryIcon() const;
virtual QWidget *createPage(QWidget *parent); virtual QWidget *createPage(QWidget *parent);
virtual void readSettings();
virtual void apply(); virtual void apply();
virtual void finish() {} virtual void finish() {}

@ -3,7 +3,7 @@
<class>WorldEditorSettingsPage</class> <class>WorldEditorSettingsPage</class>
<widget class="QWidget" name="WorldEditorSettingsPage"> <widget class="QWidget" name="WorldEditorSettingsPage">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -25,6 +25,9 @@
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title"> <property name="title">
<string>Workspace</string> <string>Workspace</string>
</property> </property>
@ -37,10 +40,18 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QSpinBox" name="spinBox_3"/> <widget class="QSpinBox" name="spinBox_3">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QSpinBox" name="spinBox_4"/> <widget class="QSpinBox" name="spinBox_4">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
@ -50,15 +61,32 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QSpinBox" name="spinBox_5"/> <widget class="QSpinBox" name="spinBox_5">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QSpinBox" name="spinBox_6"/> <widget class="QSpinBox" name="spinBox_6">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item> </item>
<item row="2" column="0" colspan="3"> <item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="checkBox"> <widget class="QCheckBox" name="glCB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text"> <property name="text">
<string>Use OpenGL</string> <string>Use OpenGL ( requires restart )</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -79,7 +107,11 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QSpinBox" name="spinBox"/> <widget class="QSpinBox" name="spinBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
@ -89,7 +121,11 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QSpinBox" name="spinBox_2"/> <widget class="QSpinBox" name="spinBox_2">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
@ -101,10 +137,17 @@
<item row="2" column="1"> <item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLineEdit" name="lineEdit"/> <widget class="QLineEdit" name="lineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton"> <widget class="QToolButton" name="toolButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>

@ -436,6 +436,7 @@ void WorldEditorWindow::writeSettings()
settings->beginGroup(Constants::WORLD_EDITOR_SECTION); settings->beginGroup(Constants::WORLD_EDITOR_SECTION);
settings->setValue(Constants::WORLD_WINDOW_STATE, saveState()); settings->setValue(Constants::WORLD_WINDOW_STATE, saveState());
settings->setValue(Constants::WORLD_WINDOW_GEOMETRY, saveGeometry()); settings->setValue(Constants::WORLD_WINDOW_GEOMETRY, saveGeometry());
settings->setValue(Constants::WORLD_EDITOR_USE_OPENGL, settings->value(Constants::WORLD_EDITOR_USE_OPENGL));
settings->endGroup(); settings->endGroup();
settings->sync(); settings->sync();
} }

@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "settings_dialog.h" #include "startup_settings_dlg.h"
#include <QFileDialog> #include <QFileDialog>
#include <QSettings> #include <QSettings>
#include <QStringList> #include <QStringList>
@ -32,7 +32,7 @@ int findListItem( QListWidget *l, const QString &s )
return -1; return -1;
} }
SettingsDialog::SettingsDialog( QDialog *parent ) : StartupSettingsDlg::StartupSettingsDlg( QDialog *parent ) :
QDialog( parent ) QDialog( parent )
{ {
setupUi( this ); setupUi( this );
@ -40,11 +40,11 @@ QDialog( parent )
settings = NULL; settings = NULL;
} }
SettingsDialog::~SettingsDialog() StartupSettingsDlg::~StartupSettingsDlg()
{ {
} }
void SettingsDialog::load() void StartupSettingsDlg::load()
{ {
pluginsLE->setText( settings->value( "PluginPath" ).toString() ); pluginsLE->setText( settings->value( "PluginPath" ).toString() );
@ -82,7 +82,7 @@ void SettingsDialog::load()
settings->endGroup(); settings->endGroup();
} }
void SettingsDialog::saveSearchPaths() void StartupSettingsDlg::saveSearchPaths()
{ {
QStringList l; QStringList l;
for( int i = 0; i < searchLW->count(); i++ ) for( int i = 0; i < searchLW->count(); i++ )
@ -93,7 +93,7 @@ void SettingsDialog::saveSearchPaths()
settings->setValue( "SearchPaths", l ); settings->setValue( "SearchPaths", l );
} }
void SettingsDialog::saveRecursivePaths() void StartupSettingsDlg::saveRecursivePaths()
{ {
QStringList l; QStringList l;
for( int i = 0; i < recursiveLW->count(); i++ ) for( int i = 0; i < recursiveLW->count(); i++ )
@ -104,7 +104,7 @@ void SettingsDialog::saveRecursivePaths()
settings->setValue( "RecursiveSearchPathes", l ); settings->setValue( "RecursiveSearchPathes", l );
} }
void SettingsDialog::save() void StartupSettingsDlg::save()
{ {
settings->setValue( "PluginPath", pluginsLE->text() ); settings->setValue( "PluginPath", pluginsLE->text() );
@ -123,59 +123,59 @@ void SettingsDialog::save()
settings->sync(); settings->sync();
} }
void SettingsDialog::accept() void StartupSettingsDlg::accept()
{ {
save(); save();
QDialog::accept(); QDialog::accept();
} }
void SettingsDialog::reject() void StartupSettingsDlg::reject()
{ {
QDialog::reject(); QDialog::reject();
} }
void SettingsDialog::onOKClicked() void StartupSettingsDlg::onOKClicked()
{ {
accept(); accept();
} }
void SettingsDialog::onCancelClicked() void StartupSettingsDlg::onCancelClicked()
{ {
reject(); reject();
} }
void SettingsDialog::onPluginBClicked() void StartupSettingsDlg::onPluginBClicked()
{ {
QString p = QFileDialog::getExistingDirectory( this, tr( "Plugins directory" ), "" ); QString p = QFileDialog::getExistingDirectory( this, tr( "Plugins directory" ), "" );
pluginsLE->setText( p ); pluginsLE->setText( p );
} }
void SettingsDialog::onSheetsBClicked() void StartupSettingsDlg::onSheetsBClicked()
{ {
QString p = QFileDialog::getExistingDirectory( this, tr( "Sheets directory" ), "" ); QString p = QFileDialog::getExistingDirectory( this, tr( "Sheets directory" ), "" );
sheetsLE->setText( p ); sheetsLE->setText( p );
} }
void SettingsDialog::onAssetsBClicked() void StartupSettingsDlg::onAssetsBClicked()
{ {
QString p = QFileDialog::getExistingDirectory( this, tr( "Assets directory" ), "" ); QString p = QFileDialog::getExistingDirectory( this, tr( "Assets directory" ), "" );
assetsLE->setText( p ); assetsLE->setText( p );
} }
void SettingsDialog::onPrimitivesBClicked() void StartupSettingsDlg::onPrimitivesBClicked()
{ {
QString p = QFileDialog::getExistingDirectory( this, tr( "Primitives directory" ), "" ); QString p = QFileDialog::getExistingDirectory( this, tr( "Primitives directory" ), "" );
primitivesLE->setText( p ); primitivesLE->setText( p );
} }
void SettingsDialog::onLigoBClicked() void StartupSettingsDlg::onLigoBClicked()
{ {
QString p; QString p;
p = QFileDialog::getOpenFileName( this, tr( "LIGO config file" ), "" ); p = QFileDialog::getOpenFileName( this, tr( "LIGO config file" ), "" );
ligoLE->setText( p ); ligoLE->setText( p );
} }
void SettingsDialog::onPathAddClicked() void StartupSettingsDlg::onPathAddClicked()
{ {
QString p = QFileDialog::getExistingDirectory( this, tr( "Search path" ), "" ); QString p = QFileDialog::getExistingDirectory( this, tr( "Search path" ), "" );
if( p.isEmpty() ) if( p.isEmpty() )
@ -187,7 +187,7 @@ void SettingsDialog::onPathAddClicked()
searchLW->addItem( p ); searchLW->addItem( p );
} }
void SettingsDialog::onPathRemoveClicked() void StartupSettingsDlg::onPathRemoveClicked()
{ {
QListWidgetItem *i = searchLW->currentItem(); QListWidgetItem *i = searchLW->currentItem();
if( i == NULL ) if( i == NULL )
@ -196,7 +196,7 @@ void SettingsDialog::onPathRemoveClicked()
delete i; delete i;
} }
void SettingsDialog::onRecursiveAddClicked() void StartupSettingsDlg::onRecursiveAddClicked()
{ {
QString p = QFileDialog::getExistingDirectory( this, tr( "Recursive search path" ), "" ); QString p = QFileDialog::getExistingDirectory( this, tr( "Recursive search path" ), "" );
if( p.isEmpty() ) if( p.isEmpty() )
@ -208,7 +208,7 @@ void SettingsDialog::onRecursiveAddClicked()
recursiveLW->addItem( p ); recursiveLW->addItem( p );
} }
void SettingsDialog::onRecursiveRemoveClicked() void StartupSettingsDlg::onRecursiveRemoveClicked()
{ {
QListWidgetItem *i = recursiveLW->currentItem(); QListWidgetItem *i = recursiveLW->currentItem();
if( i == NULL ) if( i == NULL )
@ -218,7 +218,7 @@ void SettingsDialog::onRecursiveRemoveClicked()
} }
void SettingsDialog::setupConnections() void StartupSettingsDlg::setupConnections()
{ {
connect( bb, SIGNAL( accepted() ), this, SLOT( onOKClicked() ) ); connect( bb, SIGNAL( accepted() ), this, SLOT( onOKClicked() ) );
connect( bb, SIGNAL( rejected() ), this, SLOT( onCancelClicked() ) ); connect( bb, SIGNAL( rejected() ), this, SLOT( onCancelClicked() ) );

@ -14,19 +14,19 @@
// You should have received a copy of the GNU Affero General Public License // 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/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SETTINGS_DIALOG_H #ifndef STARTUP_SETTINGS_DIALOG_H
#define SETTINGS_DIALOG_H #define STARTUP_SETTINGS_DIALOG_H
#include "ui_settings_dialog.h" #include "ui_startup_settings_dlg.h"
class QSettings; class QSettings;
class SettingsDialog : public QDialog, public Ui::SettingsDialog class StartupSettingsDlg : public QDialog, public Ui::StartupSettingsDlg
{ {
Q_OBJECT Q_OBJECT
public: public:
SettingsDialog( QDialog *parent = NULL ); StartupSettingsDlg( QDialog *parent = NULL );
~SettingsDialog(); ~StartupSettingsDlg();
void setSettings( QSettings *s ){ settings = s; } void setSettings( QSettings *s ){ settings = s; }

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>SettingsDialog</class> <class>StartupSettingsDlg</class>
<widget class="QDialog" name="SettingsDialog"> <widget class="QDialog" name="StartupSettingsDlg">
<property name="windowModality"> <property name="windowModality">
<enum>Qt::ApplicationModal</enum> <enum>Qt::ApplicationModal</enum>
</property> </property>
Loading…
Cancel
Save