X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fregionsview.cpp;h=b5c33430eb0a83e9a151aee32cc8e16cd9402d7a;hb=434d88418722fd7717038e44bd74271ca1d92771;hp=c83ed92c10b260dc69be4f95c4a152afa2366e40;hpb=b72bf3da6f5f05a1c161799c1e0b46892dcc18ba;p=minitube diff --git a/src/regionsview.cpp b/src/regionsview.cpp index c83ed92..b5c3343 100644 --- a/src/regionsview.cpp +++ b/src/regionsview.cpp @@ -1,8 +1,28 @@ +/* $BEGIN_LICENSE + +This file is part of Minitube. +Copyright 2009, Flavio Tordini + +Minitube is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Minitube is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Minitube. If not, see . + +$END_LICENSE */ + #include "regionsview.h" -#include "ytregions.h" #include "mainwindow.h" +#include "ytregions.h" -RegionsView::RegionsView(QWidget *parent) : QWidget(parent) { +RegionsView::RegionsView(QWidget *parent) : View(parent) { QBoxLayout *l = new QVBoxLayout(this); l->setMargin(30); l->setSpacing(30); @@ -13,17 +33,19 @@ RegionsView::RegionsView(QWidget *parent) : QWidget(parent) { l->addLayout(layout); addRegion(YTRegions::worldwideRegion()); - foreach(YTRegion region, YTRegions::list()) + foreach (YTRegion region, YTRegions::list()) addRegion(region); doneButton = new QPushButton(tr("Done")); doneButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); doneButton->setDefault(true); +#ifndef APP_MAC doneButton->setProperty("custom", true); doneButton->setProperty("important", true); doneButton->setProperty("big", true); +#endif connect(doneButton, SIGNAL(clicked()), MainWindow::instance(), SLOT(goBack())); - l->addWidget(doneButton, 0, Qt::AlignCenter); + l->addWidget(doneButton, 0, Qt::AlignHCenter | Qt::AlignTop); } void RegionsView::addRegion(const YTRegion ®ion) { @@ -45,14 +67,27 @@ void RegionsView::appear() { QString currentRegionId = YTRegions::currentRegionId(); for (int i = 0; i < layout->count(); i++) { QLayoutItem *item = layout->itemAt(i); - QPushButton *b = static_cast(item->widget()); + QPushButton *b = static_cast(item->widget()); QString regionId = b->property("regionId").toString(); b->setChecked(currentRegionId == regionId); } } +void RegionsView::paintEvent(QPaintEvent *e) { + QWidget::paintEvent(e); + QBrush brush; + if (window()->isActiveWindow()) { + brush = palette().base(); + } else { + brush = palette().window(); + } + QPainter painter(this); + painter.fillRect(0, 0, width(), height(), brush); + painter.end(); +} + void RegionsView::buttonClicked() { - QObject* o = sender(); + QObject *o = sender(); QString regionId = o->property("regionId").toString(); YTRegions::setRegion(regionId); emit regionChanged();