#include "optiondialog.h"
#include "time.h"
-//#define AVOID_INPUT_DIALOG 0
+//#define AVOID_INPUT_DIALOG
MainWindow::MainWindow()
: plman (this), settings (tr ("TomAmp"), "TomAmp"), isPlaying (false)
connect (&plman, SIGNAL (itemUpdated(int)), this, SLOT (itemUpdated (int)));
connect (&plman, SIGNAL (itemRemoved(int)), this, SLOT (itemRemoved (int)));
+ connect (QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged()));
+
Phonon::createPath(mediaObject, audioOutput);
qsrand (time (NULL));
setupShuffleList();
setupActions();
setupMenus();
-/* foreach (QString s, Phonon::BackendCapabilities::availableMimeTypes())
- qDebug () << s;*/
-/* if (settings.value("uiflipped", false).toBool())
- setupUiFlipped();
- else*/
+ QRect screenGeometry = QApplication::desktop()->screenGeometry();
+ portrait = screenGeometry.width() < screenGeometry.height();
setupUi ();
show ();
timeLcd->display("00:00:00");
#endif
}
+void MainWindow::orientationChanged()
+{
+ QRect screenGeometry = QApplication::desktop()->screenGeometry();
+ portrait = screenGeometry.width() < screenGeometry.height();
+ delete centralWidget();
+ setupUi();
+ int current = musicTable->currentRow();
+ playlistChanged(0);
+ musicTable->selectRow(current);
+}
+
+
void MainWindow::addFiles()
{
QString folder = settings.value("LastFolder").toString();
void MainWindow::addUrl()
{
#ifdef AVOID_INPUT_DIALOG
- QString url = "http://war.str3am.com:7970";
+ QString url = "http://streams.bigvibez.com:7000/listen.pls";
#else
QString url = QInputDialog::getText(this, "Get URL", "Please type in the stream URL");
#endif
void MainWindow::setupUi()
{
QToolBar *bar = new QToolBar;
- bool flip = settings.value("uiflipped", false).toBool();
+ bool flip = !portrait;
if(!flip) bar->setOrientation(Qt::Vertical);
bar->setStyleSheet("padding:7px");
void MainWindow::showOptions ()
{
- bool flip = settings.value("uiflipped", false).toBool();
OptionDialog* dlg = new OptionDialog (this, settings);
dlg->exec();
delete dlg;
- if (flip != settings.value("uiflipped", false).toBool())
- {
- delete centralWidget();
- setupUi ();
- }
setOrientation ();
if (headers != settings.value("headers", QStringList ()).toStringList())
{