+movie-schedule (0.3.0-1) unstable; urgency=low
+
+ * Fixed german translation file
+ * Updated options dialog layout
+
+ -- Jochen Becher <j.becher@ovi.com> Sun, 13 Sep 2010 22:30:00 +0000
+
+movie-schedule (0.3.0) unstable; urgency=low
+
+ * Add GUI rotation (including options dialog) (Closes: #6256)
+ * Fix access of Googles movie pages (Closes: #6399)
+
+ -- Jochen Becher <j.becher@ovi.com> Sun, 12 Sep 2010 23:00:00 +0000
+
movie-schedule (0.2.2) unstable; urgency=low
* Fixed interpretation of schedule times (Closes: #6234)
-- Jochen Becher <j.becher@ovi.com> Sun, 05 Sep 2010 22:15:00 +0000
-
movie-schedule (0.2.1) unstable; urgency=low
* Fixed link to bugtracker in debian/control files (Closes: #6226)
#include "control/actioncontroller.h"
#include "control/locationcontroller.h"
#include "control/itemmodelsortclient.h"
+#include "control/settingscontroller.h"
#include "ui/aboutdialog.h"
#include "ui/mainwindow.h"
#include "ui/theatermodel.h"
MovieController *movie_controller,
LocationController *location_controller,
ActionController *action_controller,
+ SettingsController *settings_controller,
ItemModelSortController *sort_controller,
QThread *search_worker)
: _main_window(main_window),
_movie_controller(movie_controller),
_location_controller(location_controller),
_action_controller(action_controller),
+ _settings_controller(settings_controller),
_sort_controller(sort_controller),
_search_worker(search_worker),
_connectivity_manager(new ConnectivityManager(this)),
connect(_main_window, SIGNAL(MovieSelected(MovieKey)), _movie_controller, SLOT(ShowMovie(MovieKey)));
connect(_main_window, SIGNAL(SearchMovieInWeb(MovieKey)), _action_controller, SLOT(SearchMovieInWeb(MovieKey)));
connect(_main_window, SIGNAL(OpenLocationDialog()), _location_controller, SLOT(OpenLocationDialog()));
+ connect(_main_window, SIGNAL(OpenOptionsDialog()), _settings_controller, SLOT(OpenSettingsDialog()));
connect(_main_window, SIGNAL(OpenAboutDialog()), this, SLOT(OpenAboutDialog()));
+ connect(_settings_controller, SIGNAL(SettingsChanged(Settings)), this, SLOT(SettingsChanged(Settings)));
connect(_location_controller, SIGNAL(Search(Location)), this, SLOT(Search(Location)));
connect(_connectivity_manager, SIGNAL(Connected()), this, SLOT(NetworkConnected()));
connect(_connectivity_manager, SIGNAL(Disconnected()), this, SLOT(NetworkDisconnected()));
connect(_connectivity_manager, SIGNAL(Error()), this, SLOT(NetworkError()));
+ _main_window->SetOrientation(settings->GetOrientationMode());
}
MainController::~MainController()
_main_window->SetError(tr(MSG_NETWORK_ERROR));
}
+void MainController::SettingsChanged(const Settings &settings)
+{
+ _main_window->SetOrientation(settings.GetOrientationMode());
+}
+
void MainController::SearchTheaters()
{
_settings->SetSearchObjectsType(Settings::THEATERS);
class MovieController;
class LocationController;
class ActionController;
+class SettingsController;
class ItemModelSortController;
class TheaterModel;
class MovieModel;
MainController(MainWindow *main_window, Settings *settings, CinemaSchedule *cinema_schedule,
TheaterController *theater_controller, MovieController *movie_controller,
LocationController *location_controller, ActionController *action_controller,
+ SettingsController *settings_controller,
ItemModelSortController *sort_controller, QThread *search_worker);
~MainController();
Q_SLOT void NetworkDisconnected();
Q_SLOT void NetworkError();
+ Q_SLOT void SettingsChanged(const Settings &settings);
+
Q_SLOT void SearchTheaters();
Q_SLOT void SearchMovies();
Q_SLOT void OpenAboutDialog();
MovieController *_movie_controller;
LocationController *_location_controller;
ActionController *_action_controller;
+ SettingsController *_settings_controller;
ItemModelSortController *_sort_controller;
QThread *_search_worker;
ConnectivityManager *_connectivity_manager;
#include "settingscontroller.h"
#include "data/settings.h"
+#include "ui/mainwindow.h"
+#include "ui/optionsdialog.h"
#include <QFile>
#include <QXmlStreamReader>
#include <QDir>
#include <iostream>
-SettingsController::SettingsController(Settings *settings)
- : _settings(settings)
+SettingsController::SettingsController(MainWindow *main_window, Settings *settings)
+ : _main_window(main_window),
+ _settings(settings)
{
}
STATE_PREVIOUS_LOCATION_NAME,
STATE_GPS,
STATE_SEARCH,
+ STATE_ORIENTATION
};
void SettingsController::Load()
state = STATE_GPS;
} else if (state == STATE_SETTINGS && xml.name() == "search") {
state = STATE_SEARCH;
+ } else if (state == STATE_SETTINGS && xml.name() == "orientation") {
+ state = STATE_ORIENTATION;
} else {
state = STATE_DOCUMENT;
}
} else if (token == QXmlStreamReader::EndElement) {
- if (state == STATE_SEARCH) {
+ if (state == STATE_ORIENTATION) {
+ state = STATE_SETTINGS;
+ } else if (state == STATE_SEARCH) {
state = STATE_SETTINGS;
} else if (state == STATE_GPS) {
state = STATE_SETTINGS;
} else if (xml.text() == "movies") {
_settings->SetSearchObjectsType(Settings::MOVIES);
}
+ } else if (state == STATE_ORIENTATION) {
+ if (xml.text() == "landscape") {
+ _settings->SetOrientationMode(Settings::LANDSCAPE);
+ } else if (xml.text() == "portrait") {
+ _settings->SetOrientationMode(Settings::PORTRAIT);
+ } else if (xml.text() == "autorotation") {
+ _settings->SetOrientationMode(Settings::AUTOROTATION);
+ }
}
}
}
xml.writeStartElement("settings");
xml.writeStartElement("location");
xml.writeTextElement("name", _settings->GetLocation().GetLocationName());
- xml.writeEndElement();
+ xml.writeEndElement(); // </location>
xml.writeStartElement("previous-locations");
Q_FOREACH(Location location, _settings->GetPreviousLocations()) {
xml.writeStartElement("location");
xml.writeTextElement("name", location.GetLocationName());
xml.writeEndElement();
}
- xml.writeEndElement();
+ xml.writeEndElement(); // </previous-locations>
QString v;
xml.writeStartElement("gps");
xml.writeAttribute("enabled", _settings->IsGPSEnabled() ? "yes" : "no");
- xml.writeEndElement();
+ xml.writeEndElement(); // </gps>
switch (_settings->GetSearchObjectsType()) {
case Settings::THEATERS:
v = "theaters";
break;
}
xml.writeTextElement("search", v);
- xml.writeEndElement();
+ switch (_settings->GetOrientationMode()) {
+ case Settings::LANDSCAPE:
+ v = "landscape";
+ break;
+ case Settings::PORTRAIT:
+ v = "portrait";
+ break;
+ case Settings::AUTOROTATION:
+ v = "autorotation";
+ break;
+ }
+ xml.writeTextElement("orientation", v);
+ xml.writeEndElement(); // </settings>
xml.writeEndDocument();
} else {
// TODO error message unable to create file
}
}
+void SettingsController::EmitInitialSettings()
+{
+ emit SettingsChanged(*_settings);
+}
+
+void SettingsController::OpenSettingsDialog()
+{
+#ifdef Q_WS_MAEMO_5
+ OptionsDialog *dialog = new OptionsDialog(_main_window);
+ connect(dialog, SIGNAL(Accept(Settings)), this, SLOT(AcceptSettingsDialog(Settings)));
+ connect(dialog, SIGNAL(Cancel(Settings)), this, SLOT(CancelSettingsDialog(Settings)));
+ dialog->SetSettings(*_settings);
+ dialog->show();
+ // dialog deletes itself
+#endif
+}
+
+void SettingsController::AcceptSettingsDialog(const Settings &settings)
+{
+ *_settings = settings;
+ emit SettingsChanged(settings);
+}
+
+void SettingsController::CancelSettingsDialog(const Settings &settings)
+{
+ Q_UNUSED(settings);
+ // do nothing
+}
+
QString SettingsController::GetSettingsFileName()
{
QString dirpath = QDir::homePath() + "/.movie-schedule";
#define SETTINGSCONTROLLER_H
#include <QString>
+#include <QObject>
+class MainWindow;
class Settings;
-class SettingsController
+class SettingsController : public QObject
{
+ Q_OBJECT
public:
- SettingsController(Settings *settings);
+ SettingsController(MainWindow *main_window, Settings *settings);
void Load();
void Save();
+ void EmitInitialSettings();
+
+public:
+ Q_SIGNAL void SettingsChanged(const Settings &);
+
+public:
+ Q_SLOT void OpenSettingsDialog();
+
+private:
+ Q_SLOT void AcceptSettingsDialog(const Settings &);
+ Q_SLOT void CancelSettingsDialog(const Settings &);
+
private:
QString GetSettingsFileName();
private:
+ MainWindow *_main_window;
Settings *_settings;
};
: _location(),
_previous_locations(),
_gps_enabled(true),
- _search_objects_type(MOVIES)
+ _search_objects_type(MOVIES),
+ _rotation_mode(AUTOROTATION)
{
}
MOVIES
};
+ enum OrientationMode {
+ LANDSCAPE,
+ PORTRAIT,
+ AUTOROTATION
+ };
+
public:
Settings();
SearchObjectsType GetSearchObjectsType() const { return _search_objects_type; }
void SetSearchObjectsType(SearchObjectsType search_objects_type) { _search_objects_type = search_objects_type; }
+ OrientationMode GetOrientationMode() const { return _rotation_mode; }
+ void SetOrientationMode(OrientationMode rotation_mode) { _rotation_mode = rotation_mode; }
+
private:
Location _location;
Locations _previous_locations;
bool _gps_enabled;
SearchObjectsType _search_objects_type;
+ OrientationMode _rotation_mode;
};
#endif // SETTINGS_H
main_window.show();
Settings settings;
- SettingsController settings_controller(&settings);
+ SettingsController settings_controller(&main_window, &settings);
settings_controller.Load();
ActionController action_controller(&cinema_schedule);
MainController main_controller(&main_window, &settings, &cinema_schedule, &theater_controller,
&movie_controller, &location_controller, &action_controller,
- &sort_controller, &search_worker);
+ &settings_controller, &sort_controller, &search_worker);
+ settings_controller.EmitInitialSettings();
main_controller.Run();
int rc = app.exec();
}
QNetworkRequest request;
QUrl xurl(url);
- if (_start != 0) {
+ if (_start != 0 && !url.hasQueryItem("start")) {
xurl.addQueryItem("start", QString::number(_start));
}
FixLocation(&xurl);
//std::cout << "URL: " << qPrintable(QString(xurl.toEncoded())) << std::endl;
request.setUrl(xurl);
- //request.setRawHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.9) Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9");
+ //request.setRawHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.8) Gecko/20100723 Ubuntu/9.10 (karmic) Firefox/3.6.8");
request.setRawHeader("User-Agent", "Mozilla/5.0");
//request.setRawHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
request.setRawHeader("Accept", "application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
request.setRawHeader("Accept-Language", "en-gb;q=1.0,en;q=0.9,de-de;q=0.5,de;q=0.3");
+ //request.setRawHeader("Accept-Language", "en-us,en;q=0.8,de-de;q=0.5,de;q=0.3");
//request.setRawHeader("Accept-Encoding", "gzip,deflate");
request.setRawHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
- request.setRawHeader("Keep-Alive", "300");
+ request.setRawHeader("Keep-Alive", "115");
request.setRawHeader("Connection", "keep-alive");
request.setRawHeader("Cache-Control", "max-age=0");
QNetworkReply *reply = _network->get(request);
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(NetworkError(QNetworkReply::NetworkError)));
}
+void AbstractSearchClient::SearchEncodedUrl(const QString &encoded_url, int start)
+{
+ QUrl url = QUrl::fromEncoded((QString("http://www.google.com") + encoded_url).toAscii());
+ Search(url, start);
+}
+
void AbstractSearchClient::DownloadProgress(qint64 a,qint64 b)
{
//std::cout << "Search Progress of " << qPrintable(objectName()) << " - " << a << ", " << b << std::endl;
void AbstractSearchClient::FixLocation(QUrl *url)
{
+#if 0
// Try to fix the Google url which returns
// wrong locations in some links
if (_location.isNull()) {
url->addQueryItem("defaultloc", _location);
}
}
+#else
+ Q_UNUSED(url);
+#endif
}
QMutex AbstractSearchClient::_next_search_task_id_mutex;
int GetStartIndex() { return _start; }
virtual void Search(const QUrl &url, int start);
+ virtual void SearchEncodedUrl(const QString &endcoded_url, int start);
public:
Q_SIGNAL void SearchStarted(int search_task_id);
PARSE_LINK,
PARSE_BR,
PARSE_SPAN,
+ PARSE_NEXT_PAGE_LINK
};
void MovieScheduleSearchClient::ReplyFinished(QNetworkReply *reply)
QString theater_phone;
QList<QString> schedule;
QRegExp time_pattern("\\d+:\\d+([aApP][mM])*");
+ QString next_page_url;
+ int next_page_start;
while (!xml.atEnd()) {
QXmlStreamReader::TokenType token = xml.readNext();
if (token == QXmlStreamReader::StartElement) {
//std::cout << "LINK " << qPrintable(attr_href) << std::endl;
if (url.hasQueryItem("date")) {
QString v = url.queryItemValue("date");
- std::cout << "FOUND Date Link " << qPrintable(v) << " from " << qPrintable(url.toString()) << std::endl;
+ //std::cout << "FOUND Date Link " << qPrintable(v) << " from " << qPrintable(url.toString()) << std::endl;
if (!_dates_seen.contains(v)) {
// TODO replace location with user selected location (Google simplifies to much)
_dates_seen.insert(v);
theater_phone = "";
schedule.clear();
state = PARSE_THEATER_LINK;
+ } else if (url.hasQueryItem("start")) {
+ QString sort = url.queryItemValue("sort");
+ QString start = url.queryItemValue("start");
+ int istart = start.toInt();
+ if (sort == "0" && istart > GetStartIndex()) {
+ //std::cout << "next page LINK " << qPrintable(attr_href) << std::endl;
+ next_page_url = attr_href;
+ next_page_start = istart;
+ }
+ state = PARSE_NEXT_PAGE_LINK;
} else {
state = PARSE_HTML;
}
}
}
}
+ } else if (state == PARSE_NEXT_PAGE_LINK) {
+ state = PARSE_HTML;
}
} else if (token == QXmlStreamReader::Characters) {
if (state == PARSE_THEATER_LINK) {
emit SearchFinished(GetSearchTaskId(), false);
deleteLater();
} else {
- if (found > 0) {
+ if (!next_page_url.isEmpty()) {
emit Reply(GetSearchTaskId(), true);
- Search(GetStartIndex() + found);
+ SearchEncodedUrl(next_page_url, next_page_start);
} else {
if (!_date_urls.isEmpty()) {
SearchNextDate();
void MovieSearchClient::Search(int start)
{
QUrl url("http://www.google.com/m/movies");
+ url.addQueryItem("action","chgloc");
url.addQueryItem("loc", _town);
url.addQueryItem("sort", QString::number(1));
AbstractSearchClient::Search(url, start);
PARSE_MOVIE_LINK,
PARSE_EXPECT_DIV1,
PARSE_EXPECT_DIV2, PARSE_DIV2,
- PARSE_SPAN, PARSE_RATING, PARSE_TRAILER
+ PARSE_SPAN, PARSE_RATING, PARSE_TRAILER,
+ PARSE_NEXT_PAGE_LINK
};
void MovieSearchClient::ReplyFinished(QNetworkReply *reply)
QString movie_theaters_url;
QRegExp duration_pattern("((\\d+)hr )?(\\d+)min");
QRegExp reviews_pattern("\\d+ review(s)?");
+ QString next_page_url;
+ int next_page_start;
while (!xml.atEnd()) {
QXmlStreamReader::TokenType token = xml.readNext();
if (token == QXmlStreamReader::StartElement) {
movie_rating = -1.0;
movie_theaters_url = attr_href;
state = PARSE_MOVIE_LINK;
+ } else if (url.hasQueryItem("start")) {
+ QString sort = url.queryItemValue("sort");
+ QString start = url.queryItemValue("start");
+ int istart = start.toInt();
+ if (sort == "1" && istart > GetStartIndex()) {
+ //std::cout << "next page LINK " << qPrintable(attr_href) << std::endl;
+ next_page_url = attr_href;
+ next_page_start = istart;
+ }
+ state = PARSE_NEXT_PAGE_LINK;
} else {
state = PARSE_HTML;
}
}
}
state = PARSE_HTML;
+ } else if (state == PARSE_NEXT_PAGE_LINK) {
+ state = PARSE_HTML;
}
} else if (token == QXmlStreamReader::Characters) {
if (state == PARSE_MOVIE_LINK) {
emit SearchFinished(GetSearchTaskId(), false);
deleteLater();
} else {
- if (found > 0) {
+ if (!next_page_url.isEmpty()) {
emit Reply(GetSearchTaskId(), true);
- Search(GetStartIndex() + found);
+ SearchEncodedUrl(next_page_url, next_page_start);
} else {
emit Reply(GetSearchTaskId(), false);
emit SearchFinished(GetSearchTaskId(), true);
PARSE_MOVIE_EXPECT_DIV3,
PARSE_MOVIE_DIV3,
PARSE_MOVIE_TIME,
+ PARSE_NEXT_PAGE_LINK
};
void TheaterScheduleSearchClient::ReplyFinished(QNetworkReply *reply)
QRegExp duration_pattern("((\\d+)hr )?(\\d+)min");
QRegExp reviews_pattern("\\d+ review(s)?");
QXmlStreamReader xml(reply);
+ QString next_page_url;
+ int next_page_start;
while (!xml.atEnd()) {
QXmlStreamReader::TokenType token = xml.readNext();
if (token == QXmlStreamReader::StartElement) {
rating = -1.0;
schedule.clear();
state = PARSE_MOVIE_LINK;
+ } else if (url.hasQueryItem("start")) {
+ QString sort = url.queryItemValue("sort");
+ QString start = url.queryItemValue("start");
+ int istart = start.toInt();
+ if (sort == "0" && istart > GetStartIndex()) {
+ //std::cout << "next page LINK " << qPrintable(attr_href) << std::endl;
+ next_page_url = attr_href;
+ next_page_start = istart;
+ }
+ state = PARSE_NEXT_PAGE_LINK;
} else {
state = PARSE_HTML;
}
}
}
state = PARSE_HTML;
+ } else if (state == PARSE_NEXT_PAGE_LINK) {
+ state = PARSE_HTML;
}
} else if (token == QXmlStreamReader::Characters) {
if (state == PARSE_MOVIE_LINK) {
emit Cancelled(GetSearchTaskId());
emit SearchFinished(GetSearchTaskId(), false);
} else {
- // all movies are listed on one page
- // no repetition of search with start parameter
- if (!_date_urls.isEmpty()) {
+ if (!next_page_url.isEmpty()) {
emit Reply(GetSearchTaskId(), true);
- SearchNextDate();
+ SearchEncodedUrl(next_page_url, next_page_start);
} else {
- emit Reply(GetSearchTaskId(), false);
- emit SearchFinished(GetSearchTaskId(), true);
- deleteLater();
+ if (!_date_urls.isEmpty()) {
+ emit Reply(GetSearchTaskId(), true);
+ SearchNextDate();
+ } else {
+ emit Reply(GetSearchTaskId(), false);
+ emit SearchFinished(GetSearchTaskId(), true);
+ deleteLater();
+ }
}
}
reply->deleteLater();
void TheaterSearchClient::Search(int start)
{
QUrl url("http://www.google.com/m/movies");
+ url.addQueryItem("action","chgloc");
url.addQueryItem("loc", _town);
url.addQueryItem("sort", QString::number(0));
AbstractSearchClient::Search(url, start);
PARSE_THEATER_DIV,
PARSE_THEATER_BR,
PARSE_THEATER_SPAN,
- PARSE_THEATER_PHONE
+ PARSE_THEATER_PHONE,
+ PARSE_NEXT_PAGE_LINK
};
void TheaterSearchClient::ReplyFinished(QNetworkReply *reply)
{
+ //std::cout << qPrintable(QString::fromUtf8(reply->readAll().data())) << std::endl;
QXmlStreamReader xml(reply);
State state = PARSE_HTML;
int found = 0;
QString theater_address;
QString theater_movies_url;
QString theater_phone;
+ QString next_page_url;
+ int next_page_start;
while (!xml.atEnd()) {
QXmlStreamReader::TokenType token = xml.readNext();
if (token == QXmlStreamReader::StartElement) {
theater_movies_url = attr_href;
theater_phone = "";
state = PARSE_THEATER_LINK;
+ } else if (url.hasQueryItem("start")) {
+ QString sort = url.queryItemValue("sort");
+ QString start = url.queryItemValue("start");
+ int istart = start.toInt();
+ if (sort == "0" && istart > GetStartIndex()) {
+ //std::cout << "next page LINK " << qPrintable(attr_href) << std::endl;
+ next_page_url = attr_href;
+ next_page_start = istart;
+ }
+ state = PARSE_NEXT_PAGE_LINK;
} else {
state = PARSE_HTML;
}
}
}
state = PARSE_HTML;
+ } else if (state == PARSE_NEXT_PAGE_LINK) {
+ state = PARSE_HTML;
}
} else if (token == QXmlStreamReader::Characters) {
if (state == PARSE_THEATER_LINK) {
emit SearchFinished(GetSearchTaskId(), false);
deleteLater();
} else {
- if (found > 0) {
+ if (!next_page_url.isEmpty()) {
emit Reply(GetSearchTaskId(), true);
- Search(GetStartIndex() + found);
+ SearchEncodedUrl(next_page_url, next_page_start);
} else {
emit Reply(GetSearchTaskId(), false);
emit SearchFinished(GetSearchTaskId(), true);
ui/locationdialog.ui \
ui/moviewindow.ui \
ui/contextdialog.ui \
- ui/aboutdialog.ui
+ ui/aboutdialog.ui \
RESOURCES += \
resources.qrc
../debian/optify \
../debian/compat
+maemo5 {
+ SOURCES += ui/optionsdialog.cpp
+ HEADERS += ui/optionsdialog.h
+ FORMS += ui/optionsdialog.ui
+}
+
!isEmpty(TRANSLATIONS) {
isEmpty(QMAKE_LRELEASE) {
win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\lrelease.exe
<translation>MovieSchedule</translation>
</message>
<message utf8="true">
- <location filename="../ui/aboutdialog.ui" line="109"/>
+ <location filename="../ui/aboutdialog.ui" line="107"/>
<source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
<translation>Telefonanruf fehlgeschlagen: Kein Anruf möglich.</translation>
</message>
<message>
- <location filename="../control/actioncontroller.cpp" line="221"/>
<source>Unable to search in web: communication bus not available.</source>
- <translation>Websuche fehlgeschlagen: Kommunikation mit Browser nicht möglich.</translation>
+ <translation type="obsolete">Websuche fehlgeschlagen: Kommunikation mit Browser nicht möglich.</translation>
</message>
<message>
- <location filename="../control/actioncontroller.cpp" line="226"/>
- <location filename="../control/actioncontroller.cpp" line="232"/>
+ <location filename="../control/actioncontroller.cpp" line="220"/>
<source>Unable to search in web: browser service not available.</source>
<translation>Websuche fehlgeschlagen: Browser steht nicht zur Verfügung.</translation>
</message>
<translation>Ort</translation>
</message>
<message>
- <location filename="../ui/locationdialog.ui" line="49"/>
+ <location filename="../ui/locationdialog.ui" line="34"/>
<source>Search Near</source>
<translation>In der Nähe suchen</translation>
</message>
<message>
- <location filename="../ui/locationdialog.ui" line="116"/>
+ <location filename="../ui/locationdialog.ui" line="100"/>
<source>City</source>
<translation>Stadt</translation>
</message>
<message>
- <location filename="../ui/locationdialog.ui" line="149"/>
+ <location filename="../ui/locationdialog.ui" line="135"/>
<source>Search</source>
<translation>Suchen</translation>
</message>
<translation type="obsolete">Netzwerk steht nicht zur Verfügung.</translation>
</message>
<message>
- <location filename="../control/maincontroller.cpp" line="43"/>
+ <location filename="../control/maincontroller.cpp" line="44"/>
<source>Unable to access network.</source>
<translation>Netzwerk steht nicht zur Verfügung.</translation>
</message>
<message>
- <location filename="../control/maincontroller.cpp" line="44"/>
+ <location filename="../control/maincontroller.cpp" line="45"/>
<source>No theaters found near %1.</source>
<translation>Keine Kinos in der Nähe von %1 gefunden.</translation>
</message>
<message>
- <location filename="../control/maincontroller.cpp" line="45"/>
+ <location filename="../control/maincontroller.cpp" line="46"/>
<source>No movies found near %1.</source>
<translation>Keine Filme in der Nähe von %1 gefunden.</translation>
</message>
<message>
- <location filename="../control/maincontroller.cpp" line="46"/>
+ <location filename="../control/maincontroller.cpp" line="47"/>
<source>Error on fetching theaters.</source>
<translation>Fehler beim Lesen der Kinoliste.</translation>
</message>
<message>
- <location filename="../control/maincontroller.cpp" line="47"/>
+ <location filename="../control/maincontroller.cpp" line="48"/>
<source>Error on fetching movies.</source>
<translation>Fehler beim Lesen der Filmliste.</translation>
</message>
<name>MainWindow</name>
<message>
<location filename="../ui/mainwindow.cpp" line="75"/>
- <location filename="../ui/mainwindow.cpp" line="113"/>
+ <location filename="../ui/mainwindow.cpp" line="133"/>
<source>Movies</source>
<translation>Filme</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="76"/>
- <location filename="../ui/mainwindow.cpp" line="105"/>
+ <location filename="../ui/mainwindow.cpp" line="125"/>
<source>Theaters</source>
<translation>Kinos</translation>
</message>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="78"/>
+ <source>Options</source>
+ <translation>Einstellungen</translation>
+ </message>
+ <message>
+ <location filename="../ui/mainwindow.cpp" line="79"/>
<source>About</source>
<translation>Ãœber</translation>
</message>
<message>
- <location filename="../ui/mainwindow.cpp" line="80"/>
+ <location filename="../ui/mainwindow.cpp" line="81"/>
<source>Call By Phone</source>
<translation>Kino anrufen</translation>
</message>
<message>
- <location filename="../ui/mainwindow.cpp" line="81"/>
+ <location filename="../ui/mainwindow.cpp" line="82"/>
<source>Find Route</source>
<translation>Weg zum Kino suchen</translation>
</message>
<message>
- <location filename="../ui/mainwindow.cpp" line="82"/>
- <location filename="../ui/mainwindow.cpp" line="84"/>
+ <location filename="../ui/mainwindow.cpp" line="83"/>
+ <location filename="../ui/mainwindow.cpp" line="85"/>
<source>Search In Web</source>
<translation>Im Web suchen</translation>
</message>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="14"/>
- <location filename="../ui/mainwindow.cpp" line="120"/>
+ <location filename="../ui/mainwindow.cpp" line="140"/>
<source>MovieSchedule</source>
<translation>MovieSchedule</translation>
</message>
</message>
</context>
<context>
+ <name>OptionsDialog</name>
+ <message>
+ <location filename="../ui/optionsdialog.ui" line="14"/>
+ <source>Options</source>
+ <translation>Einstellungen</translation>
+ </message>
+ <message>
+ <location filename="../ui/optionsdialog.ui" line="22"/>
+ <source>Orientation</source>
+ <translation>Orientierung</translation>
+ </message>
+ <message>
+ <location filename="../ui/optionsdialog.ui" line="54"/>
+ <source>Done</source>
+ <translation>Fertig</translation>
+ </message>
+ <message>
+ <location filename="../ui/optionsdialog.cpp" line="32"/>
+ <source>Landscape</source>
+ <translation>Querformat</translation>
+ </message>
+ <message>
+ <location filename="../ui/optionsdialog.cpp" line="33"/>
+ <source>Portrait</source>
+ <translation>Hochformat</translation>
+ </message>
+ <message>
+ <location filename="../ui/optionsdialog.cpp" line="34"/>
+ <source>Automatic Rotation</source>
+ <translation>Automatische Drehung</translation>
+ </message>
+</context>
+<context>
<name>QObject</name>
<message>
<location filename="../utils/timeutils.cpp" line="79"/>
// along with MovieSchedule. If not, see <http://www.gnu.org/licenses/>.
#include "aboutdialog.h"
+
#include "ui_aboutdialog.h"
+#include "uiutils.h"
+
+#include <QDesktopWidget>
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
connect(ui->_button_box, SIGNAL(rejected()), this, SLOT(deleteLater()));
connect(ui->_contact_button, SIGNAL(clicked()), this, SLOT(deleteLater()));
connect(ui->_contact_button, SIGNAL(clicked()), this, SIGNAL(ContactAuthor()));
+ connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(Rotate()));
+ Rotate();
}
AboutDialog::~AboutDialog()
{
delete ui;
}
+
+void AboutDialog::Rotate()
+{
+ bool landscape = UiUtils::IsLandscape();
+ ui->_dialog_layout->setDirection(landscape ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom);
+ ui->_button_box->setOrientation(landscape ? Qt::Vertical : Qt::Horizontal);
+ adjustSize();
+}
Q_SIGNAL void ContactAuthor();
private:
+ Q_SLOT void Rotate();
+
+private:
Ui::AboutDialog *ui;
};
<property name="windowTitle">
<string>About</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="2">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
<widget class="QLabel" name="_title">
<property name="font">
<font>
</property>
</widget>
</item>
- <item row="3" column="1" rowspan="4">
- <widget class="QDialogButtonBox" name="_button_box">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0" rowspan="6">
- <widget class="QScrollArea" name="scrollArea">
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- <property name="widgetResizable">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>311</width>
- <height>434</height>
- </rect>
- </property>
- <property name="palette">
- <palette>
- <active>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="_about_text">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+ <item>
+ <layout class="QHBoxLayout" name="_dialog_layout">
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>240</height>
+ </size>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>307</width>
+ <height>457</height>
+ </rect>
+ </property>
+ <property name="palette">
+ <palette>
+ <active>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </active>
+ <inactive>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </inactive>
+ <disabled>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </disabled>
+ </palette>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="_about_text">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:18pt;">Movies, Theaters, Schedules and GPS Locations use </span><a href="http://www.google.com"><span style=" font-size:18pt; font-weight:600; text-decoration: underline; color:#2eacff;">Google</span></a><span style=" font-size:18pt;"> services.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:18pt;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">This program 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.</span></p></body></html></string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::RichText</enum>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QPushButton" name="_contact_button">
+ <property name="text">
+ <string>Contact</string>
</property>
- <property name="textFormat">
- <enum>Qt::RichText</enum>
- </property>
- <property name="scaledContents">
- <bool>true</bool>
+ <property name="autoDefault">
+ <bool>false</bool>
</property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="_done_button">
+ <property name="text">
+ <string>Done</string>
</property>
- <property name="wordWrap">
- <bool>true</bool>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="_button_box">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <property name="openExternalLinks">
- <bool>true</bool>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
</layout>
- </widget>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QPushButton" name="_contact_button">
- <property name="text">
- <string>Contact</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QPushButton" name="_done_button">
- <property name="text">
- <string>Done</string>
- </property>
- </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>
// along with MovieSchedule. If not, see <http://www.gnu.org/licenses/>.
#include "backgroundlabel.h"
+#include "uiutils.h"
#include <QPainter>
#include <QFont>
+#include <iostream>
static const int MINIMUM_FONT_SIZE = 40;
QRect widget_rect = painter.worldTransform().inverted().mapRect(rect());
if (_cached_label_font_size <= 0 || widget_rect != _cached_widget_rect) {
+ bool landscape = rect().width() >= rect().height();
_cached_widget_rect = widget_rect;
_cached_label_rect = widget_rect;
- _cached_label_rect.setTop(_cached_label_rect.top() + 20);
+ _cached_label_rect.setTop(_cached_label_rect.top() + (landscape ? 20 : 10));
_cached_label_alignment = Qt::AlignHCenter | Qt::AlignTop;
int font_size = 80;
#include "data/cinema.h"
#include "data/movie.h"
#include "utils/assertedlocker.h"
+#include "uiutils.h"
#include <QLayoutItem>
+#include <QDesktopWidget>
ContextDialog::ContextDialog(CinemaSchedule *cinema_schedule, QWidget *parent) :
QDialog(parent),
connect(ui->find_route_to_theater, SIGNAL(clicked()), this, SLOT(FindRouteToTheater()));
connect(ui->search_movie_in_web, SIGNAL(clicked()), this, SLOT(SearchMovieInWeb()));
connect(ui->search_theater_in_web, SIGNAL(clicked()), this, SLOT(SearchTheaterInWeb()));
+ connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(Rotate()));
+ Rotate();
}
ContextDialog::~ContextDialog()
void ContextDialog::addWidget(QWidget *widget)
{
+ bool landscape = UiUtils::IsLandscape();
widget->setVisible(true);
ui->gridLayout->addWidget(widget, _next_row, _next_column, 1, 1);
++_next_column;
- if (_next_column > 1) {
+ if (_next_column > (landscape ? 1 : 0)) {
++_next_row;
_next_column = 0;
}
hide();
emit SearchTheaterInWeb(_schedule_entry_key.GetCinemaKey());
}
+
+void ContextDialog::Rotate()
+{
+ if (isVisible()) {
+ Show(_schedule_entry_key);
+ }
+}
Q_SLOT void SearchMovieInWeb();
Q_SLOT void SearchTheaterInWeb();
+ Q_SLOT void Rotate();
+
private:
Ui::ContextDialog *ui;
CinemaSchedule *_cinema_schedule;
#include "locationdialog.h"
#include "ui_locationdialog.h"
+#include "uiutils.h"
+
+#include <QDesktopWidget>
LocationDialog::LocationDialog(QWidget *parent) :
QDialog(parent),
_location_buttons.append(ui->Location3);
_location_buttons.append(ui->Location4);
_location_buttons.append(ui->Location5);
+ connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(Rotate()));
+ Rotate();
}
LocationDialog::~LocationDialog()
void LocationDialog::show()
{
+ bool landscape = UiUtils::IsLandscape();
ui->gridLayout->removeWidget(ui->GPS);
for (int i = 0; i < _location_buttons.size(); ++i) {
ui->gridLayout->removeWidget(_location_buttons[i]);
if (ui->GPS->isEnabled()) {
ui->gridLayout->addWidget(ui->GPS, row, column);
++column;
+ if (column > (landscape ? 1 : 0)) {
+ ++row;
+ column = 0;
+ }
}
for (int i = 0; i < _location_buttons.size(); ++i) {
if (_location_buttons[i]->isEnabled()) {
ui->gridLayout->addWidget(_location_buttons[i], row, column);
++column;
- if (column > 1) {
+ if (column > (landscape ? 1 : 0)) {
++row;
column = 0;
}
break;
}
}
+
+void LocationDialog::Rotate()
+{
+ bool landscape = UiUtils::IsLandscape();
+ ui->_search_layout->setDirection(landscape ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom);
+ ui->_button_box->setOrientation(landscape ? Qt::Vertical : Qt::Horizontal);
+ if (isVisible()) {
+ show();
+ }
+}
Q_SLOT void PreviousLocation4Clicked();
Q_SLOT void PreviousLocation5Clicked();
+ Q_SLOT void Rotate();
+
private:
void PreviousLocationClicked(int i);
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
- <property name="spacing">
- <number>4</number>
- </property>
- <property name="leftMargin">
- <number>16</number>
- </property>
- <property name="topMargin">
- <number>8</number>
- </property>
- <property name="rightMargin">
- <number>16</number>
- </property>
- <property name="bottomMargin">
- <number>8</number>
- </property>
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="spacing">
</layout>
</item>
<item>
- <layout class="QHBoxLayout">
- <property name="spacing">
- <number>4</number>
- </property>
- <item>
- <widget class="QLabel" name="CityLabel">
- <property name="text">
- <string>City</string>
- </property>
- </widget>
- </item>
+ <layout class="QHBoxLayout" name="_search_layout">
<item>
- <widget class="QLineEdit" name="Location">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="CityLabel">
+ <property name="text">
+ <string>City</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="Location">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<widget class="QDialogButtonBox" name="_button_box">
ui->menubar->addAction(tr("Movies"), this, SIGNAL(SearchMovies()));
ui->menubar->addAction(tr("Theaters"), this, SIGNAL(SearchTheaters()));
ui->menubar->addAction(tr("Location"), this, SIGNAL(OpenLocationDialog()));
+ ui->menubar->addAction(tr("Options"), this, SIGNAL(OpenOptionsDialog()));
ui->menubar->addAction(tr("About"), this, SIGNAL(OpenAboutDialog()));
_theater_context_menu = new QMenu(this);
_theater_phone_call = _theater_context_menu->addAction(tr("Call By Phone"), this, SLOT(CallTheaterByPhone()));
delete ui;
}
+void MainWindow::SetOrientation(Settings::OrientationMode orientation)
+{
+#ifdef Q_WS_MAEMO_5
+ switch (orientation) {
+ case Settings::LANDSCAPE:
+ setAttribute(Qt::WA_Maemo5LandscapeOrientation, true);
+ break;
+ case Settings::PORTRAIT:
+ setAttribute(Qt::WA_Maemo5PortraitOrientation, true);
+ break;
+ case Settings::AUTOROTATION:
+ setAttribute(Qt::WA_Maemo5AutoOrientation, true);
+ break;
+ }
+#else
+ Q_UNUSED(orientation);
+#endif
+}
+
void MainWindow::SetLocation(Location location)
{
_location = location;
#include "data/location.h"
#include "data/cinemakey.h"
#include "data/moviekey.h"
+#include "data/settings.h"
#include <QModelIndex>
~MainWindow();
public:
+ Q_SLOT void SetOrientation(Settings::OrientationMode orientation);
Q_SLOT void SetLocation(Location location);
Q_SLOT void SetTheaterModel(QAbstractItemModel *);
Q_SLOT void SetMovieModel(QAbstractItemModel *);
Q_SIGNAL void SearchTheaters();
Q_SIGNAL void SearchMovies();
Q_SIGNAL void OpenLocationDialog();
+ Q_SIGNAL void OpenOptionsDialog();
Q_SIGNAL void OpenAboutDialog();
Q_SIGNAL void TheaterSelected(CinemaKey);
Q_SIGNAL void MovieSelected(MovieKey);
--- /dev/null
+#include "optionsdialog.h"
+#include "ui_optionsdialog.h"
+#include "uiutils.h"
+
+#include <QMaemo5ValueButton>
+#include <QMaemo5ListPickSelector>
+#include <QStandardItem>
+#include <QBoxLayout>
+#include <QDesktopWidget>
+
+static QStandardItem *CreateItem(const QString &label)
+{
+ QStandardItem *item = new QStandardItem(label);
+ item->setTextAlignment(Qt::AlignCenter);
+ item->setEditable(false);
+ return item;
+}
+
+OptionsDialog::OptionsDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::OptionsDialog),
+ _rotation_model(new QStandardItemModel(0, 1, this)),
+ _rotation_selector(new QMaemo5ListPickSelector())
+{
+ ui->setupUi(this);
+ ui->_button_box->addButton(ui->_done_button, QDialogButtonBox::AcceptRole);
+ connect(ui->_button_box, SIGNAL(accepted()), this, SLOT(Accept()));
+ connect(ui->_button_box, SIGNAL(accepted()), this, SLOT(deleteLater()));
+ connect(ui->_button_box, SIGNAL(rejected()), this, SLOT(Cancel()));
+ connect(ui->_button_box, SIGNAL(rejected()), this, SLOT(deleteLater()));
+ ui->_rotation_combo_box->setValueLayout(QMaemo5ValueButton::ValueBesideText);
+ _rotation_model->appendRow(CreateItem(tr("Landscape")));
+ _rotation_model->appendRow(CreateItem(tr("Portrait")));
+ _rotation_model->appendRow(CreateItem(tr("Automatic Rotation")));
+ _rotation_selector->setModel(_rotation_model);
+ _rotation_selector->setCurrentIndex(0);
+ ui->_rotation_combo_box->setPickSelector(_rotation_selector);
+ connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(Rotate()));
+ Rotate();
+}
+
+OptionsDialog::~OptionsDialog()
+{
+ delete ui;
+}
+
+void OptionsDialog::SetSettings(const Settings &settings)
+{
+ _settings = settings;
+ int i = 0;
+ switch (_settings.GetOrientationMode()) {
+ case Settings::LANDSCAPE:
+ i = 0;
+ break;
+ case Settings::PORTRAIT:
+ i = 1;
+ break;
+ case Settings::AUTOROTATION:
+ i = 2;
+ break;
+ }
+ _rotation_selector->setCurrentIndex(i);
+}
+
+Settings OptionsDialog::GetSettings()
+{
+ switch (_rotation_selector->currentIndex()) {
+ case 0:
+ _settings.SetOrientationMode(Settings::LANDSCAPE);
+ break;
+ case 1:
+ _settings.SetOrientationMode(Settings::PORTRAIT);
+ break;
+ case 2:
+ _settings.SetOrientationMode(Settings::AUTOROTATION);
+ break;
+ }
+ return _settings;
+}
+
+void OptionsDialog::Accept()
+{
+ emit Accept(GetSettings());
+}
+
+void OptionsDialog::Cancel()
+{
+ emit Cancel(GetSettings());
+}
+
+void OptionsDialog::Rotate()
+{
+ bool landscape = UiUtils::IsLandscape();
+ ui->_dialog_layout->setDirection(landscape ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom);
+ ui->_button_box->setOrientation(landscape ? Qt::Vertical : Qt::Horizontal);
+ ui->_rotation_combo_box->setValueLayout(landscape ? QMaemo5ValueButton::ValueBesideText : QMaemo5ValueButton::ValueUnderText);
+ adjustSize();
+}
--- /dev/null
+#ifndef OPTIONSDIALOG_H
+#define OPTIONSDIALOG_H
+
+#include "data/settings.h"
+
+#include <QDialog>
+
+class QStandardItemModel;
+class QMaemo5ListPickSelector;
+
+namespace Ui {
+ class OptionsDialog;
+}
+
+class OptionsDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit OptionsDialog(QWidget *parent = 0);
+ ~OptionsDialog();
+
+ void SetSettings(const Settings &settings);
+ Settings GetSettings();
+
+public:
+ Q_SIGNAL void Accept(const Settings &);
+ Q_SIGNAL void Cancel(const Settings &);
+
+private:
+ Q_SLOT void Accept();
+ Q_SLOT void Cancel();
+ Q_SLOT void Rotate();
+
+private:
+ Ui::OptionsDialog *ui;
+ QStandardItemModel *_rotation_model;
+ QMaemo5ListPickSelector *_rotation_selector;
+ Settings _settings;
+};
+
+#endif // OPTIONSDIALOG_H
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OptionsDialog</class>
+ <widget class="QDialog" name="OptionsDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>131</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Options</string>
+ </property>
+ <layout class="QHBoxLayout" name="_dialog_layout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QMaemo5ValueButton" name="_rotation_combo_box">
+ <property name="text">
+ <string>Orientation</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="_button_box">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="_done_button">
+ <property name="text">
+ <string>Done</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>QMaemo5ValueButton</class>
+ <extends>QPushButton</extends>
+ <header location="global">QMaemo5ValueButton</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>_button_box</sender>
+ <signal>accepted()</signal>
+ <receiver>OptionsDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>_button_box</sender>
+ <signal>rejected()</signal>
+ <receiver>OptionsDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
{
Q_UNUSED(time);
#ifdef Q_WS_MAEMO_5
+ Q_UNUSED(palette);
return QMaemo5Style::standardColor("DefaultTextColor");
#else
QColor color = palette.color(QPalette::WindowText);
{
Q_UNUSED(date);
#ifdef Q_WS_MAEMO_5
+ Q_UNUSED(palette);
QColor color = QMaemo5Style::standardColor("DefaultTextColor");
color.setAlpha(160);
return color;
{
Q_UNUSED(date);
#ifdef Q_WS_MAEMO_5
+ Q_UNUSED(palette);
QColor color = QMaemo5Style::standardColor("DefaultTextColor");
color.setAlpha(48);
return color;
#include <QMessageBox>
#endif
+#include <QApplication>
+#include <QDesktopWidget>
+
UiUtils::UiUtils()
{
}
QMessageBox::critical(0, "Movie-Schedule", errormsg);
#endif
}
+
+bool UiUtils::IsLandscape()
+{
+ QRect screenGeometry = QApplication::desktop()->screenGeometry();
+ return (screenGeometry.width() > screenGeometry.height());
+}
+
+bool UiUtils::IsPortrait()
+{
+ return !IsLandscape();
+}
static void ShowError(const QString &errormsg);
+ static bool IsLandscape();
+
+ static bool IsPortrait();
};
#endif // UIUTILS_H