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)
{
mDownloadInProgress = true;
mpDownloadWidget->setVisibleState(true);
mRightPalette->addTab(mpDownloadWidget);
}
}
@ -1022,6 +1023,7 @@ void UBBoardPaletteManager::stopDownloads()
if(mDownloadInProgress)
{
mDownloadInProgress = false;
mpDownloadWidget->setVisibleState(false);
mRightPalette->removeTab(mpDownloadWidget->name());
}
}

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

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

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

@ -27,8 +27,9 @@ public:
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:
void hideTab(const QString& widgetName);
@ -46,6 +47,7 @@ protected:
/* The current widget available mode list */
QVector<eUBDockPaletteWidgetMode> mRegisteredModes;
bool mVisibleState;
};
#endif // UBDOCKPALETTEWIDGET_H

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

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

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

Loading…
Cancel
Save