Add panoply_preview tool placeholder

--HG--
branch : qt5
hg/feature/qt5
kaetemi 10 years ago
parent fdb90b8b43
commit 6f8435de20

@ -62,6 +62,10 @@ IF(WITH_NEL_TOOLS AND WITH_3D)
ADD_SUBDIRECTORY(object_viewer_widget) ADD_SUBDIRECTORY(object_viewer_widget)
ENDIF(WITH_QT) ENDIF(WITH_QT)
IF(WITH_QT5)
ADD_SUBDIRECTORY(panoply_preview)
ENDIF()
IF(SQUISH_FOUND) IF(SQUISH_FOUND)
ADD_SUBDIRECTORY(s3tc_compressor_lib) ADD_SUBDIRECTORY(s3tc_compressor_lib)
ADD_SUBDIRECTORY(panoply_maker) ADD_SUBDIRECTORY(panoply_maker)

@ -0,0 +1,28 @@
FILE(GLOB SRCS *.cpp)
FILE(GLOB HDRS *.h)
FILE(GLOB RESOURCES *.qrc)
SOURCE_GROUP("" FILES ${SRCS} ${HDRS} ${RESOURCES})
SET(CMAKE_AUTOMOC ON)
QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES})
ADD_EXECUTABLE(nl_panoply_preview WIN32 ${SRC}
${SRCS}
${HDRS}
${RESOURCE_ADDED}
)
TARGET_LINK_LIBRARIES(nl_panoply_preview
nelmisc
nel3d
Qt5::Widgets)
NL_DEFAULT_PROPS(nl_panoply_preview "NeL, Tools, 3D: panoply_preview")
NL_ADD_RUNTIME_FLAGS(nl_panoply_preview)
QT5_USE_MODULES(nl_panoply_preview Widgets)
INSTALL(TARGETS nl_panoply_preview RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT samples3d)

@ -0,0 +1,184 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#include <nel/misc/types_nl.h>
#include "command_log.h"
// STL includes
// Qt includes
#include <QVBoxLayout>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/command.h>
#include <nel/misc/path.h>
// Project includes
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
CCommandLog::CCommandLog(QWidget *parent) : QWidget(parent)
{
m_DisplayerOutput = new QTextEdit();
m_DisplayerOutput->setReadOnly(true);
m_DisplayerOutput->setFocusPolicy(Qt::NoFocus);
m_CommandInput = new QLineEdit();
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(m_DisplayerOutput);
layout->addWidget(m_CommandInput);
setLayout(layout);
connect(m_CommandInput, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
DebugLog->addDisplayer(this);
InfoLog->addDisplayer(this);
WarningLog->addDisplayer(this);
AssertLog->addDisplayer(this);
ErrorLog->addDisplayer(this);
}
CCommandLog::~CCommandLog()
{
DebugLog->removeDisplayer(this);
InfoLog->removeDisplayer(this);
WarningLog->removeDisplayer(this);
AssertLog->removeDisplayer(this);
ErrorLog->removeDisplayer(this);
}
void CCommandLog::doDisplay(const CLog::TDisplayInfo& args, const char *message)
{
switch (args.LogType)
{
case CLog::LOG_DEBUG:
m_DisplayerOutput->setTextColor(Qt::darkGray);
break;
case CLog::LOG_STAT:
m_DisplayerOutput->setTextColor(Qt::darkGreen);
break;
case CLog::LOG_NO:
case CLog::LOG_UNKNOWN:
case CLog::LOG_INFO:
m_DisplayerOutput->setTextColor(Qt::black);
break;
case CLog::LOG_WARNING:
m_DisplayerOutput->setTextColor(Qt::darkBlue);
break;
case CLog::LOG_ERROR:
case CLog::LOG_ASSERT:
m_DisplayerOutput->setTextColor(Qt::darkRed);
break;
}
bool needSpace = false;
//stringstream ss;
string str;
if (args.LogType != CLog::LOG_NO)
{
str += logTypeToString(args.LogType);
needSpace = true;
}
// Write thread identifier
if (args.ThreadId != 0)
{
if (needSpace) { str += " "; needSpace = false; }
#ifdef NL_OS_WINDOWS
str += NLMISC::toString("%4x", args.ThreadId);
#else
str += NLMISC::toString("%08x", args.ThreadId);
#endif
needSpace = true;
}
if (args.FileName != NULL)
{
if (needSpace) { str += " "; needSpace = false; }
str += NLMISC::toString("%20s", CFile::getFilename(args.FileName).c_str());
needSpace = true;
}
if (args.Line != -1)
{
if (needSpace) { str += " "; needSpace = false; }
str += NLMISC::toString("%4u", args.Line);
//ss << setw(4) << args.Line;
needSpace = true;
}
if (args.FuncName != NULL)
{
if (needSpace) { str += " "; needSpace = false; }
str += NLMISC::toString("%20s", args.FuncName);
needSpace = true;
}
if (needSpace) { str += ": "; needSpace = false; }
uint nbl = 1;
char *npos, *pos = const_cast<char *>(message);
while ((npos = strchr (pos, '\n')))
{
*npos = '\0';
str += pos;
/*if (needSlashR)
str += "\r";*/
str += "\n";
*npos = '\n';
pos = npos+1;
nbl++;
}
str += pos;
pos = const_cast<char *>(args.CallstackAndLog.c_str());
while ((npos = strchr (pos, '\n')))
{
*npos = '\0';
str += pos;
/*if (needSlashR)
str += "\r";*/
str += "\n";
*npos = '\n';
pos = npos+1;
nbl++;
}
str += pos;
m_DisplayerOutput->append(str.substr(0, str.size() - 1).c_str());
}
void CCommandLog::returnPressed()
{
QString text = m_CommandInput->text();
if (text.isEmpty())
return;
std::string cmd = text.toLocal8Bit().data();
ICommand::execute(cmd, InfoLog());
m_CommandInput->clear();
}
} /* namespace NLTOOLS */
/* end of file */

@ -0,0 +1,70 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#ifndef NLTOOLS_COMMAND_LOG_H
#define NLTOOLS_COMMAND_LOG_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>
// NeL includes
#include <nel/misc/log.h>
#include <nel/misc/displayer.h>
// Project includes
namespace NLTOOLS {
/**
* CCommandLog
* \brief CCommandLog
* \date 2010-02-05 20:27GMT
* \author Jan BOON (jan.boon@kaetemi.be)
*/
class CCommandLog : public QWidget, public NLMISC::IDisplayer
{
Q_OBJECT
public:
CCommandLog(QWidget *parent);
virtual ~CCommandLog();
protected:
virtual void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message);
private slots:
void returnPressed();
private:
QTextEdit *m_DisplayerOutput;
QLineEdit *m_CommandInput;
private:
CCommandLog(const CCommandLog &);
CCommandLog &operator=(const CCommandLog &);
}; /* class CCommandLog */
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_COMMAND_LOG_H */
/* end of file */

@ -0,0 +1,139 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#include <nel/misc/types_nl.h>
#include "main_window.h"
// STL includes
// Qt includes
#include <QtGui>
#include <QTreeView>
#include <QDirModel>
#include <QUndoStack>
#include <QScrollArea>
#include <QApplication>
#include <QAction>
#include <QMenuBar>
#include <QMenu>
#include <QDockWidget>
#include <QToolBar>
#include <QStatusBar>
#include <QStyleFactory>
#include <QMessageBox>
// NeL includes
// #include <nel/misc/debug.h>
#include <nel/misc/i18n.h>
#include <nel/3d/u_driver.h>
// Project includes
#include "command_log.h"
#include "panoply_preview.h"
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
namespace {
QString nli18n(const char *label)
{
return QString::fromUtf16(CI18N::get(label).c_str());
}
} /* anonymous namespace */
CMainWindow::CMainWindow(const QMap<QString, QSize> &customSizeHints, QWidget *parent, Qt::WindowFlags flags)
: QMainWindow(parent, flags),
m_PanoplyPreview(NULL),
m_CommandLog(NULL), m_CommandLogDock(NULL),
m_WidgetsMenu(NULL), m_HelpMenu(NULL),
m_AboutAct(NULL)
{
setObjectName("CMainWindow");
m_PanoplyPreview = new CPanoplyPreview(this);
setCentralWidget(m_PanoplyPreview);
createActions();
createMenus();
createToolBars();
createStatusBar();
createDockWindows();
}
CMainWindow::~CMainWindow()
{
}
void CMainWindow::createActions()
{
m_AboutAct = new QAction(this);
connect(m_AboutAct, SIGNAL(triggered()), this, SLOT(about()));
m_AboutAct->setText(tr("About"));
m_AboutAct->setStatusTip(tr("About"));
}
void CMainWindow::createMenus()
{
m_WidgetsMenu = menuBar()->addMenu(QString::null);
menuBar()->addSeparator();
m_HelpMenu = menuBar()->addMenu(QString::null);
m_HelpMenu->addAction(m_AboutAct);
m_WidgetsMenu->setTitle(tr("Widgets"));
m_HelpMenu->setTitle(tr("Help"));
}
void CMainWindow::createToolBars()
{
}
void CMainWindow::createStatusBar()
{
statusBar()->showMessage(tr("Ready"));
}
void CMainWindow::createDockWindows()
{
// CommandLog (Console)
{
m_CommandLogDock = new QDockWidget(this);
m_CommandLogDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
m_CommandLog = new CCommandLog(m_CommandLogDock);
m_CommandLogDock->setWidget(m_CommandLog);
addDockWidget(Qt::BottomDockWidgetArea, m_CommandLogDock);
m_WidgetsMenu->addAction(m_CommandLogDock->toggleViewAction());
}
m_CommandLogDock->setWindowTitle(tr("Command Log"));
}
void CMainWindow::about()
{
QMessageBox::about(this, tr("Panoply Preview"), tr("Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)"));
}
} /* namespace NLTOOLS */
/* end of file */

@ -0,0 +1,90 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#ifndef NLTOOLS_MAIN_WINDOW_H
#define NLTOOLS_MAIN_WINDOW_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QMainWindow>
// NeL includes
#include <nel/misc/rgba.h>
#include <nel/misc/ucstring.h>
#include <nel/misc/time_nl.h>
#include <nel/3d/animation_time.h>
#include <nel/net/login_cookie.h>
// Project includes
// ...
class QTreeView;
class QDirModel;
class QUndoStack;
class QScrollArea;
namespace NLTOOLS {
class CCommandLog;
class CPanoplyPreview;
/**
* CMainWindow
* \brief CMainWindow
* \date 2014-09-19 09:38GMT
* \author Jan BOON (jan.boon@kaetemi.be)
*/
class CMainWindow : public QMainWindow
{
Q_OBJECT
public:
CMainWindow(const QMap<QString, QSize> &customSizeHints, QWidget *parent = 0, Qt::WindowFlags flags = 0);
virtual ~CMainWindow();
private slots:
void about();
private:
void createActions();
void createMenus();
void createToolBars();
void createStatusBar();
void createDockWindows();
private:
CMainWindow(const CMainWindow &);
CMainWindow &operator=(const CMainWindow &);
private:
CPanoplyPreview *m_PanoplyPreview;
CCommandLog *m_CommandLog;
QDockWidget *m_CommandLogDock;
QMenu *m_WidgetsMenu;
QMenu *m_HelpMenu;
QAction *m_AboutAct;
}; /* class CMainWindow */
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_MAIN_WINDOW_H */
/* end of file */

@ -0,0 +1,59 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#include <nel/misc/types_nl.h>
#include "panoply_preview.h"
// STL includes
// Qt includes
#include <QVBoxLayout>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/command.h>
#include <nel/misc/path.h>
// Project includes
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
CPanoplyPreview::CPanoplyPreview(QWidget *parent) : QWidget(parent)
{
m_DisplayerOutput = new QTextEdit();
m_DisplayerOutput->setReadOnly(true);
m_DisplayerOutput->setFocusPolicy(Qt::NoFocus);
m_CommandInput = new QLineEdit();
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(m_DisplayerOutput);
layout->addWidget(m_CommandInput);
setLayout(layout);
// connect(m_CommandInput, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
}
CPanoplyPreview::~CPanoplyPreview()
{
}
} /* namespace NLTOOLS */
/* end of file */

@ -0,0 +1,67 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#ifndef NLTOOLS_PANOPLY_PREVIEW_H
#define NLTOOLS_PANOPLY_PREVIEW_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>
// NeL includes
#include <nel/misc/log.h>
#include <nel/misc/displayer.h>
// Project includes
namespace NLTOOLS {
/**
* CPanoplyPreview
* \brief CPanoplyPreview
* \date 2014-09-19 09:38GMT
* \author Jan BOON (jan.boon@kaetemi.be)
*/
class CPanoplyPreview : public QWidget
{
Q_OBJECT
public:
CPanoplyPreview(QWidget *parent);
virtual ~CPanoplyPreview();
//private slots:
// ...
private:
QTextEdit *m_DisplayerOutput;
QLineEdit *m_CommandInput;
private:
CPanoplyPreview(const CPanoplyPreview &);
CPanoplyPreview &operator=(const CPanoplyPreview &);
}; /* class CPanoplyPreview */
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_PANOPLY_PREVIEW_H */
/* end of file */

@ -0,0 +1,105 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#ifndef NLTOOLS_CONFIG_H
#define NLTOOLS_CONFIG_H
#include <nel/misc/types_nl.h>
// use the default log.log file (not erased on use)
// #define NLTOOLS_USE_LOG_LOG false
// the config file name
// #define NLTOOLS_CONFIG_FILE "panoply_preview.cfg"
// #define NLTOOLS_CONFIG_FILE_DEFAULT "panoply_preview_default.cfg"
// use panoply_preview log file
// #define NLTOOLS_USE_LOG 1
// panoply_preview log file name
#define NLTOOLS_LOG_FILE "panoply_preview.log"
// clear panoply_preview log before use
#define NLTOOLS_ERASE_LOG true
// version number
#define NLTOOLS_VERSION "0.10.0"
// use the low fragmentation heap (windows feature)
// #define NLTOOLS_LOW_FRAGMENTATION_HEAP 1
// temporary dev tags
//#define NL_DEV_STEREO 0
//#define NL_DEV_MEMLEAK 1
//#define NL_DEV_NET 0
//#define NL_DEV_NETNEW 1
//#define NL_DEV_CG 0
//#define NL_DEV_BULLET 0
// some default defines
#if FINAL_VERSION
# if !defined(NLTOOLS_USE_LOG_LOG)
# define NLTOOLS_USE_LOG_LOG false
# endif
# if !defined(NLTOOLS_USE_LOG)
# define NLTOOLS_USE_LOG 0
# endif
#endif
#if !defined (NLTOOLS_USE_LOG_LOG)
# define NLTOOLS_USE_LOG_LOG true
#endif
#if !defined (NLTOOLS_USE_LOG)
# define NLTOOLS_USE_LOG 1
#endif
#if !defined (NLTOOLS_LOW_FRAGMENTATION_HEAP)
# ifdef NL_OS_WINDOWS
# define NLTOOLS_LOW_FRAGMENTATION_HEAP 1
# else
# define NLTOOLS_LOW_FRAGMENTATION_HEAP 0
# endif
#endif
// for compatibility with old configuration
#ifndef NLTOOLS_CONFIG_FILE
# ifndef NLTOOLS_CONFIG
# define NLTOOLS_CONFIG_FILE "panoply_preview.cfg"
# else
# define NLTOOLS_CONFIG_FILE NLTOOLS_CONFIG "panoply_preview.cfg"
# endif
#endif
#ifndef NLTOOLS_CONFIG_FILE_DEFAULT
# define NLTOOLS_CONFIG_FILE_DEFAULT "panoply_preview_default.cfg"
#endif
#endif /* #ifndef NLTOOLS_CONFIG_H */
/* end of file */

@ -0,0 +1,189 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#include <nel/misc/types_nl.h>
#include "tool_main.h"
// STL includes
#include <stdio.h>
#ifdef NL_OS_WINDOWS
# include <windows.h>
# include <direct.h>
# include <tchar.h>
#endif
// Qt includes
#include <QApplication>
#include <QtCore/QMap>
#include <QtCore/qdebug.h>
#include <QStyleFactory>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/common.h>
#include <nel/misc/file.h>
#include <nel/misc/path.h>
#include <nel/misc/command.h>
#include <nel/misc/sheet_id.h>
// Project includes
#include "tool_config.h"
#include "main_window.h"
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
namespace {
CFileDisplayer *s_FileDisplayer = NULL;
} /* anonymous namespace */
} /* namespace NLTOOLS */
void usage()
{
/* from Qt sample */
qWarning() << "Usage: mainwindow [-SizeHint<color> <width>x<height>] ...";
exit(1);
}
QMap<QString, QSize> parseCustomSizeHints(int argc, char **argv)
{
/* from Qt sample */
QMap<QString, QSize> result;
for (int i = 1; i < argc; ++i) {
QString arg = QString::fromLocal8Bit(argv[i]);
if (arg.startsWith(QLatin1String("-SizeHint"))) {
QString name = arg.mid(9);
if (name.isEmpty())
usage();
if (++i == argc)
usage();
QString sizeStr = QString::fromLocal8Bit(argv[i]);
int idx = sizeStr.indexOf(QLatin1Char('x'));
if (idx == -1)
usage();
bool ok;
int w = sizeStr.left(idx).toInt(&ok);
if (!ok)
usage();
int h = sizeStr.mid(idx + 1).toInt(&ok);
if (!ok)
usage();
result[name] = QSize(w, h);
}
}
return result;
}
#ifdef NL_OS_WINDOWS
# ifdef _UNICODE
# define tstring wstring
# else
# define tstring string
# endif
#endif
sint main(int argc, char **argv)
{
// go nel!
{
// use log.log if NEL_LOG_IN_FILE and NLTOOLS_USE_LOG_LOG defined as 1
createDebug(NULL, NLTOOLS_USE_LOG_LOG, false);
#if NLTOOLS_USE_LOG
// create toverhex_client.log
// filedisplayer only deletes the 001 etc
if (NLTOOLS_ERASE_LOG && CFile::isExists(NLTOOLS_LOG_FILE))
CFile::deleteFile(NLTOOLS_LOG_FILE);
// initialize the log file
NLTOOLS::s_FileDisplayer = new CFileDisplayer();
NLTOOLS::s_FileDisplayer->setParam(NLTOOLS_LOG_FILE, NLTOOLS_ERASE_LOG);
DebugLog->addDisplayer(NLTOOLS::s_FileDisplayer);
InfoLog->addDisplayer(NLTOOLS::s_FileDisplayer);
WarningLog->addDisplayer(NLTOOLS::s_FileDisplayer);
AssertLog->addDisplayer(NLTOOLS::s_FileDisplayer);
ErrorLog->addDisplayer(NLTOOLS::s_FileDisplayer);
#endif
nlinfo("Welcome to NeL!");
}
// low fragmentation heap (windows)
#if NLTOOLS_LOW_FRAGMENTATION_HEAP
ULONG heapFragValue = 2; // enable low fragmentation heap
if (HeapSetInformation(GetProcessHeap(),
HeapCompatibilityInformation,
&heapFragValue, sizeof(heapFragValue)))
{
nlinfo("HeapSetInformation OK!\n");
}
else
{
nlwarning("HeapSetInformation FAIL! (%d)\n", GetLastError());
}
#endif
#ifdef NL_OS_WINDOWS
HRESULT hr;
hr = hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
bool coInitOk = (hr == S_OK) || (hr == S_FALSE);
#endif
CSheetId::initWithoutSheet();
QApplication app(argc, const_cast<char **>(argv));
QApplication::setStyle(QStyleFactory::create("Fusion"));
QPalette palette = app.palette();
palette.setColor(QPalette::Window, QColor(64, 64, 64));
palette.setColor(QPalette::WindowText, Qt::white);
palette.setColor(QPalette::Base, QColor(48, 48, 48));
palette.setColor(QPalette::AlternateBase, QColor(64, 64, 64));
palette.setColor(QPalette::ToolTipBase, Qt::white);
palette.setColor(QPalette::ToolTipText, Qt::white);
palette.setColor(QPalette::Text, Qt::white);
palette.setColor(QPalette::Button, QColor(64, 64, 64));
palette.setColor(QPalette::ButtonText, Qt::white);
palette.setColor(QPalette::BrightText, Qt::red);
palette.setColor(QPalette::Highlight, QColor(64, 128, 96));
palette.setColor(QPalette::HighlightedText, Qt::white);
app.setPalette(palette);
QMap<QString, QSize> customSizeHints = parseCustomSizeHints(argc, argv);
NLTOOLS::CMainWindow mainWin(customSizeHints);
mainWin.resize(800, 600);
mainWin.show(); // calls isVisible(true)
int result = app.exec();
#ifdef NL_OS_WINDOWS
if (coInitOk) CoUninitialize();
#endif
return result;
}
/* end of file */

@ -0,0 +1,33 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// 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/>.
#ifndef NLTOOLS_MAIN_H
#define NLTOOLS_MAIN_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
namespace NLTOOLS {
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_MAIN_H */
/* end of file */
Loading…
Cancel
Save