mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Fixed: #1190 Run Georges Editor Qt on Mac OS X
This commit is contained in:
parent
d145c48e15
commit
39aa4ad2df
5 changed files with 76 additions and 37 deletions
|
@ -17,7 +17,7 @@ QT4_WRAP_CPP( OBJECT_VIEWER_WIDGET_MOC_SRCS ${OBJECT_VIEWER_WIDGET_HDR} )
|
||||||
|
|
||||||
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OBJECT_VIEWER_WIDGET_MOC_SRCS})
|
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OBJECT_VIEWER_WIDGET_MOC_SRCS})
|
||||||
|
|
||||||
ADD_LIBRARY(object_viewer_widget_qt SHARED
|
ADD_LIBRARY(object_viewer_widget_qt MODULE
|
||||||
${OBJECT_VIEWER_WIDGET_SRC}
|
${OBJECT_VIEWER_WIDGET_SRC}
|
||||||
${OBJECT_VIEWER_WIDGET_MOC_SRCS})
|
${OBJECT_VIEWER_WIDGET_MOC_SRCS})
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ namespace NLQT
|
||||||
CObjectViewerWidget(QWidget *parent = 0);
|
CObjectViewerWidget(QWidget *parent = 0);
|
||||||
virtual ~CObjectViewerWidget();
|
virtual ~CObjectViewerWidget();
|
||||||
|
|
||||||
|
virtual QPaintEngine* paintEngine() const { return NULL; }
|
||||||
|
|
||||||
void setNelContext(NLMISC::INelContext &nelContext);
|
void setNelContext(NLMISC::INelContext &nelContext);
|
||||||
|
|
||||||
static CObjectViewerWidget &objViewWid() { return *_objectViewerWidget; }
|
static CObjectViewerWidget &objViewWid() { return *_objectViewerWidget; }
|
||||||
|
|
|
@ -24,6 +24,17 @@ SOURCE_GROUP(QtResources FILES ${GEORGES_EDITOR_UIS} ${GEORGES_EDITOR_RCS})
|
||||||
SOURCE_GROUP(QtGeneratedUiHdr FILES ${GEORGES_EDITOR_UI_HDRS})
|
SOURCE_GROUP(QtGeneratedUiHdr FILES ${GEORGES_EDITOR_UI_HDRS})
|
||||||
SOURCE_GROUP(QtGeneratedMocSrc FILES ${GEORGES_EDITOR_MOC_SRCS})
|
SOURCE_GROUP(QtGeneratedMocSrc FILES ${GEORGES_EDITOR_MOC_SRCS})
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
SET(MACOSX_BUNDLE_INFO_STRING "Georges Editor Qt")
|
||||||
|
SET(MACOSX_BUNDLE_ICON_FILE "georges_logo.icns")
|
||||||
|
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "")
|
||||||
|
SET(MACOSX_BUNDLE_LONG_VERSION_STRING ${NL_VERSION})
|
||||||
|
SET(MACOSX_BUNDLE_BUNDLE_NAME "Georges Editor Qt")
|
||||||
|
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "0.9")
|
||||||
|
SET(MACOSX_BUNDLE_BUNDLE_VERSION "0.9")
|
||||||
|
SET(MACOSX_BUNDLE_COPYRIGHT "Winchgate and The Ryzom Core Community")
|
||||||
|
ENDIF(APPLE)
|
||||||
|
|
||||||
ADD_EXECUTABLE(georges_editor_qt WIN32 MACOSX_BUNDLE ${GEORGES_EDITOR_SRC} ${GEORGES_EDITOR_MOC_SRCS} ${GEORGES_EDITOR_RC_SRCS} ${GEORGES_EDITOR_UI_HDRS})
|
ADD_EXECUTABLE(georges_editor_qt WIN32 MACOSX_BUNDLE ${GEORGES_EDITOR_SRC} ${GEORGES_EDITOR_MOC_SRCS} ${GEORGES_EDITOR_RC_SRCS} ${GEORGES_EDITOR_UI_HDRS})
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(georges_editor_qt
|
TARGET_LINK_LIBRARIES(georges_editor_qt
|
||||||
|
|
|
@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#include <nel/misc/debug.h>
|
||||||
|
|
||||||
NLQT::CConfiguration *Modules::_configuration = NULL;
|
NLQT::CConfiguration *Modules::_configuration = NULL;
|
||||||
NLQT::IObjectViewer *Modules::_objViewerInterface = NULL;
|
NLQT::IObjectViewer *Modules::_objViewerInterface = NULL;
|
||||||
NLQT::CMainWindow *Modules::_mainWindow = NULL;
|
NLQT::CMainWindow *Modules::_mainWindow = NULL;
|
||||||
|
@ -49,28 +51,53 @@ void Modules::release()
|
||||||
|
|
||||||
bool Modules::loadPlugin()
|
bool Modules::loadPlugin()
|
||||||
{
|
{
|
||||||
QDir pluginsDir(qApp->applicationDirPath());
|
#if defined(Q_OS_WIN)
|
||||||
/*#if defined(Q_OS_WIN)
|
QString pluginPath = qApp->applicationDirPath();
|
||||||
if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release")
|
QString pluginFilename = "object_viewer_widget_qt.dll";
|
||||||
pluginsDir.cdUp();
|
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
if (pluginsDir.dirName() == "MacOS") {
|
QString pluginPath = qApp->applicationDirPath() + "/../PlugIns/";
|
||||||
pluginsDir.cdUp();
|
QString pluginFilename = "libobject_viewer_widget_qt.so";
|
||||||
pluginsDir.cdUp();
|
#else // LINUX
|
||||||
pluginsDir.cdUp();
|
QString pluginPath = qApp->applicationDirPath();
|
||||||
}
|
QString pluginFilename = "libobject_viewer_widget_qt.so";
|
||||||
#endif*/
|
#endif
|
||||||
//pluginsDir.cd("plugins");
|
|
||||||
//Q_FOREACH (QString fileName, pluginsDir.entryList(QDir::Files)) {
|
// if(!QFile::exists(pluginPath + pluginFilename))
|
||||||
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath("object_viewer_widget_qt.dll"));
|
// {
|
||||||
|
// nlwarning("Cannot find %s in %s, fallback to working dir",
|
||||||
|
// pluginFilename.toStdString().c_str(), pluginPath.toStdString().c_str());
|
||||||
|
//
|
||||||
|
// pluginPath = "";
|
||||||
|
//
|
||||||
|
// Q_FOREACH (QString path, qApp->libraryPaths())
|
||||||
|
// nlwarning("libraryPaths %s", path.toStdString().c_str());
|
||||||
|
// }
|
||||||
|
|
||||||
|
QDir pluginsDir(pluginPath);
|
||||||
|
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(pluginFilename));
|
||||||
|
|
||||||
QObject *plugin = pluginLoader.instance();
|
QObject *plugin = pluginLoader.instance();
|
||||||
if (plugin)
|
if (plugin)
|
||||||
{
|
{
|
||||||
_objViewerInterface = qobject_cast<NLQT::IObjectViewer *>(plugin);
|
_objViewerInterface = qobject_cast<NLQT::IObjectViewer *>(plugin);
|
||||||
if (_objViewerInterface)
|
if (_objViewerInterface)
|
||||||
|
{
|
||||||
|
nlinfo("Loaded %s",
|
||||||
|
pluginsDir.absoluteFilePath(pluginFilename).toStdString().c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//}
|
else
|
||||||
|
{
|
||||||
|
nlwarning("Loaded %s, but cannot cast to NLQT::IObjectViewer*",
|
||||||
|
pluginFilename.toStdString().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlwarning("Cannot get plugin instance for %s (searched in %s)",
|
||||||
|
pluginFilename.toStdString().c_str(),
|
||||||
|
(qApp->applicationDirPath() + pluginPath).toStdString().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
|
@ -59,7 +59,6 @@ namespace NLQT
|
||||||
~CObjectViewerDialog();
|
~CObjectViewerDialog();
|
||||||
|
|
||||||
virtual void setVisible(bool visible);
|
virtual void setVisible(bool visible);
|
||||||
virtual QPaintEngine* paintEngine() const { return NULL; }
|
|
||||||
|
|
||||||
QAction *createSaveScreenshotAction(QObject *parent);
|
QAction *createSaveScreenshotAction(QObject *parent);
|
||||||
QAction *createSetBackgroundColor(QObject *parent);
|
QAction *createSetBackgroundColor(QObject *parent);
|
||||||
|
|
Loading…
Reference in a new issue