qDebug() << __PRETTY_FUNCTION__;
m_ui->toggleProgressIndicator(false);
- m_ui->showPanels();
emit userLocationReady(user);
emit friendsLocationsReady(friendsList);
buildRoutingPanel();
m_tabbedPanel = new TabbedPanel(this);
- m_tabbedPanel->addTab(m_userInfoPanel, QIcon(":/res/images/user_info.png"));
- m_tabbedPanel->addTab(m_friendsListPanel, QIcon(":/res/images/friend_list.png"));
+ m_situareTabsIndexes.append(
+ m_tabbedPanel->addTab(m_userInfoPanel, QIcon(":/res/images/user_info.png")));
+ m_situareTabsIndexes.append(
+ m_tabbedPanel->addTab(m_friendsListPanel, QIcon(":/res/images/friend_list.png")));
m_tabbedPanel->addTab(m_routingPanel, QIcon(":/res/images/routing.png"));
connect(m_mapView, SIGNAL(viewResized(QSize)),
}
}
-void MainWindow::showPanels()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
-///< @todo check how this is called and can this method be removed
-
-// if(m_loggedIn) {
-// if(!m_friendsListPanel->isVisible()) {
-// m_friendsListPanel->show();
-// m_friendsListPanelSidebar->show();
-// }
-
-// if(!m_userPanel->isVisible()) {
-// m_userPanel->show();
-// m_userPanelSidebar->show();
-// }
-// }
-}
-
void MainWindow::startLocationSearch()
{
qDebug() << __PRETTY_FUNCTION__;
{
qDebug() << __PRETTY_FUNCTION__;
-///< @todo can this be removed?
-
-// if(!m_loggedIn) {
-// m_friendsListPanel->closePanel();
-// m_friendsListPanel->hide();
-// m_friendsListPanelSidebar->hide();
+ if (!m_loggedIn)
+ m_tabbedPanel->closePanel();
-// m_userPanel->closePanel();
-// m_userPanel->hide();
-// m_userPanelSidebar->hide();
-// }
+ m_tabbedPanel->setTabsEnabled(m_situareTabsIndexes, m_loggedIn);
}
const QString MainWindow::username()
void setUsername(const QString &username);
/**
- * @brief Method to show panels
- */
- void showPanels();
-
- /**
* @brief Public slot to intercept signal when old cerdentials are invalid or credentials
* doesn't exist yet
*/
QLabel *m_crosshair; ///< Label for center point crosshair
QLabel *m_osmLicense; ///< Label for Open Street Map license
+ QList<int> m_situareTabsIndexes; ///< List of Situare tab indexes
QList<QDialog *> m_error_queue; ///< QList type error dialog queue
QList<QDialog *> m_queue; ///< QList type dialog queue
icon().paint(&painter, m_tabRect, Qt::AlignCenter, QIcon::Selected);
else if (isChecked())
icon().paint(&painter, m_tabRect, Qt::AlignCenter, QIcon::Normal);
- else
+ else if (!isEnabled())
icon().paint(&painter, m_tabRect, Qt::AlignCenter, QIcon::Disabled);
+ else
+ icon().paint(&painter, m_tabRect, Qt::AlignCenter, QIcon::Normal);
}
emit sizeChangeRequested();
}
+
+QButtonGroup *PanelTabBar::tabs() const
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return m_tabButtonGroup;
+}
*/
void removeTab(int index);
+ /**
+ * @brief Returns all tabs.
+ *
+ * @return All tabs
+ */
+ QButtonGroup *tabs() const;
+
private:
/**
* @brief Initializes and formats tab buttons layout
USA.
*/
+#include <QAbstractButton>
+#include <QButtonGroup>
#include <QDebug>
#include <QPropertyAnimation>
#include <QRegion>
}
}
+void TabbedPanel::setTabsEnabled(const QList<int> &tabIndexes, bool enabled)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QButtonGroup *tabs = m_panelTabBar->tabs();
+
+ foreach (int tabIndex, tabIndexes) {
+
+ QAbstractButton *tabButton = tabs->button(tabIndex);
+
+ if (tabButton)
+ tabButton->setEnabled(enabled);
+ }
+}
+
void TabbedPanel::stateChanged()
{
qDebug() << __PRETTY_FUNCTION__;
*/
void removeTab(int index);
+ /**
+ * @brief Sets tabs enabled.
+ *
+ * @param tabIndexes tab indexes to set
+ * @param enabled true if should be enabled, false otherwise
+ */
+ void setTabsEnabled(const QList<int> &tabIndexes, bool enabled);
+
public slots:
/**
* @brief Slot that closes the panel