|
|
@ -37,6 +37,7 @@ CMainWindow::CMainWindow(CorePlugin *corePlugin, QWidget *parent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_corePlugin = corePlugin;
|
|
|
|
_corePlugin = corePlugin;
|
|
|
|
_pluginManager = _corePlugin->pluginManager();
|
|
|
|
_pluginManager = _corePlugin->pluginManager();
|
|
|
|
|
|
|
|
_settings = _pluginManager->settings();
|
|
|
|
|
|
|
|
|
|
|
|
setObjectName(Constants::MAIN_WINDOW);
|
|
|
|
setObjectName(Constants::MAIN_WINDOW);
|
|
|
|
|
|
|
|
|
|
|
@ -48,12 +49,7 @@ CMainWindow::CMainWindow(CorePlugin *corePlugin, QWidget *parent)
|
|
|
|
|
|
|
|
|
|
|
|
Q_FOREACH(IAppPage *appPage, listAppPages)
|
|
|
|
Q_FOREACH(IAppPage *appPage, listAppPages)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QWidget *tabWidget = new QWidget(_tabWidget);
|
|
|
|
addAppPage(appPage);
|
|
|
|
_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(), 0, 0, 1, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setDockNestingEnabled(true);
|
|
|
|
setDockNestingEnabled(true);
|
|
|
@ -65,8 +61,12 @@ CMainWindow::CMainWindow(CorePlugin *corePlugin, QWidget *parent)
|
|
|
|
createMenus();
|
|
|
|
createMenus();
|
|
|
|
createStatusBar();
|
|
|
|
createStatusBar();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readSettings();
|
|
|
|
|
|
|
|
|
|
|
|
setWindowIcon(QIcon(Constants::ICON_NEL));
|
|
|
|
setWindowIcon(QIcon(Constants::ICON_NEL));
|
|
|
|
setWindowTitle(tr("Object Viewer Qt"));
|
|
|
|
setWindowTitle(tr("Object Viewer Qt"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(_pluginManager, SIGNAL(objectAdded(QObject *)), this, SLOT(checkObject(QObject *)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CMainWindow::~CMainWindow()
|
|
|
|
CMainWindow::~CMainWindow()
|
|
|
@ -74,6 +74,13 @@ CMainWindow::~CMainWindow()
|
|
|
|
delete _pluginView;
|
|
|
|
delete _pluginView;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CMainWindow::checkObject(QObject *obj)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IAppPage *appPage = qobject_cast<IAppPage *>(obj);
|
|
|
|
|
|
|
|
if (appPage)
|
|
|
|
|
|
|
|
addAppPage(appPage);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CMainWindow::showOptionsDialog(const QString &group,
|
|
|
|
bool CMainWindow::showOptionsDialog(const QString &group,
|
|
|
|
const QString &page,
|
|
|
|
const QString &page,
|
|
|
|
QWidget *parent)
|
|
|
|
QWidget *parent)
|
|
|
@ -103,9 +110,22 @@ void CMainWindow::closeEvent(QCloseEvent *event)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
writeSettings();
|
|
|
|
|
|
|
|
|
|
|
|
QMainWindow::closeEvent(event);
|
|
|
|
QMainWindow::closeEvent(event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CMainWindow::addAppPage(IAppPage *appPage)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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(), 0, 0, 1, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMainWindow::createActions()
|
|
|
|
void CMainWindow::createActions()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_openAction = new QAction(tr("&Open..."), this);
|
|
|
|
_openAction = new QAction(tr("&Open..."), this);
|
|
|
@ -177,6 +197,22 @@ void CMainWindow::createDialogs()
|
|
|
|
_pluginView = new ExtensionSystem::CPluginView(_pluginManager, this);
|
|
|
|
_pluginView = new ExtensionSystem::CPluginView(_pluginManager, this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CMainWindow::readSettings()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_settings->beginGroup("MainWindowSettings");
|
|
|
|
|
|
|
|
restoreState(_settings->value("QtWindowState").toByteArray());
|
|
|
|
|
|
|
|
restoreGeometry(_settings->value("QtWindowGeometry").toByteArray());
|
|
|
|
|
|
|
|
_settings->endGroup();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CMainWindow::writeSettings()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_settings->beginGroup("MainWindowSettings");
|
|
|
|
|
|
|
|
_settings->setValue("QtWindowState", saveState());
|
|
|
|
|
|
|
|
_settings->setValue("QtWindowGeometry", saveGeometry());
|
|
|
|
|
|
|
|
_settings->endGroup();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} /* namespace Core */
|
|
|
|
} /* namespace Core */
|
|
|
|
|
|
|
|
|
|
|
|
/* end of file */
|
|
|
|
/* end of file */
|
|
|
|