#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);
+ }
+}