1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

GCS/coreplugin: Move creation of uavgadget modes to extensionsInitialized() + add index to IUAVGadget

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@336 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
ephy 2010-03-19 15:23:36 +00:00 committed by ephy
parent c4dc8ca9c1
commit 5b4fced510
2 changed files with 21 additions and 15 deletions

View File

@ -62,27 +62,29 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
Q_UNUSED(arguments)
const bool success = m_mainWindow->init(errorMessage);
if (success) {
UAVGadgetMode *uavGadgetMode;
UAVGadgetManager *m_uavGadgetManager = new UAVGadgetManager(CoreImpl::instance(), m_mainWindow);
m_uavGadgetManager->hide();
uavGadgetMode = new UAVGadgetMode(m_uavGadgetManager, QString("Mode 1"),
QIcon(":/core/images/openpilot_logo_64.png"), 80, QString("Mode1"));
m_uavGadgetManager->setUAVGadgetMode(uavGadgetMode);
m_uavGadgetModes.append(uavGadgetMode);
addObject(uavGadgetMode);
m_uavGadgetManager = new UAVGadgetManager(CoreImpl::instance(), m_mainWindow);
m_uavGadgetManager->hide();
uavGadgetMode = new UAVGadgetMode(m_uavGadgetManager, QString("Mode 2"),
QIcon(":/core/images/plus.png"), 60, QString("Mode2"));
m_uavGadgetManager->setUAVGadgetMode(uavGadgetMode);
m_uavGadgetModes.append(uavGadgetMode);
addObject(uavGadgetMode);
// nothing right now
}
return success;
}
void CorePlugin::extensionsInitialized()
{
UAVGadgetMode *uavGadgetMode;
UAVGadgetManager *m_uavGadgetManager = new UAVGadgetManager(CoreImpl::instance(), m_mainWindow);
m_uavGadgetManager->hide();
uavGadgetMode = new UAVGadgetMode(m_uavGadgetManager, QString("Mode 1"),
QIcon(":/core/images/openpilot_logo_64.png"), 90, QString("Mode1"));
m_uavGadgetManager->setUAVGadgetMode(uavGadgetMode);
m_uavGadgetModes.append(uavGadgetMode);
addObject(uavGadgetMode);
m_uavGadgetManager = new UAVGadgetManager(CoreImpl::instance(), m_mainWindow);
m_uavGadgetManager->hide();
uavGadgetMode = new UAVGadgetMode(m_uavGadgetManager, QString("Mode 2"),
QIcon(":/core/images/plus.png"), 60, QString("Mode2"));
m_uavGadgetManager->setUAVGadgetMode(uavGadgetMode);
m_uavGadgetModes.append(uavGadgetMode);
addObject(uavGadgetMode);
m_mainWindow->extensionsInitialized();
}

View File

@ -53,6 +53,10 @@ public:
// virtual void loadConfiguration(QString ) = 0;
// virtual QStringList getConfigurationNames() = 0;
virtual QWidget *toolBar() = 0;
virtual void setIndex(int index) { m_index = index; }
virtual int index() { return m_index; }
private:
int m_index;
};
} // namespace Core