diff options
Diffstat (limited to 'PlayerWindow.cpp')
-rw-r--r-- | PlayerWindow.cpp | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/PlayerWindow.cpp b/PlayerWindow.cpp index 2954af2..c05f030 100644 --- a/PlayerWindow.cpp +++ b/PlayerWindow.cpp @@ -29,9 +29,7 @@ PlayerWindow::PlayerWindow(QWidget *parent, Qt::WindowFlags flags) setupPhonon(); } void PlayerWindow::setupUi() -{ - m_treeView = new AutoSizingList(this); - setCentralWidget(m_treeView); +{ m_playAction = new QAction(style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this); m_pauseAction = new QAction(style()->standardIcon(QStyle::SP_MediaPause), tr("Pause"), this); m_stopAction = new QAction(style()->standardIcon(QStyle::SP_MediaStop), tr("Stop"), this); @@ -47,45 +45,42 @@ void PlayerWindow::setupUi() m_stopAction->setDisabled(true); m_nextAction->setDisabled(true); m_previousAction->setDisabled(true); + //TODO: change to volumemediamute on 0 volume + m_volumeSlider = new Phonon::VolumeSlider(this); + m_volumeSlider->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + QLabel *volumeLabel = new QLabel(this); + volumeLabel->setPixmap(style()->standardIcon(QStyle::SP_MediaVolume).pixmap(16)); + m_seekSlider = new Phonon::SeekSlider(this); - QVBoxLayout *toolBars = new QVBoxLayout; - toolBars->setSpacing(0); - toolBars->setMargin(0); - QToolBar *toolBar = new QToolBar; + QToolBar *toolBar = new QToolBar(this); toolBar->addAction(m_previousAction); toolBar->addAction(m_playAction); //TODO: make it play/pause one button toolBar->addAction(m_pauseAction); toolBar->addAction(m_stopAction); toolBar->addAction(m_nextAction); - m_seekSlider = new Phonon::SeekSlider(this); toolBar->addWidget(m_seekSlider); - QLabel *volumeLabel = new QLabel(this); - volumeLabel->setPixmap(style()->standardIcon(QStyle::SP_MediaVolume).pixmap(16)); //TODO: change to volumemediamute on 0 volume toolBar->addWidget(volumeLabel); - m_volumeSlider = new Phonon::VolumeSlider(this); - m_volumeSlider->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); toolBar->addWidget(m_volumeSlider); toolBar->setIconSize(QSize(16, 16)); toolBar->setMovable(false); - toolBars->addWidget(toolBar); + addToolBar(toolBar); + + QWidget *centralWidget = new QWidget(this); + QVBoxLayout *layout = new QVBoxLayout; + layout->setSpacing(0); + layout->setMargin(0); m_searchEdit = new SearchLineEdit(this); m_searchEdit->setDisabled(true); m_searchEdit->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); connect(m_searchEdit, SIGNAL(textChanged(const QString&)), this, SLOT(searchChanged(const QString&))); + layout->addWidget(m_searchEdit); m_searchTimer.setSingleShot(true); m_searchTimer.setInterval(300); connect(&m_searchTimer, SIGNAL(timeout()), this, SLOT(updateSearch())); - toolBars->addWidget(m_searchEdit); - toolBar = new QToolBar; - toolBar->setMovable(false); - QWidget *toolBarWidget = new QWidget; - toolBarWidget->setLayout(toolBars); - toolBar->addWidget(toolBarWidget); - addToolBar(toolBar); - setUnifiedTitleAndToolBarOnMac(true); - setMinimumSize(500, 400); - setWindowTitle("ZX2C4 Music Player"); - setWindowIcon(style()->standardIcon(QStyle::SP_DriveCDIcon)); + m_treeView = new AutoSizingList(this); + layout->addWidget(m_treeView); + centralWidget->setLayout(layout); + setCentralWidget(centralWidget); m_downloadProgress = new QProgressBar; statusBar()->addWidget(m_downloadProgress, 1); @@ -97,6 +92,9 @@ void PlayerWindow::setupUi() m_credentials->setStatusBar(statusBar()); m_credentials->show(); + setMinimumSize(500, 400); + setWindowTitle("ZX2C4 Music Player"); + setWindowIcon(style()->standardIcon(QStyle::SP_DriveCDIcon)); show(); } void PlayerWindow::setupPhonon() |