Minor fix for another change in Google's movie pages and a fix in
[movie-schedule] / src / ui / aboutdialog.cpp
1 // Copyright 2010 Jochen Becher
2 //
3 // This file is part of MovieSchedule.
4 //
5 // MovieSchedule is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // MovieSchedule is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with MovieSchedule.  If not, see <http://www.gnu.org/licenses/>.
17
18 #include "aboutdialog.h"
19
20 #include "ui_aboutdialog.h"
21 #include "uiutils.h"
22
23 #include <QDesktopWidget>
24
25 AboutDialog::AboutDialog(QWidget *parent) :
26     QDialog(parent),
27     ui(new Ui::AboutDialog)
28 {
29     ui->setupUi(this);
30     ui->_button_box->addButton(ui->_done_button, QDialogButtonBox::AcceptRole);
31     ui->_button_box->addButton(ui->_contact_button, QDialogButtonBox::ActionRole);
32     //QPalette palette = ui->_about_text->palette();
33     //palette.setColor(QPalette::Base, palette.color(QPalette::Window));
34     //palette.setColor(QPalette::Text, palette.color(QPalette::WindowText));
35     //ui->_about_text->setPalette(palette);
36     connect(ui->_button_box, SIGNAL(accepted()), this, SLOT(deleteLater()));
37     connect(ui->_button_box, SIGNAL(rejected()), this, SLOT(deleteLater()));
38     connect(ui->_contact_button, SIGNAL(clicked()), this, SLOT(deleteLater()));
39     connect(ui->_contact_button, SIGNAL(clicked()), this, SIGNAL(ContactAuthor()));
40     connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(Rotate()));
41     Rotate();
42 }
43
44 AboutDialog::~AboutDialog()
45 {
46     delete ui;
47 }
48
49 void AboutDialog::Rotate()
50 {
51     bool landscape = UiUtils::IsLandscape();
52     ui->_dialog_layout->setDirection(landscape ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom);
53     ui->_button_box->setOrientation(landscape ? Qt::Vertical : Qt::Horizontal);
54     adjustSize();
55 }