1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-30 19:00:12 +02:00

Make Tabs functional

This commit is contained in:
Uwe L. Korn
2014-06-17 19:11:13 +01:00
parent 24486a9b3a
commit 7936fd91f2
3 changed files with 156 additions and 2 deletions

View File

@@ -598,9 +598,10 @@ color: grey;</string>
border-style: solid;
border-radius: 4px;
border-color: white;
color: white;
padding: 2px;
background-color:#292f34;</string>
color: white;
background-color:#292f34;
</string>
</property>
<property name="currentIndex">
<number>0</number>

View File

@@ -22,12 +22,35 @@
#include "utils/ImageRegistry.h"
#include "utils/TomahawkStyle.h"
#include <QLayout>
#include <QStackedWidget>
using namespace Tomahawk;
using namespace Tomahawk::Widgets;
const char* activeWidgetThumbStylesheet = "QWidget {"
"border-width: 2px;"
"border-style: solid;"
"border-radius: 4px;"
"border-color: white;"
"color: white;"
"border-bottom: none;"
"border-bottom-right-radius: 0px;"
"border-bottom-left-radius: 0px;"
"background-color:#292f34;"
"}";
const char* inactiveWidgetThumbStylesheet = " QWidget {"
"border-width: 2px;"
"border-style: solid;"
"border-radius: 4px;"
"border-color: grey;"
"color: grey;"
"}";
WhatsNew_0_8::WhatsNew_0_8( QWidget* parent )
{
Q_UNUSED( parent );
}
@@ -64,35 +87,56 @@ WhatsNewWidget_0_8::WhatsNewWidget_0_8( QWidget* parent )
{
QPixmap inboxPixmap = ImageRegistry::instance()->pixmap( RESPATH "images/inbox.svg", QSize( 64, 64 ) );
ui->inboxBoxImage->setPixmap( inboxPixmap );
connect( ui->inboxBoxHeader, SIGNAL( clicked() ), SLOT( inboxBoxClicked() ) );
connect( ui->inboxBoxImage, SIGNAL( clicked() ), SLOT( inboxBoxClicked() ) );
}
{
QPixmap urlLookupPixmap = ImageRegistry::instance()->pixmap( RESPATH "images/drop-all-songs.svg", QSize( 64, 64 ) );
ui->urlLookupBoxImage->setPixmap( urlLookupPixmap );
connect( ui->urlLookupBoxHeader, SIGNAL( clicked() ), SLOT( urlLookupBoxClicked() ) );
connect( ui->urlLookupBoxImage, SIGNAL( clicked() ), SLOT( urlLookupBoxClicked() ) );
}
{
QPixmap trendingPixmap = ImageRegistry::instance()->pixmap( RESPATH "images/trending.svg", QSize( 64, 64 ) );
ui->trendingBoxImage->setPixmap( trendingPixmap );
connect( ui->trendingBoxHeader, SIGNAL( clicked() ), SLOT( trendingBoxClicked() ) );
connect( ui->trendingBoxImage, SIGNAL( clicked() ), SLOT( trendingBoxClicked() ) );
}
{
QPixmap beatsPixmap = ImageRegistry::instance()->pixmap( RESPATH "images/beatsmusic.svg", QSize( 64, 64 ) );
ui->beatsBoxImage->setPixmap( beatsPixmap );
connect( ui->beatsBoxHeader, SIGNAL( clicked() ), SLOT( beatsBoxClicked() ) );
connect( ui->beatsBoxImage, SIGNAL( clicked() ), SLOT( beatsBoxClicked() ) );
}
{
// TODO: Add GMusic Pixmap
connect( ui->gmusicBoxHeader, SIGNAL( clicked() ), SLOT( gmusicBoxClicked() ) );
connect( ui->gmusicBoxImage, SIGNAL( clicked() ), SLOT( gmusicBoxClicked() ) );
}
{
QPixmap networkingPixmap = ImageRegistry::instance()->pixmap( RESPATH "images/ipv6-logo.svg", QSize( 64, 64 ) );
ui->networkingBoxImage->setPixmap( networkingPixmap );
connect( ui->networkingBoxHeader, SIGNAL( clicked() ), SLOT( networkingBoxClicked() ) );
connect( ui->networkingBoxImage, SIGNAL( clicked() ), SLOT( networkingBoxClicked() ) );
}
{
QPixmap designPixmap = ImageRegistry::instance()->pixmap( RESPATH "images/new-additions.svg", QSize( 64, 64 ) );
ui->designBoxImage->setPixmap( designPixmap );
connect( ui->designBoxHeader, SIGNAL( clicked() ), SLOT( designBoxClicked() ) );
connect( ui->designBoxImage, SIGNAL( clicked() ), SLOT( designBoxClicked() ) );
}
}
@@ -140,4 +184,101 @@ WhatsNewWidget_0_8::changeEvent( QEvent* e )
}
void
WhatsNewWidget_0_8::inboxBoxClicked()
{
deactivateAllBoxes();
activateBox( ui->inboxBox );
ui->stackedWidget->setCurrentIndex( 0 );
}
void
WhatsNewWidget_0_8::urlLookupBoxClicked()
{
deactivateAllBoxes();
activateBox( ui->urlLookupBox );
ui->stackedWidget->setCurrentIndex( 1 );
}
void
WhatsNewWidget_0_8::trendingBoxClicked()
{
deactivateAllBoxes();
activateBox( ui->trendingBox );
ui->stackedWidget->setCurrentIndex( 2 );
}
void
WhatsNewWidget_0_8::beatsBoxClicked()
{
deactivateAllBoxes();
activateBox( ui->beatsBox );
ui->stackedWidget->setCurrentIndex( 3 );
}
void
WhatsNewWidget_0_8::gmusicBoxClicked()
{
deactivateAllBoxes();
activateBox( ui->gmusicBox );
ui->stackedWidget->setCurrentIndex( 4 );
}
void
WhatsNewWidget_0_8::networkingBoxClicked()
{
deactivateAllBoxes();
activateBox( ui->networkingBox );
ui->stackedWidget->setCurrentIndex( 5 );
}
void
WhatsNewWidget_0_8::designBoxClicked()
{
deactivateAllBoxes();
activateBox( ui->designBox );
ui->stackedWidget->setCurrentIndex( 6 );
}
void
WhatsNewWidget_0_8::activateBox( QWidget* widget )
{
widget->layout()->setContentsMargins( 8, 8, 8, 16 );
widget->setStyleSheet( activeWidgetThumbStylesheet );
}
void
WhatsNewWidget_0_8::deactivateAllBoxes()
{
ui->inboxBox->layout()->setContentsMargins( 8, 8, 8, 8 );
ui->inboxBox->setStyleSheet( inactiveWidgetThumbStylesheet );
ui->urlLookupBox->layout()->setContentsMargins( 8, 8, 8, 8 );
ui->urlLookupBox->setStyleSheet( inactiveWidgetThumbStylesheet );
ui->trendingBox->layout()->setContentsMargins( 8, 8, 8, 8 );
ui->trendingBox->setStyleSheet( inactiveWidgetThumbStylesheet );
ui->beatsBox->layout()->setContentsMargins( 8, 8, 8, 8 );
ui->beatsBox->setStyleSheet( inactiveWidgetThumbStylesheet );
ui->gmusicBox->layout()->setContentsMargins( 8, 8, 8, 8 );
ui->gmusicBox->setStyleSheet( inactiveWidgetThumbStylesheet );
ui->networkingBox->layout()->setContentsMargins( 8, 8, 8, 8 );
ui->networkingBox->setStyleSheet( inactiveWidgetThumbStylesheet );
ui->designBox->layout()->setContentsMargins( 8, 8, 8, 8 );
ui->designBox->setStyleSheet( inactiveWidgetThumbStylesheet );
}
Q_EXPORT_PLUGIN2( ViewPagePlugin, WhatsNew_0_8 )

View File

@@ -54,7 +54,19 @@ public:
protected:
void changeEvent( QEvent* e );
private slots:
void inboxBoxClicked();
void urlLookupBoxClicked();
void trendingBoxClicked();
void beatsBoxClicked();
void gmusicBoxClicked();
void networkingBoxClicked();
void designBoxClicked();
private:
void activateBox( QWidget* widget );
void deactivateAllBoxes();
Ui::WhatsNewWidget_0_8 *ui;
};