Changed: #1193 Updated core plugin. Added the plugin-spec file.

This commit is contained in:
dnk-88 2011-09-26 01:25:10 +03:00
parent 57a29f9ccd
commit 03a9b9455c
21 changed files with 233 additions and 312 deletions

View file

@ -17,7 +17,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "core.h"
#include "imenu_manager.h"
#include "context_manager.h"
#include "main_window.h"
#include "../../extension_system/iplugin_manager.h"
@ -50,7 +49,7 @@ bool CoreImpl::showOptionsDialog(const QString &group,
return m_mainWindow->showOptionsDialog(group, page, parent);
}
IMenuManager *CoreImpl::menuManager() const
MenuManager *CoreImpl::menuManager() const
{
return m_mainWindow->menuManager();
}

View file

@ -37,7 +37,7 @@ public:
const QString &page = QString(),
QWidget *parent = 0);
virtual IMenuManager *menuManager() const;
virtual MenuManager *menuManager() const;
virtual ContextManager *contextManager() const;
virtual QSettings *settings() const;

View file

@ -23,97 +23,97 @@ namespace Core
namespace Constants
{
const char * const OVQT_VERSION_LONG = "0.1";
const char * const OVQT_VENDOR = "Ryzom Core";
const char * const OVQT_YEAR = "2010, 2011";
const char * const OVQT_CORE_PLUGIN = "Core";
const char *const OVQT_VERSION_LONG = "0.8";
const char *const OVQT_VENDOR = "Ryzom Core";
const char *const OVQT_YEAR = "2010, 2011";
const char *const OVQT_CORE_PLUGIN = "Core";
//mainwindow
const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow";
const char *const MAIN_WINDOW = "ObjectViewerQt.MainWindow";
//menubar
const char * const MENU_BAR = "ObjectViewerQt.MenuBar";
const char *const MENU_BAR = "ObjectViewerQt.MenuBar";
//menus
const char * const M_FILE = "ObjectViewerQt.Menu.File";
const char * const M_EDIT = "ObjectViewerQt.Menu.Edit";
const char * const M_VIEW = "ObjectViewerQt.Menu.View";
const char * const M_SCENE = "ObjectViewerQt.Menu.Scene";
const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools";
const char * const M_WINDOW = "ObjectViewerQt.Menu.Window";
const char * const M_HELP = "ObjectViewerQt.Menu.Help";
const char *const M_FILE = "ObjectViewerQt.Menu.File";
const char *const M_EDIT = "ObjectViewerQt.Menu.Edit";
const char *const M_VIEW = "ObjectViewerQt.Menu.View";
const char *const M_SCENE = "ObjectViewerQt.Menu.Scene";
const char *const M_TOOLS = "ObjectViewerQt.Menu.Tools";
const char *const M_WINDOW = "ObjectViewerQt.Menu.Window";
const char *const M_HELP = "ObjectViewerQt.Menu.Help";
const char * const M_FILE_RECENTFILES = "ObjectViewerQt.Menu.File.RecentFiles";
const char * const M_SHEET = "ObjectViewerQt.Menu.Sheet";
const char *const M_FILE_RECENTFILES = "ObjectViewerQt.Menu.File.RecentFiles";
const char *const M_SHEET = "ObjectViewerQt.Menu.Sheet";
//actions
const char * const NEW = "ObjectViewerQt.New";
const char * const OPEN = "ObjectViewerQt.Open";
const char * const SAVE = "ObjectViewerQt.Save";
const char * const SAVE_AS = "ObjectViewerQt.SaveAs";
const char * const SAVE_ALL = "ObjectViewerQt.SaveAll";
const char * const EXIT = "ObjectViewerQt.Exit";
const char *const NEW = "ObjectViewerQt.New";
const char *const OPEN = "ObjectViewerQt.Open";
const char *const SAVE = "ObjectViewerQt.Save";
const char *const SAVE_AS = "ObjectViewerQt.SaveAs";
const char *const SAVE_ALL = "ObjectViewerQt.SaveAll";
const char *const EXIT = "ObjectViewerQt.Exit";
const char * const UNDO = "ObjectViewerQt.Undo";
const char * const REDO = "ObjectViewerQt.Redo";
const char * const CUT = "ObjectViewerQt.Cut";
const char * const COPY = "ObjectViewerQt.Copy";
const char * const PASTE = "ObjectViewerQt.Paste";
const char * const DEL = "ObjectViewerQt.Del";
const char * const FIND = "ObjectViewerQt.Find";
const char * const SELECT_ALL = "ObjectViewerQt.SelectAll";
const char * const GOTO_POS = "ObjectViewerQt.Goto";
const char *const UNDO = "ObjectViewerQt.Undo";
const char *const REDO = "ObjectViewerQt.Redo";
const char *const CUT = "ObjectViewerQt.Cut";
const char *const COPY = "ObjectViewerQt.Copy";
const char *const PASTE = "ObjectViewerQt.Paste";
const char *const DEL = "ObjectViewerQt.Del";
const char *const FIND = "ObjectViewerQt.Find";
const char *const SELECT_ALL = "ObjectViewerQt.SelectAll";
const char *const GOTO_POS = "ObjectViewerQt.Goto";
const char * const SETTINGS = "ObjectViewerQt.Settings";
const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen";
const char *const SETTINGS = "ObjectViewerQt.Settings";
const char *const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen";
const char * const CLOSE = "ObjectViewerQt.Close";
const char * const CLOSEALL = "ObjectViewerQt.CloseAll";
const char * const CLOSEOTHERS = "ObjectViewerQt.CloseOthers";
const char * const ABOUT = "ObjectViewerQt.About";
const char * const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins";
const char * const ABOUT_QT = "ObjectViewerQt.AboutQt";
const char *const CLOSE = "ObjectViewerQt.Close";
const char *const CLOSEALL = "ObjectViewerQt.CloseAll";
const char *const CLOSEOTHERS = "ObjectViewerQt.CloseOthers";
const char *const ABOUT = "ObjectViewerQt.About";
const char *const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins";
const char *const ABOUT_QT = "ObjectViewerQt.AboutQt";
//settings
const char * const SETTINGS_CATEGORY_GENERAL = "general";
const char * const SETTINGS_CATEGORY_GENERAL_ICON = ":/icons/ic_nel_generic_settings.png";
const char * const SETTINGS_TR_CATEGORY_GENERAL = QT_TR_NOOP("General");
const char *const SETTINGS_CATEGORY_GENERAL = "general";
const char *const SETTINGS_CATEGORY_GENERAL_ICON = ":/icons/ic_nel_generic_settings.png";
const char *const SETTINGS_TR_CATEGORY_GENERAL = QT_TR_NOOP("General");
const char * const MAIN_WINDOW_SECTION = "MainWindow";
const char * const MAIN_WINDOW_STATE = "WindowState";
const char * const MAIN_WINDOW_GEOMETRY = "WindowGeometry";
const char * const QT_STYLE = "QtStyle";
const char * const QT_PALETTE = "QtPalette";
const char *const MAIN_WINDOW_SECTION = "MainWindow";
const char *const MAIN_WINDOW_STATE = "WindowState";
const char *const MAIN_WINDOW_GEOMETRY = "WindowGeometry";
const char *const QT_STYLE = "QtStyle";
const char *const QT_PALETTE = "QtPalette";
const char * const LANGUAGE = "Language";
const char * const PLUGINS_PATH = "PluginPath";
const char * const DATA_PATH_SECTION = "DataPath";
const char * const SEARCH_PATHS = "SearchPaths";
const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes";
const char * const LEVELDESIGN_PATH = "LevelDesignPath";
const char * const ASSETS_PATH = "AssetsPath";
const char * const PRIMITIVES_PATH = "PrimitivesPath";
const char * const LIGOCONFIG_FILE = "LigoConfigFile";
const char * const REMAP_EXTENSIONS = "RemapExtensions";
const char *const LANGUAGE = "Language";
const char *const PLUGINS_PATH = "PluginPath";
const char *const DATA_PATH_SECTION = "DataPath";
const char *const SEARCH_PATHS = "SearchPaths";
const char *const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes";
const char *const LEVELDESIGN_PATH = "LevelDesignPath";
const char *const ASSETS_PATH = "AssetsPath";
const char *const PRIMITIVES_PATH = "PrimitivesPath";
const char *const LIGOCONFIG_FILE = "LigoConfigFile";
const char *const REMAP_EXTENSIONS = "RemapExtensions";
const char * const LOG_SECTION = "LogSettings";
const char * const LOG_ERROR = "LogError";
const char * const LOG_WARNING = "LogWarning";
const char * const LOG_DEBUG = "LogDebug";
const char * const LOG_ASSERT = "LogAssert";
const char * const LOG_INFO = "LogInfo";
const char *const LOG_SECTION = "LogSettings";
const char *const LOG_ERROR = "LogError";
const char *const LOG_WARNING = "LogWarning";
const char *const LOG_DEBUG = "LogDebug";
const char *const LOG_ASSERT = "LogAssert";
const char *const LOG_INFO = "LogInfo";
//resources
const char * const ICON_NEL = ":/core/images/nel.png";
const char * const ICON_SETTINGS = ":/core/images/preferences.png";
const char * const ICON_PILL = ":/core/icons/ic_nel_pill.png";
const char * const ICON_OPEN = ":/core/icons/ic_nel_open.png";
const char * const ICON_NEW = ":/core/icons/ic_nel_new.png";
const char * const ICON_SAVE = ":/core/icons/ic_nel_save.png";
const char * const ICON_SAVE_AS = ":/core/icons/ic_nel_save_as.png";
const char * const ICON_CRASH = ":/core/icons/ic_nel_crash.png";
const char * const ICON_UNDO = ":/core/icons/ic_nel_undo.png";
const char * const ICON_REDO = ":/core/icons/ic_nel_redo.png";
const char *const ICON_NEL = ":/core/images/nel.png";
const char *const ICON_SETTINGS = ":/core/images/preferences.png";
const char *const ICON_PILL = ":/core/icons/ic_nel_pill.png";
const char *const ICON_OPEN = ":/core/icons/ic_nel_open.png";
const char *const ICON_NEW = ":/core/icons/ic_nel_new.png";
const char *const ICON_SAVE = ":/core/icons/ic_nel_save.png";
const char *const ICON_SAVE_AS = ":/core/icons/ic_nel_save_as.png";
const char *const ICON_CRASH = ":/core/icons/ic_nel_crash.png";
const char *const ICON_UNDO = ":/core/icons/ic_nel_undo.png";
const char *const ICON_REDO = ":/core/icons/ic_nel_redo.png";
} // namespace Constants
} // namespace Core

View file

@ -64,8 +64,8 @@ bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QStr
bool success = m_mainWindow->initialize(errorString);
GeneralSettingsPage *generalSettings = new GeneralSettingsPage(this);
CSearchPathsSettingsPage *searchPathPage = new CSearchPathsSettingsPage(false, this);
CSearchPathsSettingsPage *recureseSearchPathPage = new CSearchPathsSettingsPage(true, this);
SearchPathsSettingsPage *searchPathPage = new SearchPathsSettingsPage(false, this);
SearchPathsSettingsPage *recureseSearchPathPage = new SearchPathsSettingsPage(true, this);
generalSettings->applyGeneralSettings();
searchPathPage->applySearchPaths();
@ -95,31 +95,6 @@ void CorePlugin::setNelContext(NLMISC::INelContext *nelContext)
m_libContext = new NLMISC::CLibraryContext(*nelContext);
}
QString CorePlugin::name() const
{
return QLatin1String(Constants::OVQT_CORE_PLUGIN);
}
QString CorePlugin::version() const
{
return Constants::OVQT_VERSION_LONG;
}
QString CorePlugin::vendor() const
{
return Constants::OVQT_VENDOR;
}
QString CorePlugin::description() const
{
return "Core plugin.";
}
QStringList CorePlugin::dependencies() const
{
return QStringList();
}
void CorePlugin::addAutoReleasedObject(QObject *obj)
{
m_plugMan->addObject(obj);

View file

@ -53,12 +53,6 @@ public:
void setNelContext(NLMISC::INelContext *nelContext);
QString name() const;
QString version() const;
QString vendor() const;
QString description() const;
QStringList dependencies() const;
void addAutoReleasedObject(QObject *obj);
ExtensionSystem::IPluginManager *pluginManager() const

View file

@ -148,25 +148,25 @@ void GeneralSettingsPage::setLevelDesignPath()
}
}
void GeneralSettingsPage::setPrimitivesPath()
{
void GeneralSettingsPage::setPrimitivesPath()
{
QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the primitives path"),
m_ui.primitivesPathLineEdit->text());
if (!newPath.isEmpty())
{
m_ui.primitivesPathLineEdit->setText(newPath);
}
}
void GeneralSettingsPage::setLigoConfigFile()
{
QString newFile = QFileDialog::getOpenFileName(0, tr("Set the ligo config file"),
m_ui.ligoConfigFileLineEdit->text());
}
}
void GeneralSettingsPage::setLigoConfigFile()
{
QString newFile = QFileDialog::getOpenFileName(0, tr("Set the ligo config file"),
m_ui.ligoConfigFileLineEdit->text());
if (!newFile.isEmpty())
{
m_ui.ligoConfigFileLineEdit->setText(newFile);
}
}
}
}
void GeneralSettingsPage::setAssetsPath()

View file

@ -35,7 +35,7 @@ class IPluginManager;
namespace Core
{
class IMenuManager;
class MenuManager;
class ContextManager;
class CORE_EXPORT ICore : public QObject
@ -52,7 +52,7 @@ public:
const QString &page = QString(),
QWidget *parent = 0) = 0;
virtual IMenuManager *menuManager() const = 0;
virtual MenuManager *menuManager() const = 0;
virtual ContextManager *contextManager() const = 0;
virtual QSettings *settings() const = 0;

View file

@ -1,62 +0,0 @@
// 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 IMENU_MANAGER_H
#define IMENU_MANAGER_H
#include "core_global.h"
#include <QtCore/QObject>
#include <QtCore/QList>
QT_BEGIN_NAMESPACE
class QMenu;
class QAction;
class QString;
class QMenuBar;
QT_END_NAMESPACE
namespace Core
{
/*
@interface IMenuManager
@brief The IMenuManager is an interface for providing a registration of menus and menu item.
@details The IMenuManager provides centralized access to menus and menu items.
All menus and menu items should be registered in the IMenuManager.
*/
class CORE_EXPORT IMenuManager : public QObject
{
Q_OBJECT
public:
IMenuManager(QObject *parent = 0): QObject(parent) {}
virtual ~IMenuManager() {}
virtual void registerMenu(QMenu *menu, const QString &id) = 0;
virtual void registerAction(QAction *action, const QString &id) = 0;
virtual QMenu *menu(const QString &id) const = 0;
virtual QAction *action(const QString &id) const = 0;
virtual void unregisterMenu(const QString &id) = 0;
virtual void unregisterAction(const QString &id) = 0;
virtual QMenuBar *menuBar() const = 0;
};
} // namespace Core
#endif // IMENU_MANAGER_H

View file

@ -65,8 +65,7 @@ MainWindow::MainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *
setMenuBar(m_menuBar);
#endif
m_menuManager = new MenuManager(this);
m_menuManager->setMenuBar(m_menuBar);
m_menuManager = new MenuManager(m_menuBar, this);
m_tabWidget = new QTabWidget(this);
m_tabWidget->setTabPosition(QTabWidget::South);
@ -114,7 +113,7 @@ void MainWindow::extensionsInitialized()
show();
}
IMenuManager *MainWindow::menuManager() const
MenuManager *MainWindow::menuManager() const
{
return m_menuManager;
}
@ -205,7 +204,7 @@ bool MainWindow::showOptionsDialog(const QString &group,
{
if (!parent)
parent = this;
CSettingsDialog settingsDialog(m_pluginManager, group, page, parent);
SettingsDialog settingsDialog(m_pluginManager, group, page, parent);
settingsDialog.show();
bool ok = settingsDialog.execDialog();
if (ok)

View file

@ -34,7 +34,6 @@ namespace Core
class CSettingsDialog;
class CorePlugin;
class IContext;
class IMenuManager;
class MenuManager;
class ContextManager;
class CoreImpl;
@ -50,7 +49,7 @@ public:
bool initialize(QString *errorString);
void extensionsInitialized();
IMenuManager *menuManager() const;
MenuManager *menuManager() const;
ContextManager *contextManager() const;
QSettings *settings() const;

View file

@ -21,74 +21,76 @@
// NeL includes
#include <nel/misc/debug.h>
// Qt includes
#include <QtGui/QMenu>
#include <QtGui/QAction>
#include <QtGui/QMenuBar>
namespace Core
{
MenuManager::MenuManager(QObject *parent)
: IMenuManager(parent),
_menuBar(0)
struct MenuManagerPrivate
{
MenuManagerPrivate(): m_menuBar(0) {}
QMenuBar *m_menuBar;
typedef QHash<QString, QMenu *> IdMenuMap;
IdMenuMap m_menuMap;
typedef QHash<QString, QAction *> IdActionMap;
IdActionMap m_actionMap;
};
MenuManager::MenuManager(QMenuBar *menuBar, QObject *parent)
: QObject(parent),
d(new MenuManagerPrivate())
{
d->m_menuBar = menuBar;
}
MenuManager::~MenuManager()
{
_menuMap.clear();
d->m_menuMap.clear();
delete d;
}
void MenuManager::registerMenu(QMenu *menu, const QString &id)
{
menu->setObjectName(id);
_menuMap.insert(id, menu);
d->m_menuMap.insert(id, menu);
}
void MenuManager::registerAction(QAction *action, const QString &id)
{
action->setObjectName(id);
_actionMap.insert(id, action);
d->m_actionMap.insert(id, action);
}
QMenu *MenuManager::menu(const QString &id) const
{
QMenu *result = 0;
if (!_menuMap.contains(id))
if (!d->m_menuMap.contains(id))
nlwarning("QMenu %s not found", id.toStdString().c_str());
else
result = _menuMap.value(id);
result = d->m_menuMap.value(id);
return result;
}
QAction *MenuManager::action(const QString &id) const
{
QAction *result = 0;
if (!_actionMap.contains(id))
if (!d->m_actionMap.contains(id))
nlwarning("QAction %s not found", id.toStdString().c_str());
else
result = _actionMap.value(id);
result = d->m_actionMap.value(id);
return result;
}
void MenuManager::unregisterMenu(const QString &id)
{
_menuMap.remove(id);
d->m_menuMap.remove(id);
}
void MenuManager::unregisterAction(const QString &id)
{
_actionMap.remove(id);
d->m_actionMap.remove(id);
}
QMenuBar *MenuManager::menuBar() const
{
return _menuBar;
}
void MenuManager::setMenuBar(QMenuBar *menuBar)
{
_menuBar = menuBar;
return d->m_menuBar;
}
} /* namespace Core */

View file

@ -19,39 +19,47 @@
#define MENU_MANAGER_H
// Project includes
#include "imenu_manager.h"
#include "core_global.h"
// Qt includes
#include <QtCore/QHash>
#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtGui/QMenu>
#include <QtGui/QAction>
#include <QtGui/QMenuBar>
namespace Core
{
struct MenuManagerPrivate;
class MenuManager : public IMenuManager
/*
@interface MenuManager
@brief The MenuManager provide the interface for registration of menus and menu item.
@details The MenuManager provides centralized access to menus and menu items.
All menus and menu items should be registered in the MenuManager.
*/
class CORE_EXPORT MenuManager: public QObject
{
Q_OBJECT
public:
MenuManager(QObject *parent = 0);
explicit MenuManager(QMenuBar *menuBar, QObject *parent = 0);
virtual ~MenuManager();
virtual void registerMenu(QMenu *menu, const QString &id);
virtual void registerAction(QAction *action, const QString &id);
void registerMenu(QMenu *menu, const QString &id);
void registerAction(QAction *action, const QString &id);
virtual QMenu *menu(const QString &id) const;
virtual QAction *action(const QString &id) const;
QMenu *menu(const QString &id) const;
QAction *action(const QString &id) const;
virtual void unregisterMenu(const QString &id);
virtual void unregisterAction(const QString &id);
void unregisterMenu(const QString &id);
void unregisterAction(const QString &id);
virtual QMenuBar *menuBar() const;
void setMenuBar(QMenuBar *menuBar);
QMenuBar *menuBar() const;
private:
QMenuBar *_menuBar;
typedef QHash<QString, QMenu *> IdMenuMap;
IdMenuMap _menuMap;
typedef QHash<QString, QAction *> IdActionMap;
IdActionMap _actionMap;
MenuManagerPrivate *d;
};
} // namespace Core

View file

@ -0,0 +1,7 @@
<plugin-spec>
<library-name>ovqt_plugin_core</library-name>
<name>Core</name>
<version>0.8</version>
<vendor>Ryzom Core</vendor>
<description>Core plugin.</description>
</plugin-spec>

View file

@ -112,7 +112,7 @@
</layout>
</widget>
<resources>
<include location="../object_viewer_qt.qrc"/>
<include location="../../object_viewer_qt.qrc"/>
</resources>
<connections>
<connection>

View file

@ -40,9 +40,9 @@ typedef struct _MARGINS
int cyBottomHeight;
} MARGINS, *PMARGINS;
typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL* pfEnabled);
typedef HRESULT (WINAPI *PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS* pMarInset);
typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind);
typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL *pfEnabled);
typedef HRESULT (WINAPI *PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset);
typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND *pBlurBehind);
typedef HRESULT (WINAPI *PtrDwmGetColorizationColor)(DWORD *pcrColorization, BOOL *pfOpaqueBlend);
static PtrDwmIsCompositionEnabled pDwmIsCompositionEnabled= 0;

View file

@ -33,18 +33,18 @@ namespace Core
QString lastDir = ".";
CSearchPathsSettingsPage::CSearchPathsSettingsPage(bool recurse, QObject *parent)
SearchPathsSettingsPage::SearchPathsSettingsPage(bool recurse, QObject *parent)
: IOptionsPage(parent),
m_recurse(recurse),
m_page(0)
{
}
CSearchPathsSettingsPage::~CSearchPathsSettingsPage()
SearchPathsSettingsPage::~SearchPathsSettingsPage()
{
}
QString CSearchPathsSettingsPage::id() const
QString SearchPathsSettingsPage::id() const
{
if (m_recurse)
return QLatin1String("search_recurse_paths");
@ -52,7 +52,7 @@ QString CSearchPathsSettingsPage::id() const
return QLatin1String("search_paths");
}
QString CSearchPathsSettingsPage::trName() const
QString SearchPathsSettingsPage::trName() const
{
if (m_recurse)
return tr("Search Recurse Paths");
@ -60,22 +60,22 @@ QString CSearchPathsSettingsPage::trName() const
return tr("Search Paths");
}
QString CSearchPathsSettingsPage::category() const
QString SearchPathsSettingsPage::category() const
{
return QLatin1String(Constants::SETTINGS_CATEGORY_GENERAL);
}
QString CSearchPathsSettingsPage::trCategory() const
QString SearchPathsSettingsPage::trCategory() const
{
return tr(Constants::SETTINGS_TR_CATEGORY_GENERAL);
}
QIcon CSearchPathsSettingsPage::categoryIcon() const
QIcon SearchPathsSettingsPage::categoryIcon() const
{
return QIcon();
}
QWidget *CSearchPathsSettingsPage::createPage(QWidget *parent)
QWidget *SearchPathsSettingsPage::createPage(QWidget *parent)
{
m_page = new QWidget(parent);
m_ui.setupUi(m_page);
@ -90,19 +90,19 @@ QWidget *CSearchPathsSettingsPage::createPage(QWidget *parent)
return m_page;
}
void CSearchPathsSettingsPage::apply()
void SearchPathsSettingsPage::apply()
{
writeSettings();
applySearchPaths();
}
void CSearchPathsSettingsPage::finish()
void SearchPathsSettingsPage::finish()
{
delete m_page;
m_page = 0;
}
void CSearchPathsSettingsPage::applySearchPaths()
void SearchPathsSettingsPage::applySearchPaths()
{
QStringList paths, remapExt;
QSettings *settings = Core::ICore::instance()->settings();
@ -124,7 +124,7 @@ void CSearchPathsSettingsPage::applySearchPaths()
}
}
void CSearchPathsSettingsPage::addPath()
void SearchPathsSettingsPage::addPath()
{
QString newPath = QFileDialog::getExistingDirectory(m_page, "", lastDir);
if (!newPath.isEmpty())
@ -139,7 +139,7 @@ void CSearchPathsSettingsPage::addPath()
checkEnabledButton();
}
void CSearchPathsSettingsPage::delPath()
void SearchPathsSettingsPage::delPath()
{
QListWidgetItem *removeItem = m_ui.pathsListWidget->takeItem(m_ui.pathsListWidget->currentRow());
if (!removeItem)
@ -148,7 +148,7 @@ void CSearchPathsSettingsPage::delPath()
checkEnabledButton();
}
void CSearchPathsSettingsPage::upPath()
void SearchPathsSettingsPage::upPath()
{
int currentRow = m_ui.pathsListWidget->currentRow();
if (!(currentRow == 0))
@ -159,7 +159,7 @@ void CSearchPathsSettingsPage::upPath()
}
}
void CSearchPathsSettingsPage::downPath()
void SearchPathsSettingsPage::downPath()
{
int currentRow = m_ui.pathsListWidget->currentRow();
if (!(currentRow == m_ui.pathsListWidget->count()-1))
@ -170,7 +170,7 @@ void CSearchPathsSettingsPage::downPath()
}
}
void CSearchPathsSettingsPage::readSettings()
void SearchPathsSettingsPage::readSettings()
{
QStringList paths;
QSettings *settings = Core::ICore::instance()->settings();
@ -189,7 +189,7 @@ void CSearchPathsSettingsPage::readSettings()
}
}
void CSearchPathsSettingsPage::writeSettings()
void SearchPathsSettingsPage::writeSettings()
{
QStringList paths;
for (int i = 0; i < m_ui.pathsListWidget->count(); ++i)
@ -205,7 +205,7 @@ void CSearchPathsSettingsPage::writeSettings()
settings->sync();
}
void CSearchPathsSettingsPage::checkEnabledButton()
void SearchPathsSettingsPage::checkEnabledButton()
{
bool bEnabled = true;
if (m_ui.pathsListWidget->count() == 0)

View file

@ -30,15 +30,15 @@ class QWidget;
namespace Core
{
/**
@class CSearchPathsSettingsPage
@class SearchPathsSettingsPage
*/
class CSearchPathsSettingsPage : public Core::IOptionsPage
class SearchPathsSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
explicit CSearchPathsSettingsPage(bool recurse, QObject *parent = 0);
~CSearchPathsSettingsPage();
explicit SearchPathsSettingsPage(bool recurse, QObject *parent = 0);
~SearchPathsSettingsPage();
QString id() const;
QString trName() const;
@ -66,7 +66,7 @@ private:
bool m_recurse;
QWidget *m_page;
Ui::CSearchPathsSettingsPage m_ui;
Ui::SearchPathsSettingsPage m_ui;
};
} // namespace Core

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CSearchPathsSettingsPage</class>
<widget class="QWidget" name="CSearchPathsSettingsPage">
<class>SearchPathsSettingsPage</class>
<widget class="QWidget" name="SearchPathsSettingsPage">
<property name="geometry">
<rect>
<x>0</x>

View file

@ -35,33 +35,33 @@ Q_DECLARE_METATYPE(PageData);
namespace Core
{
CSettingsDialog::CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager,
const QString &categoryId,
const QString &pageId,
QWidget *parent)
SettingsDialog::SettingsDialog(ExtensionSystem::IPluginManager *pluginManager,
const QString &categoryId,
const QString &pageId,
QWidget *parent)
: QDialog(parent),
_applied(false)
m_applied(false)
{
_ui.setupUi(this);
m_ui.setupUi(this);
_plugMan = pluginManager;
m_plugMan = pluginManager;
QString initialCategory = categoryId;
QString initialPage = pageId;
_ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
m_ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
connect(_ui.buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
connect(m_ui.buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
_ui.splitter->setCollapsible(1, false);
_ui.pageTree->header()->setVisible(false);
m_ui.splitter->setCollapsible(1, false);
m_ui.pageTree->header()->setVisible(false);
connect(_ui.pageTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
connect(m_ui.pageTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
this, SLOT(pageSelected()));
QMap<QString, QTreeWidgetItem *> categories;
QList<IOptionsPage *> pages = _plugMan->getObjects<IOptionsPage>();
QList<IOptionsPage *> pages = m_plugMan->getObjects<IOptionsPage>();
int index = 0;
Q_FOREACH(IOptionsPage *page, pages)
@ -82,7 +82,7 @@ CSettingsDialog::CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager,
QTreeWidgetItem *treeitem;
if (!categories.contains(currentCategory))
{
treeitem = new QTreeWidgetItem(_ui.pageTree);
treeitem = new QTreeWidgetItem(m_ui.pageTree);
treeitem->setText(0, trCategories.at(0));
treeitem->setData(0, Qt::UserRole, qVariantFromValue(pageData));
categories.insert(currentCategory, treeitem);
@ -108,13 +108,13 @@ CSettingsDialog::CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager,
categories.value(currentCategory)->addChild(item);
_pages.append(page);
_ui.stackedPages->addWidget(page->createPage(_ui.stackedPages));
m_pages.append(page);
m_ui.stackedPages->addWidget(page->createPage(m_ui.stackedPages));
if (page->id() == initialPage && currentCategory == initialCategory)
{
_ui.stackedPages->setCurrentIndex(_ui.stackedPages->count());
_ui.pageTree->setCurrentItem(item);
m_ui.stackedPages->setCurrentIndex(m_ui.stackedPages->count());
m_ui.pageTree->setCurrentItem(item);
}
index++;
@ -122,30 +122,30 @@ CSettingsDialog::CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager,
QList<int> sizes;
sizes << 150 << 300;
_ui.splitter->setSizes(sizes);
m_ui.splitter->setSizes(sizes);
_ui.splitter->setStretchFactor(_ui.splitter->indexOf(_ui.pageTree), 0);
_ui.splitter->setStretchFactor(_ui.splitter->indexOf(_ui.layoutWidget), 1);
m_ui.splitter->setStretchFactor(m_ui.splitter->indexOf(m_ui.pageTree), 0);
m_ui.splitter->setStretchFactor(m_ui.splitter->indexOf(m_ui.layoutWidget), 1);
}
CSettingsDialog::~CSettingsDialog()
SettingsDialog::~SettingsDialog()
{
}
void CSettingsDialog::pageSelected()
void SettingsDialog::pageSelected()
{
QTreeWidgetItem *item = _ui.pageTree->currentItem();
QTreeWidgetItem *item = m_ui.pageTree->currentItem();
PageData data = item->data(0, Qt::UserRole).value<PageData>();
int index = data.index;
_currentCategory = data.category;
_currentPage = data.id;
_ui.stackedPages->setCurrentIndex(index);
m_currentCategory = data.category;
m_currentPage = data.id;
m_ui.stackedPages->setCurrentIndex(index);
}
void CSettingsDialog::accept()
void SettingsDialog::accept()
{
_applied = true;
Q_FOREACH(IOptionsPage *page, _pages)
m_applied = true;
Q_FOREACH(IOptionsPage *page, m_pages)
{
page->apply();
page->finish();
@ -153,28 +153,28 @@ void CSettingsDialog::accept()
done(QDialog::Accepted);
}
void CSettingsDialog::reject()
void SettingsDialog::reject()
{
Q_FOREACH(IOptionsPage *page, _pages)
Q_FOREACH(IOptionsPage *page, m_pages)
page->finish();
done(QDialog::Rejected);
}
void CSettingsDialog::apply()
void SettingsDialog::apply()
{
Q_FOREACH(IOptionsPage *page, _pages)
Q_FOREACH(IOptionsPage *page, m_pages)
page->apply();
_applied = true;
m_applied = true;
}
bool CSettingsDialog::execDialog()
bool SettingsDialog::execDialog()
{
_applied = false;
m_applied = false;
exec();
return _applied;
return m_applied;
}
void CSettingsDialog::done(int val)
void SettingsDialog::done(int val)
{
QDialog::done(val);
}

View file

@ -35,17 +35,17 @@ class IOptionsPage;
@class CSettingsDialog
@brief Settings dialog
*/
class CSettingsDialog: public QDialog
class SettingsDialog: public QDialog
{
Q_OBJECT
public:
CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager,
const QString &initialCategory = QString(),
const QString &initialPage = QString(),
QWidget *parent = 0);
SettingsDialog(ExtensionSystem::IPluginManager *pluginManager,
const QString &initialCategory = QString(),
const QString &initialPage = QString(),
QWidget *parent = 0);
~CSettingsDialog();
~SettingsDialog();
/// Run the dialog and return true if 'Ok' was choosen or 'Apply' was invoked at least once
bool execDialog();
@ -60,14 +60,14 @@ private Q_SLOTS:
void apply();
private:
QList<IOptionsPage *> _pages;
bool _applied;
QString _currentCategory;
QString _currentPage;
QList<IOptionsPage *> m_pages;
bool m_applied;
QString m_currentCategory;
QString m_currentPage;
ExtensionSystem::IPluginManager *_plugMan;
ExtensionSystem::IPluginManager *m_plugMan;
Ui::CSettingsDialog _ui;
Ui::SettingsDialog m_ui;
}; /* class CSettingsDialog */
} /* namespace Core */

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CSettingsDialog</class>
<widget class="QDialog" name="CSettingsDialog">
<class>SettingsDialog</class>
<widget class="QDialog" name="SettingsDialog">
<property name="geometry">
<rect>
<x>0</x>
@ -93,7 +93,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>CSettingsDialog</receiver>
<receiver>SettingsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@ -109,7 +109,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>CSettingsDialog</receiver>
<receiver>SettingsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">