Merge branch 'Bett-2012' of github.com:Sankore/Sankore-3.1 into Bett-2012

preferencesAboutTextFull
shibakaneki 13 years ago
commit c3281a2c9e
  1. 8
      src/customWidgets/UBWidgetList.cpp
  2. 8
      src/gui/UBMediaPlayer.cpp
  3. 9
      src/gui/UBTeacherBarWidget.cpp

@ -53,6 +53,7 @@ void UBWidgetList::addWidget(QWidget *widget)
if(NULL != mpLayout){ if(NULL != mpLayout){
mpEmptyLabel->setVisible(false); mpEmptyLabel->setVisible(false);
mWidgetInfo[widget] = widget->size(); mWidgetInfo[widget] = widget->size();
qDebug() << __FUNCTION__ << "widget->size () " << widget->size();
updateView(size()); updateView(size());
mpLayout->addWidget(widget); mpLayout->addWidget(widget);
} }
@ -75,6 +76,7 @@ void UBWidgetList::removeWidget(QWidget *widget)
int UBWidgetList::scaleWidgets(QSize pSize) int UBWidgetList::scaleWidgets(QSize pSize)
{ {
int result = 0; int result = 0;
int count = 0;
foreach(QWidget* eachWidget, mWidgetInfo.keys()){ foreach(QWidget* eachWidget, mWidgetInfo.keys()){
qreal scaleFactor = 0; qreal scaleFactor = 0;
int newWidgetWidth = pSize.width(); int newWidgetWidth = pSize.width();
@ -89,6 +91,12 @@ int UBWidgetList::scaleWidgets(QSize pSize)
newWidgetWidth = mWidgetInfo[eachWidget].width()/scaleFactor; newWidgetWidth = mWidgetInfo[eachWidget].width()/scaleFactor;
result += newWidgetWidth; result += newWidgetWidth;
} }
qDebug() << __PRETTY_FUNCTION__ << "widget " << &eachWidget;
qDebug() << __PRETTY_FUNCTION__ << "count " << count++;
qDebug() << __PRETTY_FUNCTION__ << "widget orignal size " << mWidgetInfo[eachWidget];
qDebug() << __PRETTY_FUNCTION__ << "containes size " << pSize;
qDebug() << __PRETTY_FUNCTION__ << "scale factor " << scaleFactor;
qDebug() << __PRETTY_FUNCTION__ << "new height " << result;
} }
return result; return result;
} }

@ -100,14 +100,17 @@ UBMediaPlayer::UBMediaPlayer() :
// vLayout->addWidget(info); // vLayout->addWidget(info);
initVideoWindow(); initVideoWindow();
vLayout->addWidget(&m_videoWindow); vLayout->addWidget(&m_videoWindow);
// m_videoWidget->setStyleSheet(QString("background:red;"));
QVBoxLayout *buttonPanelLayout = new QVBoxLayout(); QVBoxLayout *buttonPanelLayout = new QVBoxLayout();
// m_videoWindow.hide(); //m_videoWindow.hide();
// buttonPanelLayout->addLayout(layout); // buttonPanelLayout->addLayout(layout);
// timeLabel = new QLabel(this); // timeLabel = new QLabel(this);
progressLabel = new QLabel(this); progressLabel = new QLabel(this);
QWidget *sliderPanel = new QWidget(this); QWidget *sliderPanel = new QWidget(this);
// sliderPanel->setStyleSheet(QString("background:green;"));
QHBoxLayout *sliderLayout = new QHBoxLayout(); QHBoxLayout *sliderLayout = new QHBoxLayout();
// playButton->setStyleSheet(QString("background:yellow;"));
sliderLayout->addWidget(playButton); sliderLayout->addWidget(playButton);
sliderLayout->addWidget(slider); sliderLayout->addWidget(slider);
// sliderLayout->addWidget(timeLabel); // sliderLayout->addWidget(timeLabel);
@ -130,7 +133,6 @@ UBMediaPlayer::UBMediaPlayer() :
vLayout->addWidget(buttonPanelWidget); vLayout->addWidget(buttonPanelWidget);
QHBoxLayout *labelLayout = new QHBoxLayout(); QHBoxLayout *labelLayout = new QHBoxLayout();
vLayout->addLayout(labelLayout); vLayout->addLayout(labelLayout);
setLayout(vLayout); setLayout(vLayout);
@ -224,7 +226,7 @@ void UBMediaPlayer::initVideoWindow()
videoLayout->addWidget(m_videoWidget); videoLayout->addWidget(m_videoWidget);
videoLayout->setContentsMargins(0, 0, 0, 0); videoLayout->setContentsMargins(0, 0, 0, 0);
m_videoWindow.setLayout(videoLayout); m_videoWindow.setLayout(videoLayout);
m_videoWindow.setMinimumSize(100, 100); m_videoWindow.setMinimumSize(60, 40);
} }
void UBMediaPlayer::playPause() void UBMediaPlayer::playPause()

@ -911,8 +911,9 @@ UBTeacherBarPreviewMedia::UBTeacherBarPreviewMedia(QWidget* parent, const char*
{ {
setObjectName(name); setObjectName(name);
mWidget = new UBWidgetList(parent); mWidget = new UBWidgetList(parent);
mWidget->setEmptyText(tr("No media found")); // mWidget->setEmptyText(tr("No media found"));
mLayout.addWidget(mWidget); mLayout.addWidget(mWidget);
// mWidget->setStyleSheet(QString("background-color: red;"));
setLayout(&mLayout); setLayout(&mLayout);
mWidgetList.clear(); mWidgetList.clear();
} }
@ -929,9 +930,15 @@ UBTeacherBarPreviewMedia::~UBTeacherBarPreviewMedia()
void UBTeacherBarPreviewMedia::cleanMedia() void UBTeacherBarPreviewMedia::cleanMedia()
{ {
foreach(QWidget* eachWidget, mWidgetList.keys()){ foreach(QWidget* eachWidget, mWidgetList.keys()){
if(QString(eachWidget->metaObject()->className()).contains("UBDraggable")){
mWidget->removeWidget(eachWidget);
delete eachWidget; delete eachWidget;
eachWidget = NULL; eachWidget = NULL;
} }
else{
mWidget->removeWidget(eachWidget);
}
}
mWidgetList.clear(); mWidgetList.clear();
} }

Loading…
Cancel
Save