Fixed an issue related to the dockpalette tabs

preferencesAboutTextFull
shibakaneki 13 years ago
parent 5458a2733c
commit 7f3760aab0
  1. 2
      src/board/UBBoardPaletteManager.cpp
  2. 1
      src/gui/UBCachePropertiesWidget.cpp
  3. 1
      src/gui/UBDockDownloadWidget.cpp
  4. 56
      src/gui/UBDockPalette.cpp
  5. 6
      src/gui/UBDockPaletteWidget.h
  6. 1
      src/gui/UBLibWidget.cpp
  7. 1
      src/gui/UBPageNavigationWidget.cpp
  8. 1
      src/gui/UBTeacherBarWidget.cpp

@ -1013,6 +1013,7 @@ void UBBoardPaletteManager::startDownloads()
if(!mDownloadInProgress) if(!mDownloadInProgress)
{ {
mDownloadInProgress = true; mDownloadInProgress = true;
mpDownloadWidget->setVisibleState(true);
mRightPalette->addTab(mpDownloadWidget); mRightPalette->addTab(mpDownloadWidget);
} }
} }
@ -1022,6 +1023,7 @@ void UBBoardPaletteManager::stopDownloads()
if(mDownloadInProgress) if(mDownloadInProgress)
{ {
mDownloadInProgress = false; mDownloadInProgress = false;
mpDownloadWidget->setVisibleState(false);
mRightPalette->removeTab(mpDownloadWidget->name()); mRightPalette->removeTab(mpDownloadWidget->name());
} }
} }

@ -38,6 +38,7 @@ UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *na
setStyleSheet(UBApplication::globalStyleSheet()); setStyleSheet(UBApplication::globalStyleSheet());
mName = "CachePropWidget"; mName = "CachePropWidget";
mVisibleState = false;
mIconToLeft = QPixmap(":images/cache_open.png"); mIconToLeft = QPixmap(":images/cache_open.png");
mIconToRight = QPixmap(":images/cache_close.png"); mIconToRight = QPixmap(":images/cache_close.png");
setContentsMargins(10, 10, 10, 10); setContentsMargins(10, 10, 10, 10);

@ -20,6 +20,7 @@ UBDockDownloadWidget::UBDockDownloadWidget(QWidget *parent, const char *name):UB
, mpDLWidget(NULL) , mpDLWidget(NULL)
{ {
mName = "DownloadWidget"; mName = "DownloadWidget";
mVisibleState = false;
setAttribute(Qt::WA_StyledBackground, true); setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet()); setStyleSheet(UBApplication::globalStyleSheet());

@ -540,35 +540,35 @@ int UBDockPalette::customMargin()
* \brief Add the given tab widget * \brief Add the given tab widget
* @param widget as the given widget * @param widget as the given widget
*/ */
void UBDockPalette::addTab(UBDockPaletteWidget *widget) void UBDockPalette::addTab(UBDockPaletteWidget *widget)
{ {
if(!mTabWidgets.contains(widget)) if(!mTabWidgets.contains(widget) && widget->visibleState())
{ {
widget->setVisible(true); widget->setVisible(true);
mTabWidgets.append(widget); mTabWidgets.append(widget);
mpStackWidget->addWidget(widget); mpStackWidget->addWidget(widget);
mpStackWidget->setCurrentWidget(widget); mpStackWidget->setCurrentWidget(widget);
update(); update();
} }
} }
/** /**
* \brief Remove the given tab * \brief Remove the given tab
* @param widgetName as the tab widget name * @param widgetName as the tab widget name
*/ */
void UBDockPalette::removeTab(const QString &widgetName) void UBDockPalette::removeTab(const QString &widgetName)
{ {
for(int i = 0; i < mTabWidgets.size(); i++) for(int i = 0; i < mTabWidgets.size(); i++)
{ {
UBDockPaletteWidget* pCrntWidget = mTabWidgets.at(i); UBDockPaletteWidget* pCrntWidget = mTabWidgets.at(i);
if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName)) if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName))
{ {
mpStackWidget->removeWidget(pCrntWidget); mpStackWidget->removeWidget(pCrntWidget);
mTabWidgets.remove(i); mTabWidgets.remove(i);
pCrntWidget->hide(); pCrntWidget->hide();
update(); update();
break; break;
} }
} }
} }
/** /**
@ -600,6 +600,7 @@ void UBDockPalette::onShowTabWidget(const QString &widgetName)
UBDockPaletteWidget* pCrntWidget = mRegisteredWidgets.at(i); UBDockPaletteWidget* pCrntWidget = mRegisteredWidgets.at(i);
if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName)) if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName))
{ {
pCrntWidget->setVisibleState(true);
addTab(pCrntWidget); addTab(pCrntWidget);
break; break;
} }
@ -612,6 +613,13 @@ void UBDockPalette::onShowTabWidget(const QString &widgetName)
*/ */
void UBDockPalette::onHideTabWidget(const QString &widgetName) void UBDockPalette::onHideTabWidget(const QString &widgetName)
{ {
for(int i = 0; i < mRegisteredWidgets.size(); i++){
UBDockPaletteWidget* pCrntWidget = mRegisteredWidgets.at(i);
if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName)){
pCrntWidget->setVisibleState(false);
break;
}
}
removeTab(widgetName); removeTab(widgetName);
} }

@ -27,8 +27,9 @@ public:
void registerMode(eUBDockPaletteWidgetMode mode); void registerMode(eUBDockPaletteWidgetMode mode);
QVector<eUBDockPaletteWidgetMode> GetRegisteredModes() { return mRegisteredModes; }; QVector<eUBDockPaletteWidgetMode> GetRegisteredModes() { return mRegisteredModes; }
bool visibleState(){return mVisibleState;}
void setVisibleState(bool state){mVisibleState = state;}
signals: signals:
void hideTab(const QString& widgetName); void hideTab(const QString& widgetName);
@ -46,6 +47,7 @@ protected:
/* The current widget available mode list */ /* The current widget available mode list */
QVector<eUBDockPaletteWidgetMode> mRegisteredModes; QVector<eUBDockPaletteWidgetMode> mRegisteredModes;
bool mVisibleState;
}; };
#endif // UBDOCKPALETTEWIDGET_H #endif // UBDOCKPALETTEWIDGET_H

@ -35,6 +35,7 @@ UBLibWidget::UBLibWidget(QWidget *parent, const char *name):UBDockPaletteWidget(
{ {
setObjectName(name); setObjectName(name);
mName = "LibWidget"; mName = "LibWidget";
mVisibleState = true;
setAttribute(Qt::WA_StyledBackground, true); setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet()); setStyleSheet(UBApplication::globalStyleSheet());

@ -31,6 +31,7 @@ UBPageNavigationWidget::UBPageNavigationWidget(QWidget *parent, const char *name
{ {
setObjectName(name); setObjectName(name);
mName = "PageNavigator"; mName = "PageNavigator";
mVisibleState = true;
setAttribute(Qt::WA_StyledBackground, true); setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet()); setStyleSheet(UBApplication::globalStyleSheet());

@ -36,6 +36,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
{ {
setObjectName(name); setObjectName(name);
mName = "TeacherBarWidget"; mName = "TeacherBarWidget";
mVisibleState = true;
setAttribute(Qt::WA_StyledBackground, true); setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet()); setStyleSheet(UBApplication::globalStyleSheet());

Loading…
Cancel
Save