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

GCS/coreplugin: Make it easier to see which view is active when toolbars are shown.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@366 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
ephy 2010-03-21 19:47:59 +00:00 committed by ephy
parent 03283b2572
commit e2fac0f91f
4 changed files with 17 additions and 1 deletions

View File

@ -322,6 +322,7 @@ void UAVGadgetManager::setCurrentUAVGadget(IUAVGadget *uavGadget)
view->update();
}
uavGadget->widget()->setFocus();
emit currentUAVGadgetChanged(uavGadget);
updateActions();
// emit currentUAVGadgetChanged(uavGadget);
}

View File

@ -108,6 +108,7 @@ public:
UAVGadgetFactoryList uavGadgetFactories() const;
signals:
void currentUAVGadgetChanged(IUAVGadget *gadget);
private slots:
void handleContextChange(Core::IContext *context);

View File

@ -71,7 +71,8 @@ UAVGadgetView::UAVGadgetView(UAVGadgetManager *uavGadgetManager, IUAVGadget *uav
m_defaultToolBar(new QWidget(this)),
m_uavGadgetList(new QComboBox),
m_closeButton(new QToolButton),
m_defaultIndex(0)
m_defaultIndex(0),
m_activeLabel(new QLabel(tr("<font color=red><b>Active</b></font>")))
{
tl = new QVBoxLayout(this);
@ -102,6 +103,8 @@ UAVGadgetView::UAVGadgetView(UAVGadgetManager *uavGadgetManager, IUAVGadget *uav
m_toolBar->setLayout(toolBarLayout);
m_toolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_activeLabel->setTextFormat(Qt::RichText);
m_closeButton->setAutoRaise(true);
m_closeButton->setIcon(QIcon(":/core/images/closebutton.png"));
@ -110,6 +113,7 @@ UAVGadgetView::UAVGadgetView(UAVGadgetManager *uavGadgetManager, IUAVGadget *uav
toplayout->setMargin(0);
toplayout->addWidget(m_uavGadgetList);
toplayout->addWidget(m_toolBar, 1); // Custom toolbar stretches
toplayout->addWidget(m_activeLabel);
toplayout->addWidget(m_closeButton);
m_top = new Utils::StyledBar;
@ -118,6 +122,7 @@ UAVGadgetView::UAVGadgetView(UAVGadgetManager *uavGadgetManager, IUAVGadget *uav
connect(m_uavGadgetList, SIGNAL(activated(int)), this, SLOT(listSelectionActivated(int)));
connect(m_closeButton, SIGNAL(clicked()), this, SLOT(closeView()), Qt::QueuedConnection);
connect(m_uavGadgetManager, SIGNAL(currentUAVGadgetChanged(IUAVGadget*)), this, SLOT(currentUAVGadgetChanged(IUAVGadget*)));
}
if (m_uavGadget) {
setUAVGadget(m_uavGadget);
@ -218,6 +223,11 @@ int UAVGadgetView::indexOfGadgetKind(QString gadgetKind)
return m_uavGadgetList->findData(gadgetKind);
}
void UAVGadgetView::currentUAVGadgetChanged(IUAVGadget *gadget)
{
(m_uavGadget == gadget) ? m_activeLabel->show() : m_activeLabel->hide();
}
SplitterOrView::SplitterOrView(UAVGadgetManager *uavGadgetManager, Core::IUAVGadget *uavGadget, bool isRoot) :
m_uavGadgetManager(uavGadgetManager),

View File

@ -77,6 +77,9 @@ public slots:
void closeView();
void listSelectionActivated(int index);
private slots:
void currentUAVGadgetChanged(IUAVGadget *gadget);
private:
void updateToolBar();
@ -91,6 +94,7 @@ private:
Utils::StyledBar *m_top;
QVBoxLayout *tl; // top layout
int m_defaultIndex;
QLabel *m_activeLabel;
};
class SplitterOrView : public QWidget