Permalink
Browse files

back-sliding action for YouListWidget

  • Loading branch information...
1 parent a25e1e9 commit f3ef69b368c93d9dbb1e5563009b025a69b8d86c @dougma committed Sep 9, 2009
Showing with 22 additions and 3 deletions.
  1. +21 −3 app/radio/widgets/MultiStarterWidget.cpp
  2. +1 −0 app/radio/widgets/MultiStarterWidget.h
@@ -169,9 +169,17 @@ MultiStarterWidget::onYouItemActivated(QTreeWidgetItem* i, int)
QString activatedUsername = i->data(0, SourceListModel::Arg1).toString();
YouListWidget* you = (YouListWidget*) sender();
if (activatedUsername != you->username()) {
- // slide forward
- YouListWidget* w = new YouListWidget(activatedUsername, this);
- connect(w, SIGNAL(itemActivated(QTreeWidgetItem*, int)), SLOT(onYouItemActivated(QTreeWidgetItem*, int)));
+ // make a profile widget with a back button
+ QWidget* w = new QWidget(this);
+ QLayout* l = new QVBoxLayout(w);
+ QPushButton* b = new QPushButton("back");
+ connect(b, SIGNAL(clicked()), SLOT(onYouBack()));
+ l->addWidget(b);
+ YouListWidget* ylw = new YouListWidget(activatedUsername, this);
+ connect(ylw, SIGNAL(itemActivated(QTreeWidgetItem*, int)), SLOT(onYouItemActivated(QTreeWidgetItem*, int)));
+ l->addWidget(ylw);
+
+ // slide m_youWidget forward to show the new profile
m_youWidget->layout()->addWidget(w);
((SideBySideLayout*)m_youWidget->layout())->moveForward();
return;
@@ -187,6 +195,16 @@ MultiStarterWidget::onYouItemActivated(QTreeWidgetItem* i, int)
}
void
+MultiStarterWidget::onYouBack()
+{
+ SideBySideLayout* layout = (SideBySideLayout*) m_youWidget->layout();
+ QWidget* top = layout->currentWidget();
+ layout->moveBackward();
+ layout->removeWidget(top);
+ top->deleteLater();
+}
+
+void
MultiStarterWidget::onUserGotTopTags()
{
sender()->deleteLater();
@@ -50,6 +50,7 @@ private slots:
void onUserGotFriends();
void onCheckBox(int checkState);
void onYouItemActivated(QTreeWidgetItem*, int);
+ void onYouBack();
private:
SourceListModel* m_sourceModel;

0 comments on commit f3ef69b

Please sign in to comment.