Changed: #1206 Update core plugin. Added IAppPage.
This commit is contained in:
parent
79bf594261
commit
bcb7d15f8e
6 changed files with 81 additions and 23 deletions
|
@ -0,0 +1,55 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// 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 IAPP_PAGE_H
|
||||
#define IAPP_PAGE_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Core
|
||||
{
|
||||
/**
|
||||
@interface IAppPage
|
||||
@brief The IAppPage is an interface for providing app pages in main window.
|
||||
@details You need to subclass this interface and put an instance of your subclass
|
||||
into the plugin manager object pool.
|
||||
*/
|
||||
class IAppPage
|
||||
{
|
||||
public:
|
||||
virtual ~IAppPage() {}
|
||||
|
||||
/// id() is a unique identifier for referencing this page
|
||||
virtual QString id() const = 0;
|
||||
|
||||
/// trName() is the (translated) name for display.
|
||||
virtual QString trName() const = 0;
|
||||
|
||||
/// icon() is the icon for display
|
||||
virtual QIcon icon() const = 0;
|
||||
|
||||
/// The widget will be destroyed by the widget hierarchy when the main window closes
|
||||
virtual QWidget *widget(QWidget *parent) = 0;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Q_DECLARE_INTERFACE(Core::IAppPage, "dev.ryzom.com.IAppPage/0.1")
|
||||
|
||||
#endif // IAPP_PAGE_H
|
|
@ -63,4 +63,4 @@ public:
|
|||
|
||||
Q_DECLARE_INTERFACE(Core::IOptionsPage, "dev.ryzom.com.IOptionsPage/1.0")
|
||||
|
||||
#endif // IOPTIONSPAGE_H
|
||||
#endif // IOPTIONS_PAGE_H
|
||||
|
|
|
@ -17,9 +17,12 @@
|
|||
|
||||
// Project includes
|
||||
#include "main_window.h"
|
||||
#include "iapp_page.h"
|
||||
#include "core_constants.h"
|
||||
#include "settings_dialog.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
// Qt includes
|
||||
#include <QtGui/QtGui>
|
||||
|
||||
|
@ -37,23 +40,24 @@ CMainWindow::CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget
|
|||
_tabWidget = new QTabWidget(this);
|
||||
setCentralWidget(_tabWidget);
|
||||
|
||||
QWidget *qwidg1 = new QWidget(_tabWidget);
|
||||
QWidget *qwidg2 = new QWidget(_tabWidget);
|
||||
QList<QObject *> listObjects = _pluginManager->allObjects();
|
||||
QList<IAppPage *> listAppPages;
|
||||
Q_FOREACH(QObject *obj, listObjects)
|
||||
{
|
||||
IAppPage *appPage = dynamic_cast<IAppPage *>(obj);
|
||||
if (appPage)
|
||||
listAppPages.append(appPage);
|
||||
}
|
||||
|
||||
_tabWidget->addTab(qwidg1, "tab1");
|
||||
_tabWidget->addTab(qwidg2, "tab2");
|
||||
|
||||
|
||||
QGridLayout *gridLayout = new QGridLayout(qwidg1);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
NLQT::QNLWidget *_nelWidget = new NLQT::QNLWidget(qwidg1);
|
||||
_nelWidget->setObjectName(QString::fromUtf8("NELWIdget1"));
|
||||
gridLayout->addWidget(_nelWidget, 0, 0, 1, 1);
|
||||
|
||||
QGridLayout *gridLayout2 = new QGridLayout(qwidg2);
|
||||
NLQT::QNLWidget *_nelWidget2 = new NLQT::QNLWidget(qwidg2);
|
||||
_nelWidget2->setObjectName(QString::fromUtf8("NELWIdget2"));
|
||||
gridLayout2->addWidget(_nelWidget2, 0, 0, 1, 1);
|
||||
Q_FOREACH(IAppPage *appPage, listAppPages)
|
||||
{
|
||||
QWidget *tabWidget = new QWidget(_tabWidget);
|
||||
_tabWidget->addTab(tabWidget, appPage->icon(), appPage->trName());
|
||||
QGridLayout *gridLayout = new QGridLayout(tabWidget);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout_") + appPage->id());
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
gridLayout->addWidget(appPage->widget(tabWidget), 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
setDockNestingEnabled(true);
|
||||
|
||||
|
|
|
@ -55,8 +55,7 @@ void QNLWidget::init()
|
|||
nlassert(_driver);
|
||||
|
||||
// initialize the nel 3d viewport
|
||||
_driver->setDisplay((nlWindow)winId(),
|
||||
NL3D::UDriver::CMode(width(), height(), 32));
|
||||
_driver->setDisplay((nlWindow)winId(), NL3D::UDriver::CMode(width(), height(), 32));
|
||||
|
||||
// set the cache size for the font manager(in bytes)
|
||||
_driver->setFontManagerMaxMemory(2097152);
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Core
|
|||
/**
|
||||
@class CSearchPathsSettingsPage
|
||||
*/
|
||||
class CSearchPathsSettingsPage : public QObject, public Core::IOptionsPage
|
||||
class CSearchPathsSettingsPage : public QObject, public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Core::IOptionsPage)
|
||||
|
|
Loading…
Reference in a new issue