Commit 3441b7b2 authored by Jan Möbius's avatar Jan Möbius

PluginLib CMakelists cleanup

Added option to debug OpenFlipperSettings

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11163 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 32c45360
......@@ -12,7 +12,7 @@ file (
"${CMAKE_SOURCE_DIR}/ObjectTypes/*/CMakeLists.txt"
)
# include all cmake files fouund for objecttypes here
# include all cmake files found for objecttypes here
foreach ( _buildInfo ${_plugin_buildinfos})
include ("${CMAKE_SOURCE_DIR}/${_buildInfo}")
endforeach ()
......@@ -34,17 +34,9 @@ link_directories (
${ADDITIONAL_PLUGINLIB_LINK_DIRS}
)
# source code directories
set (directories
../BasePlugin
../ACGHelper
../common
../threads
../common/bsp
../INIFile
../widgets/glWidget
../publicWidgets/objectSelectionWidget
)
#=======================================================
# General defines
#=======================================================
# generate dllexport macros on windows
if (WIN32)
......@@ -63,6 +55,33 @@ add_definitions (
# Mark this build part as building OpenFLippers Core
add_definitions(-DOPENFLIPPERPLUGINLIB )
#=======================================================
# Add possibility to debug OpenFlipperSettings
#=======================================================
if ( NOT DEFINED OPENFLIPPER_SETTINGS_DEBUG )
set( OPENFLIPPER_SETTINGS_DEBUG false CACHE BOOL "Enable or disable debugging of OpenFlipperSettings" )
endif()
if ( OPENFLIPPER_SETTINGS_DEBUG )
add_definitions(-DOPENFLIPPER_SETTINGS_DEBUG )
endif()
#=======================================================
# Collect files to compile
#=======================================================
# source code directories
set (directories
../BasePlugin
../ACGHelper
../common
../threads
../common/bsp
../INIFile
../widgets/glWidget
../publicWidgets/objectSelectionWidget
)
# collect all header,source and ui files
acg_append_files (headers "*.hh" ${directories})
......@@ -74,7 +93,6 @@ acg_append_files_recursive (headers "*.hh" ${CMAKE_SOURCE_DIR}/ObjectTypes)
acg_append_files_recursive (sources "*.cc" ${CMAKE_SOURCE_DIR}/ObjectTypes)
acg_append_files_recursive (ui "*.ui" ${CMAKE_SOURCE_DIR}/ObjectTypes)
# remove template cc files from source file list
acg_drop_templates (sources)
......@@ -82,6 +100,10 @@ acg_drop_templates (sources)
acg_qt4_autouic (uic_targets ${ui})
acg_qt4_automoc (moc_targets ${headers})
#=======================================================
# Create library
#=======================================================
acg_add_library (PluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})
if( ADDITIONAL_PLUGINLIB_COMPILER_FLAGS )
set_target_properties (
......@@ -90,11 +112,6 @@ if( ADDITIONAL_PLUGINLIB_COMPILER_FLAGS )
)
endif()
set (trans_files ${sources})
list (APPEND trans_files ${ui})
list (APPEND trans_files ${headers})
acg_add_translations (PluginLib "de_DE" "${trans_files}")
target_link_libraries (PluginLib
OpenMeshCore
OpenMeshTools
......@@ -106,3 +123,16 @@ target_link_libraries (PluginLib
${FTGL_LIBS}
${ADDITIONAL_PLUGINLIB_LIBS}
)
#=======================================================
# Setup translation files for PluginLib
#=======================================================
set (trans_files ${sources})
list (APPEND trans_files ${ui})
list (APPEND trans_files ${headers})
acg_add_translations (PluginLib "de_DE" "${trans_files}")
......@@ -45,9 +45,24 @@
QVariant OpenFlipperQSettings::value(const QString& key, const QVariant& defaultValue) const
{
QVariant var = QSettings::value(key, defaultValue);
if (!var.isValid())
std::cerr << "Tried loading OpenFlipper settings value for " << key.toStdString() << ", but it was not found and no default value given!" << std::endl;
QVariant var = QSettings::value(key, defaultValue);
if (!var.isValid())
std::cerr << "Tried loading OpenFlipper settings value for " << key.toStdString() << ", but it was not found and no default value given!" << std::endl;
return var;
}
\ No newline at end of file
#ifdef OPENFLIPPER_SETTINGS_DEBUG
std::cerr << "Settings: Read key " << key.toStdString() << " with value " << var.toString().toStdString() << std::endl;
#endif
return var;
}
void OpenFlipperQSettings::setValue ( const QString & key, const QVariant & value ) {
#ifdef OPENFLIPPER_SETTINGS_DEBUG
std::cerr << "Settings: Set key " << key.toStdString() << " to value " << value.toString().toStdString() << std::endl;
#endif
QSettings::setValue(key,value);
}
......@@ -50,17 +50,33 @@ class DLLEXPORT OpenFlipperQSettings : public QSettings
{
public:
explicit OpenFlipperQSettings(const QString &organization,
const QString &application = QString(), QObject *parent = 0) : QSettings(organization, application, parent) {};
OpenFlipperQSettings(QSettings::Scope scope, const QString &organization,
const QString &application = QString(), QObject *parent = 0) : QSettings(scope, organization, application, parent) {};
OpenFlipperQSettings(QSettings::Format format, QSettings::Scope scope, const QString &organization,
const QString &application = QString(), QObject *parent = 0) : QSettings (format, scope, organization, application, parent) {};
OpenFlipperQSettings(const QString &fileName, QSettings::Format format, QObject *parent = 0) : QSettings(fileName, format, parent) {};
const QString &application = QString(),
QObject *parent = 0) : QSettings(organization, application, parent) {};
OpenFlipperQSettings(QSettings::Scope scope,
const QString &organization,
const QString &application = QString(),
QObject *parent = 0) : QSettings(scope, organization, application, parent) {};
OpenFlipperQSettings(QSettings::Format format,
QSettings::Scope scope, const QString &organization,
const QString &application = QString(),
QObject *parent = 0) : QSettings (format, scope, organization, application, parent) {};
OpenFlipperQSettings(const QString &fileName,
QSettings::Format format,
QObject *parent = 0) : QSettings(fileName, format, parent) {};
explicit OpenFlipperQSettings(QObject *parent = 0) : QSettings(parent) {};
/// Wrapper function for QSettings::value() that outputs an error message to console if the key was not found and no default value given.
/// This is supposed to prevent Plugin authors from forgetting to specify the defaultValue. ;)
/// Additionally it is possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG
QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const;
/// Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG
void setValue ( const QString & key, const QVariant & value );
};
#endif // OPENFLIPPERQSETTINGS_HH
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment