From: Nikolay Tischenko Date: Sat, 9 Oct 2010 13:47:55 +0000 (+0700) Subject: Version 1.3.5 X-Git-Tag: 1.3.5 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=refs%2Ftags%2F1.3.5;p=someplayer Version 1.3.5 * Fixed bug with unpausing when equalizer settings changed * Improved UI * Removed icons theme support --- diff --git a/resources/black/add.png b/resources/black/add.png deleted file mode 100644 index a098819..0000000 Binary files a/resources/black/add.png and /dev/null differ diff --git a/resources/black/artists.png b/resources/black/artists.png deleted file mode 100644 index 61c03cf..0000000 Binary files a/resources/black/artists.png and /dev/null differ diff --git a/resources/black/back.png b/resources/black/back.png deleted file mode 100644 index 43d1f1f..0000000 Binary files a/resources/black/back.png and /dev/null differ diff --git a/resources/black/delete.png b/resources/black/delete.png deleted file mode 100644 index 74daaa2..0000000 Binary files a/resources/black/delete.png and /dev/null differ diff --git a/resources/black/deselect_all.png b/resources/black/deselect_all.png deleted file mode 100644 index 7c68419..0000000 Binary files a/resources/black/deselect_all.png and /dev/null differ diff --git a/resources/black/dynamic.png b/resources/black/dynamic.png deleted file mode 100644 index badb712..0000000 Binary files a/resources/black/dynamic.png and /dev/null differ diff --git a/resources/black/fav.png b/resources/black/fav.png deleted file mode 100644 index cd5d5b8..0000000 Binary files a/resources/black/fav.png and /dev/null differ diff --git a/resources/black/forward.png b/resources/black/forward.png deleted file mode 100644 index fccf7d9..0000000 Binary files a/resources/black/forward.png and /dev/null differ diff --git a/resources/black/fullscreen.png b/resources/black/fullscreen.png deleted file mode 100644 index cd51d5b..0000000 Binary files a/resources/black/fullscreen.png and /dev/null differ diff --git a/resources/black/library.png b/resources/black/library.png deleted file mode 100644 index c84ea85..0000000 Binary files a/resources/black/library.png and /dev/null differ diff --git a/resources/black/next.png b/resources/black/next.png deleted file mode 100644 index 10275d3..0000000 Binary files a/resources/black/next.png and /dev/null differ diff --git a/resources/black/pause.png b/resources/black/pause.png deleted file mode 100644 index 7a27e3d..0000000 Binary files a/resources/black/pause.png and /dev/null differ diff --git a/resources/black/play.png b/resources/black/play.png deleted file mode 100644 index 4d9cbf5..0000000 Binary files a/resources/black/play.png and /dev/null differ diff --git a/resources/black/playback.png b/resources/black/playback.png deleted file mode 100644 index d5ebe27..0000000 Binary files a/resources/black/playback.png and /dev/null differ diff --git a/resources/black/player.png b/resources/black/player.png deleted file mode 100644 index 2c14632..0000000 Binary files a/resources/black/player.png and /dev/null differ diff --git a/resources/black/playlist.png b/resources/black/playlist.png deleted file mode 100644 index 39f80b6..0000000 Binary files a/resources/black/playlist.png and /dev/null differ diff --git a/resources/black/playlists.png b/resources/black/playlists.png deleted file mode 100644 index 3347025..0000000 Binary files a/resources/black/playlists.png and /dev/null differ diff --git a/resources/black/prev.png b/resources/black/prev.png deleted file mode 100644 index b1d4e3c..0000000 Binary files a/resources/black/prev.png and /dev/null differ diff --git a/resources/black/random_active.png b/resources/black/random_active.png deleted file mode 100644 index aae80aa..0000000 Binary files a/resources/black/random_active.png and /dev/null differ diff --git a/resources/black/random_inactive.png b/resources/black/random_inactive.png deleted file mode 100644 index ea8f9ed..0000000 Binary files a/resources/black/random_inactive.png and /dev/null differ diff --git a/resources/black/repeat_active.png b/resources/black/repeat_active.png deleted file mode 100644 index f574f11..0000000 Binary files a/resources/black/repeat_active.png and /dev/null differ diff --git a/resources/black/repeat_inactive.png b/resources/black/repeat_inactive.png deleted file mode 100644 index 66e78e4..0000000 Binary files a/resources/black/repeat_inactive.png and /dev/null differ diff --git a/resources/black/search.png b/resources/black/search.png deleted file mode 100644 index 413387d..0000000 Binary files a/resources/black/search.png and /dev/null differ diff --git a/resources/black/select_all.png b/resources/black/select_all.png deleted file mode 100644 index ef60283..0000000 Binary files a/resources/black/select_all.png and /dev/null differ diff --git a/resources/black/stop.png b/resources/black/stop.png deleted file mode 100644 index 3d90ff5..0000000 Binary files a/resources/black/stop.png and /dev/null differ diff --git a/resources/black/use.png b/resources/black/use.png deleted file mode 100644 index 8a1f5ce..0000000 Binary files a/resources/black/use.png and /dev/null differ diff --git a/resources/black/volume.png b/resources/black/volume.png deleted file mode 100644 index 77915cf..0000000 Binary files a/resources/black/volume.png and /dev/null differ diff --git a/resources/black/window.png b/resources/black/window.png deleted file mode 100644 index 4540929..0000000 Binary files a/resources/black/window.png and /dev/null differ diff --git a/resources/resources.qrc b/resources/resources.qrc index 2e0d132..ef6f4a5 100644 --- a/resources/resources.qrc +++ b/resources/resources.qrc @@ -28,33 +28,7 @@ white/use.png white/volume.png white/window.png - black/add.png - black/artists.png - black/back.png - black/delete.png - black/deselect_all.png - black/dynamic.png - black/fav.png - black/forward.png - black/library.png - black/next.png - black/pause.png - black/play.png - black/playback.png - black/player.png - black/playlist.png - black/playlists.png - black/prev.png - black/random_active.png - black/random_inactive.png - black/repeat_active.png - black/repeat_inactive.png - black/search.png - black/select_all.png - black/stop.png - black/use.png - black/volume.png - black/window.png - black/fullscreen.png + white/more.png + white/unmore.png diff --git a/resources/white/more.png b/resources/white/more.png new file mode 100644 index 0000000..0d2b17a Binary files /dev/null and b/resources/white/more.png differ diff --git a/resources/white/unmore.png b/resources/white/unmore.png new file mode 100644 index 0000000..6b5ca1d Binary files /dev/null and b/resources/white/unmore.png differ diff --git a/someplayer.pro b/someplayer.pro index 2aae545..edadcf2 100644 --- a/someplayer.pro +++ b/someplayer.pro @@ -121,7 +121,8 @@ SOURCES += src/main.cpp\ src/equalizerdialog.cpp \ src/saveplaylistdialog.cpp \ src/settingsdialog.cpp \ - src/dbusadaptor.cpp + src/dbusadaptor.cpp \ + src/toolswidget.cpp HEADERS += src/mainwindow.h \ src/player/player.h \ @@ -221,7 +222,8 @@ HEADERS += src/mainwindow.h \ src/saveplaylistdialog.h \ src/settingsdialog.h \ src/abstractitemrenderer.h \ - src/dbusadaptor.h + src/dbusadaptor.h \ + src/toolswidget.h FORMS += src/ui/mainwindow.ui \ src/ui/playerform.ui \ @@ -232,7 +234,8 @@ FORMS += src/ui/mainwindow.ui \ src/ui/timerdialog.ui \ src/ui/equalizerdialog.ui \ src/ui/saveplaylistdialog.ui \ - src/ui/settingsdialog.ui + src/ui/settingsdialog.ui \ + src/ui/toolswidget.ui CONFIG += mobility MOBILITY = diff --git a/src/config.cpp b/src/config.cpp index 03e3da7..286cca1 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -26,9 +26,6 @@ using namespace SomePlayer::Storage; Config::Config() { _settings = new QSettings(QString(applicationDir())+"/settings.ini", QSettings::IniFormat); - if (_settings->value("ui/iconstheme").toString() == "") { - _settings->setValue("ui/iconstheme", "white"); - } } Config::~Config() { diff --git a/src/equalizerdialog.cpp b/src/equalizerdialog.cpp index f583d4e..1e4cc5f 100644 --- a/src/equalizerdialog.cpp +++ b/src/equalizerdialog.cpp @@ -204,3 +204,15 @@ void EqualizerDialog::_load_preset(QString name) { ui->band9Slider->setValue(config.getValue("equalizer_preset_"+name+"/band9").toInt()); _value9_changed(ui->band9Slider->value()); } + +void EqualizerDialog::landscapeMode() { + ui->thorizontalLayout->insertWidget(0, ui->enableToggleButton); + ui->thorizontalLayout->addWidget(ui->saveButton); + ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer); +} + +void EqualizerDialog::portraitMode() { + ui->bhorizontalLayout->insertWidget(0, ui->enableToggleButton); + ui->bhorizontalLayout->addItem(ui->chorizontalSpacer); + ui->bhorizontalLayout->addWidget(ui->saveButton); +} diff --git a/src/equalizerdialog.h b/src/equalizerdialog.h index 658e60e..e5df486 100644 --- a/src/equalizerdialog.h +++ b/src/equalizerdialog.h @@ -41,6 +41,8 @@ public slots: void setValue(int, int); void setEqualizerEnabled(bool); void reloadPresets(); + void landscapeMode(); + void portraitMode(); private slots: void _value0_changed(int v) { emit valueChanged(0, v);} diff --git a/src/libraryform.cpp b/src/libraryform.cpp index bb190f1..e7e3384 100644 --- a/src/libraryform.cpp +++ b/src/libraryform.cpp @@ -27,9 +27,11 @@ #include "track.h" #include "playlist.h" #include +#include #include #include #include "config.h" +#include using namespace SomePlayer::DataObjects; using namespace SomePlayer::Storage; @@ -72,22 +74,27 @@ LibraryForm::LibraryForm(Library *lib, QWidget *parent) : _lib = lib; _model = new QStandardItemModel(this); _state = STATE_NONE; + _tools_widget = new ToolsWidget(this); ui->setupUi(this); + ui->toolsLayout->addWidget(_tools_widget); + _tools_widget->hide(); connect(ui->playerButton, SIGNAL(clicked()), this, SLOT(_player())); connect(ui->viewButton, SIGNAL(clicked()), this, SLOT(_view_button())); connect(ui->playlistsButton, SIGNAL(clicked()), this, SLOT(_playlists_button())); connect(ui->dynamicButton, SIGNAL(clicked()), this, SLOT(_dynamic_button())); - connect(ui->listView, SIGNAL(clicked(QModelIndex)), this, SLOT(_process_list_click(QModelIndex))); + connect(ui->listView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(_process_list_click(QModelIndex))); connect(ui->addButton, SIGNAL(clicked()), this, SLOT(_add_button())); connect(ui->selectAllButton, SIGNAL(clicked()), this, SLOT(_toggle_select_all_button())); connect(ui->backButton, SIGNAL(clicked()), this, SLOT(_back_button())); connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(_delete_button())); connect(ui->useButton, SIGNAL(clicked()), this, SLOT(_use_button())); + connect(_tools_widget, SIGNAL(search(QString)), this, SLOT(search(QString))); + connect(_tools_widget, SIGNAL(nextSearch()), this, SLOT(nextItem())); + connect(_tools_widget, SIGNAL(prevSearch()), this, SLOT(prevItem())); + connect(_tools_widget, SIGNAL(toggleFullscreen(bool)), this, SIGNAL(fullscreen(bool))); + connect(ui->moreButton, SIGNAL(clicked()), this, SLOT(_more_button())); _view_button(); - Config config; - _icons_theme = config.getValue("ui/iconstheme").toString(); _current_playlist_changed = true; - setAttribute(Qt::WA_Maemo5StackedWindow); } LibraryForm::~LibraryForm() @@ -107,18 +114,24 @@ void LibraryForm::_view_button() { __fill_model(_model, artitst); ui->listView->setModel(_model); _state = STATE_ARTIST; - ui->backButton->hide(); + ui->backButton->setEnabled(false); ui->listLabel->setText("Artists"); - ui->addButton->show(); - ui->deleteButton->hide(); - ui->useButton->hide(); + ui->addButton->setEnabled(true); + ui->addButton->setIcon(QIcon(":/icons/white/add.png")); + ui->deleteButton->setEnabled(false); + ui->deleteButton->setIcon(QIcon()); + ui->useButton->setEnabled(false); + ui->useButton->setIcon(QIcon()); } void LibraryForm::_dynamic_button() { - ui->useButton->hide(); - ui->backButton->hide(); - ui->addButton->show(); - ui->deleteButton->hide(); + ui->useButton->setEnabled(false); + ui->useButton->setIcon(QIcon()); + ui->backButton->setEnabled(false); + ui->addButton->setEnabled(true); + ui->addButton->setIcon(QIcon(":/icons/white/add.png")); + ui->deleteButton->setEnabled(false); + ui->deleteButton->setIcon(QIcon()); _model->clear(); _model->setRowCount(4); _model->setItem(0, new QStandardItem("Favorites")); @@ -138,7 +151,7 @@ void LibraryForm::_process_list_click(QModelIndex index) { ui->listView->scrollToTop(); _current_artist = data; _state = STATE_ALBUM; - ui->backButton->show(); + ui->backButton->setEnabled(true); ui->listLabel->setText(QString("Albums by \"%1\"").arg(_current_artist)); break; case STATE_ALBUM: @@ -147,7 +160,7 @@ void LibraryForm::_process_list_click(QModelIndex index) { __fill_model_tracks(_model, _current_tracks); ui->listView->scrollToTop(); _state = STATE_TRACK; - ui->backButton->show(); + ui->backButton->setEnabled(true); ui->listLabel->setText(QString("Tracks from \"%1\" by \"%2\"").arg(_current_album).arg(_current_artist)); break; case STATE_PLAYLIST: @@ -157,9 +170,11 @@ void LibraryForm::_process_list_click(QModelIndex index) { __fill_model_tracks(_model, _current_tracks); ui->listView->scrollToTop(); _state = STATE_PLAYLIST_TRACK; - ui->backButton->show(); - ui->deleteButton->show(); - ui->useButton->show(); + ui->backButton->setEnabled(true); + ui->deleteButton->setEnabled(true); + ui->deleteButton->setIcon(QIcon(":/icons/white/delete.png")); + ui->useButton->setEnabled(true); + ui->useButton->setIcon(QIcon(":/icons/white/use.png")); ui->listLabel->setText(QString("Tracks in playlist \"%1\"").arg(data)); } break; @@ -184,14 +199,17 @@ void LibraryForm::_process_list_click(QModelIndex index) { __fill_model_tracks(_model, _current_tracks); ui->listView->scrollToTop(); _state = STATE_PLAYLIST_TRACK; - ui->backButton->show(); - ui->useButton->show(); - ui->addButton->show(); + ui->backButton->setEnabled(true); + ui->useButton->setEnabled(true); + ui->useButton->setIcon(QIcon(":/icons/white/use.png")); + ui->addButton->setEnabled(true); + ui->addButton->setIcon(QIcon(":/icons/white/add.png")); ui->listLabel->setText(_current_playlist.name()); } default: return; } + QTimer::singleShot(100, ui->listView, SLOT(clearSelection())); // workaround } void LibraryForm::_add_button() { @@ -287,11 +305,14 @@ void LibraryForm::_playlists_button() { __fill_model(_model, playlists); ui->listView->setModel(_model); _state = STATE_PLAYLIST; - ui->backButton->hide(); + ui->backButton->setEnabled(false); ui->listLabel->setText("Playlists"); - ui->addButton->hide(); - ui->deleteButton->show(); - ui->useButton->hide(); + ui->addButton->setEnabled(false); + ui->addButton->setIcon(QIcon()); + ui->deleteButton->setEnabled(true); + ui->deleteButton->setIcon(QIcon(":/icons/white/delete.png")); + ui->useButton->setEnabled(false); + ui->useButton->setIcon(QIcon()); } void LibraryForm::_delete_button() { @@ -309,6 +330,7 @@ void LibraryForm::_delete_button() { } _current_tracks = _current_playlist.tracks(); _lib->savePlaylist(_current_playlist); + _current_playlist_changed = true; __fill_model_tracks(_model, _current_tracks); } else if (_state == STATE_PLAYLIST) { QModelIndexList selected = ui->listView->selectionModel()->selectedIndexes(); @@ -341,7 +363,7 @@ void LibraryForm::_use_button() { _current_playlist = _lib->getCurrentPlaylist(); } -void LibraryForm::search(QString &pattern) { +void LibraryForm::search(QString pattern) { _search_pattern = pattern; _search_current_id = -1; nextItem(); @@ -413,26 +435,26 @@ void LibraryForm::refresh() { void LibraryForm::_toggle_select_all_button() { if (ui->listView->selectionModel()->selectedIndexes().count() == ui->listView->model()->rowCount()) { ui->listView->selectionModel()->clearSelection(); - ui->selectAllButton->setIcon(QIcon(":/icons/"+_icons_theme+"/select_all.png")); + ui->selectAllButton->setIcon(QIcon(":/icons/white/select_all.png")); } else { ui->listView->selectAll(); - ui->selectAllButton->setIcon(QIcon(":/icons/"+_icons_theme+"/deselect_all.png")); + ui->selectAllButton->setIcon(QIcon(":/icons/white/deselect_all.png")); } } -void LibraryForm::updateIcons() { - Config config; - _icons_theme = config.getValue("ui/iconstheme").toString(); - ui->backButton->setIcon(QIcon(":/icons/"+_icons_theme+"/back.png")); - if (ui->listView->selectionModel()->selectedIndexes().count() == ui->listView->model()->rowCount()) - ui->selectAllButton->setIcon(QIcon(":/icons/"+_icons_theme+"/deselect_all.png")); - else - ui->selectAllButton->setIcon(QIcon(":/icons/"+_icons_theme+"/select_all.png")); - ui->addButton->setIcon(QIcon(":/icons/"+_icons_theme+"/add.png")); - ui->deleteButton->setIcon(QIcon(":/icons/"+_icons_theme+"/delete.png")); - ui->useButton->setIcon(QIcon(":/icons/"+_icons_theme+"/use.png")); - ui->playerButton->setIcon(QIcon(":/icons/"+_icons_theme+"/player.png")); - ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/artists.png")); - ui->dynamicButton->setIcon(QIcon(":/icons/"+_icons_theme+"/dynamic.png")); - ui->playlistsButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playlists.png")); +void LibraryForm::landscapeMode() { +} + +void LibraryForm::portraitMode() { +} + +void LibraryForm::_more_button() { + if (_tools_widget->isVisible()) { + ui->moreButton->setIcon(QIcon(":/icons/white/more.png")); + _tools_widget->hide(); + cancelSearch(); + } else { + ui->moreButton->setIcon(QIcon(":/icons/white/unmore.png")); + _tools_widget->show(); + } } diff --git a/src/libraryform.h b/src/libraryform.h index 6753c9f..4f8e25b 100644 --- a/src/libraryform.h +++ b/src/libraryform.h @@ -27,6 +27,7 @@ #include #include #include "playlist.h" +#include "toolswidget.h" namespace Ui { class LibraryForm; @@ -49,13 +50,15 @@ signals: void player(bool); void busy(QString); void done(); + void fullscreen(bool); public slots: - void search(QString &); + void search(QString); void nextItem(); void prevItem(); void cancelSearch(); void refresh(); - void updateIcons(); + void landscapeMode(); + void portraitMode(); private slots: void _player(); void _view_button(); @@ -67,9 +70,10 @@ private slots: void _back_button(); void _use_button(); void _process_list_click(QModelIndex); + void _more_button(); private: - Ui::LibraryForm *ui; + Ui::LibraryForm *ui; Library *_lib; QStandardItemModel *_model; LibraryFormListState _state; @@ -80,13 +84,13 @@ private: QString _search_pattern; int _search_current_id; bool _current_playlist_changed; + ToolsWidget *_tools_widget; void _add_artist(QString artist); void _add_album(QString artist, QString album); void _add_track(Track track); void _add_playlist(QString name); void _delete_track(Track track); - QString _icons_theme; }; #endif // LIBRARYFORM_H diff --git a/src/main.cpp b/src/main.cpp index 84fb50f..2d46863 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,7 +25,8 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); a.setApplicationName("ru.somebody.someplayer"); MainWindow w; - + w.setAttribute(Qt::WA_Maemo5StackedWindow); + w.setWindowFlags(w.windowFlags() | Qt::Window); #if defined(Q_WS_S60) w.showMaximized(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f704c25..f962a56 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -41,7 +41,6 @@ MainWindow::MainWindow(QWidget *parent) : ui(new Ui::MainWindow) { Config config; - _icons_theme = config.getValue("ui/iconstheme").toString(); _library = new Library(config.applicationDir(), config.applicationDir()); ui->setupUi(this); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); @@ -75,24 +74,32 @@ MainWindow::MainWindow(QWidget *parent) : connect(_library, SIGNAL(trackAdded()), _busy_widget, SLOT(tick())); connect(_library_form, SIGNAL(done()), this, SLOT(library())); connect(_library_form, SIGNAL(busy(QString)), this, SLOT(showBusyWidget(QString))); - connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(_toggle_search_line())); - connect(_player_form, SIGNAL(showSearchPanel()), this, SLOT(showSearchPanel())); - connect(_player_form, SIGNAL(hideSearchPanel()), this, SLOT(hideSearchPanel())); - connect(ui->searchLine, SIGNAL(textChanged(QString)), this, SLOT(_search(QString))); - connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(_nextItem())); - connect(ui->prevButton, SIGNAL(clicked()), this, SLOT(_prevItem())); - connect(ui->fscreenButton, SIGNAL(clicked()), this, SLOT(_toggle_full_screen())); connect(_timer, SIGNAL(timeout()), this, SLOT(_timeout())); connect(_equalizer_dialog, SIGNAL(valueChanged(int,int)), this, SLOT(_equalizer_value_changed(int, int))); connect(_equalizer_dialog, SIGNAL(equalizerEnabled()), _player_form, SLOT(enableEqualizer())); connect(_equalizer_dialog, SIGNAL(equalizerDisabled()), _player_form, SLOT(disableEqualizer())); connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(_orientation_changed())); - updateIcons(); - _library_form->updateIcons(); - _player_form->updateIcons(); - hideSearchPanel(); + connect(_player_form, SIGNAL(fullscreen(bool)), this, SLOT(_fullscreen(bool))); + connect(_library_form, SIGNAL(fullscreen(bool)), this, SLOT(_fullscreen(bool))); _player_form->reload(true); library(); + QString mode = config.getValue("ui/orientation").toString(); + if (mode == "landscape") { + setAttribute(Qt::WA_Maemo5LandscapeOrientation); + _player_form->landscapeMode(); + _library_form->landscapeMode(); + _equalizer_dialog->landscapeMode(); + } else if (mode == "portrait") { + setAttribute(Qt::WA_Maemo5PortraitOrientation); + _player_form->portraitMode(); + _library_form->portraitMode(); + _equalizer_dialog->portraitMode(); + } else if (mode == "auto") { // initialization in landscape + _player_form->landscapeMode(); + _library_form->landscapeMode(); + _equalizer_dialog->landscapeMode(); + setAttribute(Qt::WA_Maemo5AutoOrientation); + } } MainWindow::~MainWindow() @@ -109,19 +116,17 @@ void MainWindow::about() { } void MainWindow::player(bool reread) { - Config config; - setAttribute(Qt::WA_Maemo5AutoOrientation, config.getValue("ui/portraitmode").toString() != "disabled"); ui->stackedWidget->setCurrentIndex(0); _player_form->reload(reread); setWindowTitle("SomePlayer"); + _orientation_changed(); // workaround } void MainWindow::library() { - setAttribute(Qt::WA_Maemo5AutoOrientation, false); ui->menuBar->setEnabled(true); ui->stackedWidget->setCurrentIndex(1); - showSearchPanel(); setWindowTitle("SomePlayer Library"); + _orientation_changed(); // workaround } void MainWindow::_add_directory() { @@ -175,80 +180,9 @@ void MainWindow::_clear_current_playlist() { void MainWindow::showBusyWidget(QString caption) { _busy_widget->setText(caption); ui->menuBar->setEnabled(false); - hideSearchPanel(); ui->stackedWidget->setCurrentIndex(2); } -void MainWindow::_toggle_search_line() { - if (ui->searchLine->isVisible()) { - ui->searchLine->setText(""); - ui->searchLine->hide(); - ui->nextButton->hide(); - ui->prevButton->hide(); - _cancelSearch(); - } else { - ui->searchLine->show(); - ui->nextButton->show(); - ui->prevButton->show(); - ui->searchLine->setFocus(Qt::MouseFocusReason); - } -} - -void MainWindow::showSearchPanel() { - ui->searchButton->show(); -} - -void MainWindow::hideSearchPanel() { - ui->searchLine->setText(""); - ui->searchLine->hide(); - ui->nextButton->hide(); - ui->prevButton->hide(); - ui->searchButton->hide(); - _cancelSearch(); -} - -void MainWindow::_search(QString pattern) { - if (ui->stackedWidget->currentIndex() == 0) { // player - _player_form->search(pattern); - } else if (ui->stackedWidget->currentIndex() == 1) { // library - _library_form->search(pattern); - } -} - -void MainWindow::_nextItem() { - if (ui->stackedWidget->currentIndex() == 0) { // player - _player_form->nextItem(); - } else if (ui->stackedWidget->currentIndex() == 1) { // library - _library_form->nextItem(); - } -} - -void MainWindow::_prevItem() { - if (ui->stackedWidget->currentIndex() == 0) { // player - _player_form->prevItem(); - } else if (ui->stackedWidget->currentIndex() == 1) { // library - _library_form->prevItem(); - } -} - -void MainWindow::_cancelSearch() { - if (ui->stackedWidget->currentIndex() == 0) { // player - _player_form->cancelSearch(); - } else if (ui->stackedWidget->currentIndex() == 1) { // library - _library_form->cancelSearch(); - } -} - -void MainWindow::_toggle_full_screen() { - if (isFullScreen()) { - ui->fscreenButton->setIcon(QIcon(":/icons/"+_icons_theme+"/fullscreen.png")); - showNormal(); - } else { - ui->fscreenButton->setIcon(QIcon(":/icons/"+_icons_theme+"/window.png")); - showFullScreen(); - } -} - void MainWindow::_add_files() { QStringList files = QFileDialog::getOpenFileNames(this, "Add file"); if (!files.isEmpty()) _player_form->addFiles(files); @@ -304,33 +238,32 @@ void MainWindow::_equalizer_value_changed(int band, int val) { void MainWindow::settings() { SettingsDialog dialog; dialog.exec(); - updateIcons(); Config config; - _player_form->updateIcons(); - _library_form->updateIcons(); _library_form->refresh(); - if (ui->stackedWidget->currentIndex() == 0) { // player view - setAttribute(Qt::WA_Maemo5AutoOrientation, config.getValue("ui/portraitmode").toString() != "disabled"); + QString mode = config.getValue("ui/orientation").toString(); + if (mode == "landscape") { + setAttribute(Qt::WA_Maemo5LandscapeOrientation); + } else if (mode == "portrait") { + setAttribute(Qt::WA_Maemo5PortraitOrientation); + } else if (mode == "auto") { + setAttribute(Qt::WA_Maemo5AutoOrientation); } } -void MainWindow::updateIcons() { - Config config; - _icons_theme = config.getValue("ui/iconstheme").toString(); - ui->fscreenButton->setIcon(QIcon(":/icons/"+_icons_theme+"/fullscreen.png")); - ui->prevButton->setIcon(QIcon(":/icons/"+_icons_theme+"/back.png")); - ui->nextButton->setIcon(QIcon(":/icons/"+_icons_theme+"/forward.png")); - ui->searchButton->setIcon(QIcon(":/icons/"+_icons_theme+"/search.png")); - -} - void MainWindow::_orientation_changed() { QRect screenGeometry = QApplication::desktop()->screenGeometry(); if (screenGeometry.width() > screenGeometry.height()) { _player_form->landscapeMode(); - ui->toolsWidget->setVisible(true); + _library_form->landscapeMode(); + _equalizer_dialog->landscapeMode(); } else { _player_form->portraitMode(); - ui->toolsWidget->setVisible(false); + _library_form->portraitMode(); + _equalizer_dialog->portraitMode(); } } + +void MainWindow::_fullscreen(bool f) { + if (f) showFullScreen(); + else showNormal(); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 3a59d25..7fc05dd 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -56,25 +56,17 @@ public slots: void library(); void settings(); void showBusyWidget(QString); - void showSearchPanel(); - void hideSearchPanel(); - void updateIcons(); private slots: void _add_directory(); void _save_playlist(); void _clear_current_playlist(); void _add_files(); - void _toggle_search_line(); - void _search(QString); - void _nextItem(); - void _prevItem(); - void _cancelSearch(); - void _toggle_full_screen(); void _set_timer(); void _timeout(); void _equalizer(); void _equalizer_value_changed(int, int); void _orientation_changed(); + void _fullscreen(bool); private: PlayerForm *_player_form; LibraryForm *_library_form; @@ -82,8 +74,6 @@ private: Library *_library; QTimer *_timer; EqualizerDialog *_equalizer_dialog; - - QString _icons_theme; }; #endif // MAINWINDOW_H diff --git a/src/player/player.cpp b/src/player/player.cpp index 80fc64e..e34b2cd 100644 --- a/src/player/player.cpp +++ b/src/player/player.cpp @@ -278,6 +278,8 @@ void Player::enableEqualizer() { return; _equalizer_enabled = true; _path.insertEffect(_equalizer); + if (_state == PLAYER_PAUSED) + pause(); Config config; config.setValue("equalizer/equalizer", "enabled"); } diff --git a/src/playerform.cpp b/src/playerform.cpp index 3bf359c..3c5f3dd 100644 --- a/src/playerform.cpp +++ b/src/playerform.cpp @@ -27,6 +27,7 @@ #include #include "playlistdialog.h" #include "edittagsdialog.h" +#include #include "config.h" using namespace SomePlayer::DataObjects; @@ -38,9 +39,11 @@ inline void __fill_list(QStandardItemModel *_model, Playlist playlist) { QList tracks = playlist.tracks(); int count = tracks.count(); _model->setRowCount(count); + QTime time; for (int i = 0; i < count; i++) { TrackMetadata meta = tracks.at(i).metadata(); - QString t = meta.title()+"#_#"+meta.artist()+"#_#"+meta.album(); + time.setHMS(0, meta.length()/60, meta.length() % 60); + QString t = meta.title()+"#_#"+meta.artist()+"#_#"+meta.album()+"#_#"+time.toString("mm:ss"); _model->setItem(i, 0, new QStandardItem(t)); } } @@ -52,26 +55,25 @@ PlayerForm::PlayerForm(Library* lib, QWidget *parent) : _lib = lib; _player = new Player(this); _time = new QTime(); - Config config; - _icons_theme = config.getValue("ui/iconstheme").toString(); ui->setupUi(this); if (_player->random()) { - ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_active.png")); + ui->randomButton->setIcon(QIcon(":/icons/white/random_active.png")); } else { - ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_inactive.png")); + ui->randomButton->setIcon(QIcon(":/icons/white/random_inactive.png")); } if (_player->repeat()) { - ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_active.png")); + ui->repeatButton->setIcon(QIcon(":/icons/white/repeat_active.png")); } else { - ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_inactive.png")); + ui->repeatButton->setIcon(QIcon(":/icons/white/repeat_inactive.png")); } ui->volumeSlider->setMinimum(0); ui->volumeSlider->setMaximum(100); ui->volumeSlider->hide(); - _seek_slider = new QSlider(Qt::Horizontal); - _seek_slider->setEnabled(false); - ui->progressLayout->insertWidget(1, _seek_slider); - _seek_slider->setTracking(false); + ui->seekSlider->setEnabled(false); + ui->progressLayout->removeItem(ui->seekSpacer); + _tools_widget = new ToolsWidget(this); + ui->toolsLayout->insertWidget(0, _tools_widget); + _tools_widget->hide(); _model = new QStandardItemModel(0, 2, this); ui->playlistView->setModel(_model); _context_menu = new QMenu(ui->playlistView); @@ -82,30 +84,26 @@ PlayerForm::PlayerForm(Library* lib, QWidget *parent) : QAction *edit_tags = _context_menu->addAction("Edit tags"); _track_renderer = new TrackRenderer(this); + _track_renderer->setActiveRow(-1); + _track_renderer->setSearchRow(-1); ui->playlistView->setItemDelegateForColumn(0, _track_renderer); _tag_resolver = new TagResolver(this); connect(ui->libraryButton, SIGNAL(clicked()), this, SLOT(_library())); connect(ui->viewButton, SIGNAL(clicked()), this, SLOT(_toggle_view())); - connect(ui->aViewButton, SIGNAL(clicked()), this, SLOT(_toggle_view())); connect(ui->playlistView, SIGNAL(clicked(QModelIndex)), this, SLOT(_process_click(QModelIndex))); connect(ui->playpauseButton, SIGNAL(clicked()), _player, SLOT(toggle())); - connect(ui->aPlayPauseButton, SIGNAL(clicked()), _player, SLOT(toggle())); - connect(ui->stopButton, SIGNAL(clicked()), _player, SLOT(stop())); - connect(ui->aStopButton, SIGNAL(clicked()), _player, SLOT(stop())); connect(ui->nextButton, SIGNAL(clicked()), _player, SLOT(next())); - connect(ui->aNextButton, SIGNAL(clicked()), _player, SLOT(next())); + connect(ui->stopButton, SIGNAL(clicked()), _player, SLOT(stop())); connect(ui->prevButton, SIGNAL(clicked()), _player, SLOT(prev())); - connect(ui->aPrevButton, SIGNAL(clicked()), _player, SLOT(prev())); connect(_player, SIGNAL(trackChanged(Track)), this, SLOT(_track_changed(Track))); connect(_player, SIGNAL(tick(int,int)), this, SLOT(_tick(int,int))); connect(ui->randomButton, SIGNAL(clicked()), this, SLOT(_toggle_random())); connect(ui->repeatButton, SIGNAL(clicked()), this, SLOT(_toggle_repeat())); - connect(_seek_slider, SIGNAL(sliderMoved(int)), _player, SLOT(seek(int))); - //connect(_seek_slider, SIGNAL(sliderReleased()), this, SLOT(_slider_released())); + connect(ui->seekSlider, SIGNAL(sliderMoved(int)), _player, SLOT(seek(int))); connect(ui->volumeSlider, SIGNAL(sliderMoved(int)), _player, SLOT(setVolume(int))); - connect(ui->playlistView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(_custom_context_venu_requested(QPoint))); + connect(ui->playlistView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(_custom_context_menu_requested(QPoint))); connect(delete_action, SIGNAL(triggered()), this, SLOT(_delete_track())); connect(enqueue_action, SIGNAL(triggered()), this, SLOT(_enqueue_track())); connect(add_to_favorites, SIGNAL(triggered()), this, SLOT(_add_to_favorites())); @@ -115,8 +113,11 @@ PlayerForm::PlayerForm(Library* lib, QWidget *parent) : connect(_player, SIGNAL(trackDone(Track)), _lib, SLOT(updateTrackCount(Track))); connect(_tag_resolver, SIGNAL(decoded(Track)), this, SLOT(_track_decoded(Track))); connect(ui->volumeButton, SIGNAL(clicked()), this, SLOT(_toggle_volume())); - ui->topWidget->setVisible(false); - setAttribute(Qt::WA_Maemo5StackedWindow); + connect(ui->moreButton, SIGNAL(clicked()), this, SLOT(_tools_widget_toggle())); + connect(_tools_widget, SIGNAL(search(QString)), this, SLOT(search(QString))); + connect(_tools_widget, SIGNAL(nextSearch()), this, SLOT(nextItem())); + connect(_tools_widget, SIGNAL(prevSearch()), this, SLOT(prevItem())); + connect(_tools_widget, SIGNAL(toggleFullscreen(bool)), this, SIGNAL(fullscreen(bool))); // dbus _dbusadaptor = new DBusAdaptop(_player); @@ -135,9 +136,6 @@ void PlayerForm::_library() { } void PlayerForm::reload(bool reread) { - if (ui->stackedWidget->currentIndex() == 1) { - emit hideSearchPanel(); - } if (reread) { _current_playlist = _lib->getCurrentPlaylist(); _player->setPlaylist(_current_playlist); @@ -149,13 +147,11 @@ void PlayerForm::_toggle_view() { int index = ui->stackedWidget->currentIndex(); index = (!index % 2); if (index) { - ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playlist.png")); - ui->aViewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playlist.png")); - emit hideSearchPanel(); + ui->viewButton->setIcon(QIcon(":/icons/white/playlist.png")); + ui->moreButton->setEnabled(false); } else { - ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playback.png")); - ui->aViewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playback.png")); - emit showSearchPanel(); + ui->viewButton->setIcon(QIcon(":/icons/white/playback.png")); + ui->moreButton->setEnabled(true); } ui->stackedWidget->setCurrentIndex(index); } @@ -189,8 +185,8 @@ void PlayerForm::_display_track(Track track) { ui->artistAlbumLabel->setText(QString("%1
%2"). arg(track.metadata().artist()). arg(track.metadata().album())); - _seek_slider->setMinimum(0); - _seek_slider->setMaximum(track.metadata().length()); + ui->seekSlider->setMinimum(0); + ui->seekSlider->setMaximum(track.metadata().length()); _tick(0, track.metadata().length()); } @@ -199,14 +195,14 @@ void PlayerForm::_tick(int done, int all) { ui->allTimeLabel->setText(_time->toString("mm:ss")); _time->setHMS(0, done/60, done%60); ui->doneTimeLabel->setText(_time->toString("mm:ss")); - _seek_slider->setValue(done); + ui->seekSlider->setValue(done); } void PlayerForm::_slider_released() { - _player->seek(_seek_slider->value()); + _player->seek(ui->seekSlider->value()); } -void PlayerForm::_custom_context_venu_requested(const QPoint &pos) { +void PlayerForm::_custom_context_menu_requested(const QPoint &pos) { _context_menu->exec(pos); } @@ -238,39 +234,37 @@ void PlayerForm::_add_to_favorites() { void PlayerForm::_state_changed(PlayerState state) { if (state == PLAYER_PLAYING) { - ui->playpauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/pause.png")); - ui->aPlayPauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/pause.png")); - _seek_slider->setEnabled(true); + ui->playpauseButton->setIcon(QIcon(":/icons/white/pause.png")); + ui->seekSlider->setEnabled(true); } else { if (state == PLAYER_STOPPED) { - _seek_slider->setValue(0); + ui->seekSlider->setValue(0); ui->doneTimeLabel->setText("00:00"); - _seek_slider->setEnabled(false); + ui->seekSlider->setEnabled(false); } - ui->playpauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/play.png")); - ui->aPlayPauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/play.png")); + ui->playpauseButton->setIcon(QIcon(":/icons/white/play.png")); } } void PlayerForm::_toggle_random() { _player->toggleRandom(); if (_player->random()) { - ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_active.png")); + ui->randomButton->setIcon(QIcon(":/icons/white/random_active.png")); } else { - ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_inactive.png")); + ui->randomButton->setIcon(QIcon(":/icons/white/random_inactive.png")); } } void PlayerForm::_toggle_repeat() { _player->toggleRepeat(); if (_player->repeat()) { - ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_active.png")); + ui->repeatButton->setIcon(QIcon(":/icons/white/repeat_active.png")); } else { - ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_inactive.png")); + ui->repeatButton->setIcon(QIcon(":/icons/white/repeat_inactive.png")); } } -void PlayerForm::search(QString &pattern) { +void PlayerForm::search(QString pattern) { _search_pattern = pattern; _search_current_id = -1; nextItem(); @@ -375,47 +369,25 @@ void PlayerForm::_volume_changed() { _player->setVolume(value); } -void PlayerForm::updateIcons() { - Config config; - _icons_theme = config.getValue("ui/iconstheme").toString(); - ui->libraryButton->setIcon(QIcon(":/icons/"+_icons_theme+"/library.png")); - if (ui->stackedWidget->currentIndex()) { - ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playlist.png")); - ui->aViewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playlist.png")); - } else { - ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playback.png")); - } - if (_player->random()) - ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_active.png")); - else - ui->randomButton->setIcon(QIcon(":/icons/"+_icons_theme+"/random_inactive.png")); - if (_player->repeat()) - ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_active.png")); - else - ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_inactive.png")); - ui->prevButton->setIcon(QIcon(":/icons/"+_icons_theme+"/prev.png")); - ui->aPrevButton->setIcon(QIcon(":/icons/"+_icons_theme+"/prev.png")); - if (_player->state() == PLAYER_PLAYING) { - ui->playpauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/pause.png")); - ui->aPlayPauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/pause.png")); - } else { - ui->playpauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/play.png")); - ui->aPlayPauseButton->setIcon(QIcon(":/icons/"+_icons_theme+"/play.png")); - } - ui->stopButton->setIcon(QIcon(":/icons/"+_icons_theme+"/stop.png")); - ui->aStopButton->setIcon(QIcon(":/icons/"+_icons_theme+"/stop.png")); - ui->nextButton->setIcon(QIcon(":/icons/"+_icons_theme+"/next.png")); - ui->aNextButton->setIcon(QIcon(":/icons/"+_icons_theme+"/next.png")); - ui->volumeButton->setIcon(QIcon(":/icons/"+_icons_theme+"/volume.png")); -} - void PlayerForm::landscapeMode() { - ui->bottomWidget->setVisible(true); - ui->topWidget->setVisible(false); + ui->progressLayout->removeItem(ui->seekSpacer); + ui->progressLayout->insertWidget(1, ui->seekSlider); + ui->progressWidget->setVisible(false); } void PlayerForm::portraitMode() { - ui->bottomWidget->setVisible(false); - ui->volumeSlider->setVisible(false); - ui->topWidget->setVisible(true); + ui->progressLayout->insertSpacerItem(1, ui->seekSpacer); + ui->progressWidget->layout()->addWidget(ui->seekSlider); + ui->progressWidget->setVisible(true); +} + +void PlayerForm::_tools_widget_toggle() { + if (_tools_widget->isVisible()) { + ui->moreButton->setIcon(QIcon(":/icons/white/more.png")); + _tools_widget->hide(); + cancelSearch(); + } else { + ui->moreButton->setIcon(QIcon(":/icons/white/unmore.png")); + _tools_widget->show(); + } } diff --git a/src/playerform.h b/src/playerform.h index 59a3299..648acf7 100644 --- a/src/playerform.h +++ b/src/playerform.h @@ -31,6 +31,7 @@ #include "trackrenderer.h" #include "tagresolver.h" #include "dbusadaptor.h" +#include "toolswidget.h" namespace Ui { class PlayerForm; @@ -55,12 +56,11 @@ public: signals: void library(); - void showSearchPanel(); - void hideSearchPanel(); + void fullscreen(bool); public slots: void reload(bool); - void search(QString &); + void search(QString); void nextItem(); void prevItem(); void cancelSearch(); @@ -70,7 +70,6 @@ public slots: void equalizerValue(int band, double *value) { _player->equalizerValue(band, value); } void enableEqualizer() { _player->enableEqualizer(); } void disableEqualizer() { _player->disableEqualizer(); } - void updateIcons(); void portraitMode(); void landscapeMode(); @@ -81,7 +80,7 @@ private slots: void _track_changed(Track); void _tick(int, int); void _slider_released(); - void _custom_context_venu_requested ( const QPoint & pos ); + void _custom_context_menu_requested ( const QPoint & pos ); void _delete_track(); void _enqueue_track(); void _add_to_favorites(); @@ -93,6 +92,7 @@ private slots: void _toggle_volume(); void _track_decoded(Track); void _volume_changed(); + void _tools_widget_toggle(); private: Ui::PlayerForm *ui; @@ -104,13 +104,13 @@ private: QSlider *_seek_slider; QMenu *_context_menu; QString _search_pattern; + ToolsWidget *_tools_widget; TrackRenderer *_track_renderer; TagResolver *_tag_resolver; void _display_track(Track); int _search_current_id; - QString _icons_theme; DBusAdaptop *_dbusadaptor; }; diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 63bf2e5..d01ff1c 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -29,34 +29,30 @@ SettingsDialog::SettingsDialog(QWidget *parent) : { ui->setupUi(this); Config config; - QString iconsTheme = config.getValue("ui/iconstheme").toString(); QString albumSorting = config.getValue("ui/albumsorting").toString(); QString showTrackLenght = config.getValue("ui/showtracklenght").toString(); - QString portraitEnabled = config.getValue("ui/portraitmode").toString(); - ui->iconsWButton->setChecked(true); // "white" by default + QString orientation = config.getValue("ui/orientation").toString(); ui->albumsSortAButton->setChecked(true); // defaule sorting ui->showTrackLenghtYButton->setChecked(true); // show by default - ui->portraitEnableButton->setChecked(true); // enabled by default - if (iconsTheme == "black") { - ui->iconsBButton->setChecked(true); - } + ui->orientationLButton->setChecked(true); if (albumSorting == "date") { ui->albumsSortDButton->setChecked(true); } if (showTrackLenght == "no") { ui->showTrackLenghtNButton->setChecked(true); } - if (portraitEnabled == "disabled") { - ui->portraitDisableButton->setChecked(true); + if (orientation == "portrait") { + ui->orientationPButton->setChecked(true); + } else if (orientation == "auty") { + ui->orientationAButton->setChecked(true); } - connect (ui->iconsBButton, SIGNAL(toggled(bool)), this, SLOT(_set_icons_black(bool))); - connect (ui->iconsWButton, SIGNAL(toggled(bool)), this, SLOT(_set_icons_white(bool))); connect (ui->albumsSortAButton, SIGNAL(toggled(bool)), this, SLOT(_set_album_sorting_alphabet(bool))); connect (ui->albumsSortDButton, SIGNAL(toggled(bool)), this, SLOT(_set_album_sorting_date(bool))); connect (ui->showTrackLenghtNButton, SIGNAL(toggled(bool)), this, SLOT(_set_track_lenght_show_no(bool))); connect (ui->showTrackLenghtYButton, SIGNAL(toggled(bool)), this, SLOT(_set_track_lenght_show_yes(bool))); - connect (ui->portraitDisableButton, SIGNAL(toggled(bool)), this, SLOT(_set_portrait_disabled(bool))); - connect (ui->portraitEnableButton, SIGNAL(toggled(bool)), this, SLOT(_set_portrait_enabled(bool))); + connect (ui->orientationAButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_auto(bool))); + connect (ui->orientationLButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_landscape(bool))); + connect (ui->orientationPButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_portrait(bool))); // disabled to 1.4.0 ui->albumSortingGroupBox->setVisible(false); @@ -67,18 +63,6 @@ SettingsDialog::~SettingsDialog() delete ui; } -void SettingsDialog::_set_icons_black(bool checked) { - if (!checked) return; - Config config; - config.setValue("ui/iconstheme", "black"); -} - -void SettingsDialog::_set_icons_white(bool checked) { - if (!checked) return; - Config config; - config.setValue("ui/iconstheme", "white"); -} - void SettingsDialog::_set_album_sorting_date(bool checked) { if (!checked) return; Config config; @@ -103,14 +87,21 @@ void SettingsDialog::_set_track_lenght_show_yes(bool checked) { config.setValue("ui/showtracklenght", "yes"); } -void SettingsDialog::_set_portrait_disabled(bool checked) { +void SettingsDialog::_set_orientation_auto(bool checked) { if (!checked) return; Config config; - config.setValue("ui/portraitmode", "disabled"); + config.setValue("ui/orientation", "auto"); } -void SettingsDialog::_set_portrait_enabled(bool checked) { +void SettingsDialog::_set_orientation_landscape(bool checked) { if (!checked) return; Config config; - config.setValue("ui/portraitmode", "enabled"); + config.setValue("ui/orientation", "landscape"); } + +void SettingsDialog::_set_orientation_portrait(bool checked) { + if (!checked) return; + Config config; + config.setValue("ui/orientation", "portrait"); +} + diff --git a/src/settingsdialog.h b/src/settingsdialog.h index 272baed..fe0ed3c 100644 --- a/src/settingsdialog.h +++ b/src/settingsdialog.h @@ -39,14 +39,13 @@ private: Ui::SettingsDialog *ui; private slots: - void _set_icons_white(bool); - void _set_icons_black(bool); void _set_album_sorting_alphabet(bool); void _set_album_sorting_date(bool); void _set_track_lenght_show_yes(bool); void _set_track_lenght_show_no(bool); - void _set_portrait_enabled(bool); - void _set_portrait_disabled(bool); + void _set_orientation_auto(bool); + void _set_orientation_portrait(bool); + void _set_orientation_landscape(bool); }; #endif // SETTINGSDIALOG_H diff --git a/src/someplayer.h b/src/someplayer.h index 159797a..4b621d2 100644 --- a/src/someplayer.h +++ b/src/someplayer.h @@ -47,7 +47,7 @@ namespace SomePlayer { #include "config.h" #define _DYNAMIC_PLAYLIST_MAX_COUNT_ 50 -#define _SOMEPLAYER_VERSION_ "1.3.3" +#define _SOMEPLAYER_VERSION_ "1.3.5" #define NDEBUG #define _SERVICE_NAME_ "ru.somebody.someplayer" diff --git a/src/toolswidget.cpp b/src/toolswidget.cpp new file mode 100644 index 0000000..62e9cea --- /dev/null +++ b/src/toolswidget.cpp @@ -0,0 +1,48 @@ +/* + * SomePlayer - An alternate music player for Maemo 5 + * Copyright (C) 2010 Nikolay (somebody) Tischenko + * + * 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 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "toolswidget.h" +#include "ui_toolswidget.h" + +ToolsWidget::ToolsWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::ToolsWidget) +{ + ui->setupUi(this); + _fullscreen = false; + connect (ui->fscreenButton, SIGNAL(clicked()), this, SLOT(_fullscreen_button())); + connect (ui->nextButton, SIGNAL(clicked()), this, SIGNAL(nextSearch())); + connect (ui->prevButton, SIGNAL(clicked()), this, SIGNAL(prevSearch())); + connect (ui->searchLine, SIGNAL(textEdited(QString)), this, SIGNAL(search(QString))); +} + +ToolsWidget::~ToolsWidget() +{ + delete ui; +} + +void ToolsWidget::_fullscreen_button() { + _fullscreen = !_fullscreen; + emit toggleFullscreen(_fullscreen); + ui->fscreenButton->setIcon(QIcon(_fullscreen ? ":/icons/white/window.png" : ":/icons/white/fullscreen.png")); +} + +void ToolsWidget::reset() { + ui->searchLine->setText(""); +} diff --git a/src/toolswidget.h b/src/toolswidget.h new file mode 100644 index 0000000..e89ac81 --- /dev/null +++ b/src/toolswidget.h @@ -0,0 +1,52 @@ +/* + * SomePlayer - An alternate music player for Maemo 5 + * Copyright (C) 2010 Nikolay (somebody) Tischenko + * + * 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 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef TOOLSWIDGET_H +#define TOOLSWIDGET_H + +#include + +namespace Ui { + class ToolsWidget; +} + +class ToolsWidget : public QWidget +{ + Q_OBJECT + +public: + explicit ToolsWidget(QWidget *parent = 0); + ~ToolsWidget(); + void reset(); + +signals: + void toggleFullscreen(bool); + void search(QString); + void nextSearch(); + void prevSearch(); + +private: + Ui::ToolsWidget *ui; + bool _fullscreen; + +private slots: + void _fullscreen_button(); +}; + +#endif // TOOLSWIDGET_H diff --git a/src/trackrenderer.cpp b/src/trackrenderer.cpp index 739646b..9a136f0 100644 --- a/src/trackrenderer.cpp +++ b/src/trackrenderer.cpp @@ -44,25 +44,26 @@ void TrackRenderer::paint(QPainter *painter, const QStyleOptionViewItem &option, QPen spen (QColor::fromRgb(100, 150, 220)); QPen sspen (QColor::fromRgb(100, 220, 150)); - f.setBold(true); - painter->setFont(f); f.setBold(false); painter->setPen(npen); painter->drawLine(x1, y1, x2, y1); if (index.row() == _search_row) { + f.setBold(true); painter->setPen(sspen); } else if (index.row() == _active_row) { + f.setBold(true); painter->setPen(spen); } else { painter->setPen(pen); } - painter->drawText(x1, y1 + 2*(y2-y1)/5, meta[0]); + painter->setFont(f); + painter->drawText(x1+10, y1 + 1*(y2-y1)/2, meta[0]); fp.setBold(false); fp.setPointSize(f.pointSize()*3/4); painter->setFont(fp); painter->setPen(apen); - painter->drawText((x2+x1)/2, y1 + 4*(y2-y1)/6, meta[1]); - painter->drawText((x2+x1)/2, y1 + 11*(y2-y1)/12, meta[2]); + painter->drawText(x1+10, y1 + 3*(y2-y1)/5, (x2-x1)-100, 2*fp.pointSize(), Qt::AlignAbsolute, QString("%1 (%2)").arg(meta[2]).arg(meta[1])); + painter->drawText(x2-60, y1 + 3*(y2-y1)/5, 55, 2*fp.pointSize(), Qt::AlignAbsolute, QString("%1").arg(meta[3])); painter->setPen(npen); painter->drawLine(x1, y2, x2, y2); painter->setFont(f); diff --git a/src/ui/busywidget.ui b/src/ui/busywidget.ui index c7ffbd2..c599fd9 100644 --- a/src/ui/busywidget.ui +++ b/src/ui/busywidget.ui @@ -13,7 +13,7 @@ Form - + diff --git a/src/ui/edittagsdialog.ui b/src/ui/edittagsdialog.ui index f45b77f..920b424 100644 --- a/src/ui/edittagsdialog.ui +++ b/src/ui/edittagsdialog.ui @@ -13,7 +13,7 @@ Edit tags - + @@ -50,7 +50,7 @@ - + Qt::Horizontal diff --git a/src/ui/equalizerdialog.ui b/src/ui/equalizerdialog.ui index ac470f6..f520704 100644 --- a/src/ui/equalizerdialog.ui +++ b/src/ui/equalizerdialog.ui @@ -137,104 +137,152 @@ - - - - - - 0 - 0 - - - - - 150 - 70 - - - - Enable - - - true - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 300 - 70 - - - - true - - - true - - - + + + 0 + - - - Qt::Horizontal - - - - 40 - 20 - - - + + + + + Qt::Horizontal + + + + 5 + 20 + + + + + + + + + 0 + 0 + + + + + 300 + 70 + + + + true + + + true + + + + + + + Qt::Horizontal + + + + 5 + 20 + + + + + - - - - 0 - 0 - - - - - 150 - 70 - - - - Save - - - false - - + + + + + + 0 + 0 + + + + + 120 + 70 + + + + + 120 + 16777215 + + + + Enable + + + true + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 120 + 70 + + + + + 120 + 16777215 + + + + Save + + + false + + + + + + + + + 0 + + + 0 + + + + diff --git a/src/ui/libraryform.ui b/src/ui/libraryform.ui index e68c441..6c2a84d 100644 --- a/src/ui/libraryform.ui +++ b/src/ui/libraryform.ui @@ -50,7 +50,7 @@ Form - + 0 @@ -58,218 +58,291 @@ 0 - - - - - - 0 - 0 - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - :/icons/white/back.png:/icons/white/back.png - - - true - - - - - - - - 0 - 0 - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - :/icons/white/select_all.png:/icons/white/select_all.png - - - true - - - - - - - - 0 - 0 - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - :/icons/white/add.png:/icons/white/add.png - - - true - - - - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - :/icons/white/delete.png:/icons/white/delete.png - - - true - - - + + + 0 + - - - - 0 - 0 - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - :/icons/white/use.png:/icons/white/use.png - - - true - + + + background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0.00549451 rgba(38, 38, 38, 255), stop:0.994505 rgba(92, 92, 92, 255)) + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + :/icons/white/back.png:/icons/white/back.png + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + :/icons/white/add.png:/icons/white/add.png + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + :/icons/white/delete.png:/icons/white/delete.png + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + :/icons/white/use.png:/icons/white/use.png + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + :/icons/white/select_all.png:/icons/white/select_all.png + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + :/icons/white/more.png:/icons/white/more.png + + + true + + + + - - - Qt::Vertical - - - - 20 - 40 - - - + - - - - 0 - 0 - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - :/icons/white/player.png:/icons/white/player.png - - - true - - - - - - - - - 0 - - false + + background: black; +color: white; + @@ -283,141 +356,213 @@ + + QListView { +background: black; +color: white; +} +QListView::item:selected { +background: qlineargradient(spread:reflect, x1:1, y1:0.5, x2:1, y2:0, stop:0 rgba(38, 38, 38, 255), stop:1 rgba(92, 92, 92, 255)); +color: white; +} + + + Qt::ScrollBarAlwaysOff + QAbstractItemView::NoEditTriggers - - QAbstractItemView::MultiSelection - - + false - - 1 - - - false - - - - - - - - - - - - 0 - 0 - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - :/icons/white/artists.png:/icons/white/artists.png - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - - 70 - 70 - - - - - 70 - 70 - + + QAbstractItemView::MultiSelection - - + + QAbstractItemView::SelectRows - - - :/icons/white/dynamic.png:/icons/white/dynamic.png + + 0 - + true - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - :/icons/white/playlists.png:/icons/white/playlists.png - - - true - + + + background: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0.00549451 rgba(38, 38, 38, 255), stop:0.994505 rgba(92, 92, 92, 255)) + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + :/icons/white/player.png:/icons/white/player.png + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + :/icons/white/artists.png:/icons/white/artists.png + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + :/icons/white/dynamic.png:/icons/white/dynamic.png + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 70 + 70 + + + + + 70 + 70 + + + + + + + + :/icons/white/playlists.png:/icons/white/playlists.png + + + true + + + + diff --git a/src/ui/mainwindow.ui b/src/ui/mainwindow.ui index 8379eef..7bd4bc0 100644 --- a/src/ui/mainwindow.ui +++ b/src/ui/mainwindow.ui @@ -14,225 +14,13 @@ someplayer - - - - - - 0 - - - 0 - - - - - 0 - - - - - - 0 - 0 - - - - - 60 - 60 - - - - - 60 - 60 - - - - - - - - :/icons/white/fullscreen.png:/icons/white/fullscreen.png - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 0 - 20 - - - - - - - - 0 - - - - - - 0 - 0 - - - - - 60 - 60 - - - - - 60 - 60 - - - - - - - - :/icons/white/back.png:/icons/white/back.png - - - true - - - - - - - - 0 - 0 - - - - - 500 - 60 - - - - - 16777215 - 60 - - - - - - - - - 0 - 0 - - - - - 60 - 60 - - - - - 60 - 60 - - - - - - - - :/icons/white/forward.png:/icons/white/forward.png - - - true - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 60 - 60 - - - - - 60 - 60 - - - - - - - - :/icons/white/search.png:/icons/white/search.png - - - true - - - - - - - - + + + 0 + + + 0 + @@ -250,6 +38,9 @@ 23 + + + Main @@ -277,8 +68,6 @@ - - - + diff --git a/src/ui/playerform.ui b/src/ui/playerform.ui index cd1d9a2..3154c12 100644 --- a/src/ui/playerform.ui +++ b/src/ui/playerform.ui @@ -22,6 +22,9 @@ + + background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0.00549451 rgba(38, 38, 38, 255), stop:0.994505 rgba(92, 92, 92, 255)) + 0 @@ -30,7 +33,7 @@ 0 - + 0 @@ -54,7 +57,7 @@ - :/icons/white/playlist.png:/icons/white/playlist.png + :/icons/white/prev.png:/icons/white/prev.png true @@ -62,7 +65,7 @@ - + Qt::Horizontal @@ -75,7 +78,7 @@ - + 0 @@ -99,7 +102,7 @@ - :/icons/white/prev.png:/icons/white/prev.png + :/icons/white/play.png:/icons/white/play.png true @@ -107,7 +110,20 @@ - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + 0 @@ -131,7 +147,7 @@ - :/icons/white/play.png:/icons/white/play.png + :/icons/white/stop.png:/icons/white/stop.png true @@ -139,7 +155,20 @@ - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + 0 @@ -163,7 +192,7 @@ - :/icons/white/stop.png:/icons/white/stop.png + :/icons/white/next.png:/icons/white/next.png true @@ -171,7 +200,20 @@ - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + 0 @@ -195,7 +237,7 @@ - :/icons/white/next.png:/icons/white/next.png + :/icons/white/more.png:/icons/white/more.png true @@ -213,7 +255,7 @@ - 1 + 0 @@ -224,10 +266,20 @@ 0 + + + 0 + + + + Qt::CustomContextMenu + + QListView {background: black;} + QAbstractItemView::NoEditTriggers @@ -246,6 +298,12 @@ + + 0 + + + 0 + @@ -277,6 +335,19 @@ + + + Qt::Vertical + + + + 20 + 40 + + + + + <h3>Title</h3> @@ -287,6 +358,19 @@ + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -296,6 +380,26 @@ + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + 00:00 @@ -305,6 +409,31 @@ + + + + 0 + + + 0 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + <b>Artist</b><br/>album @@ -314,6 +443,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -323,6 +465,9 @@ + + 0 + @@ -353,6 +498,9 @@ 0 + + background:qlineargradient(spread:pad, x1:1, y1:1, x2:1, y2:0, stop:0.00549451 rgba(38, 38, 38, 255), stop:0.994505 rgba(92, 92, 92, 255)) + 0 @@ -495,48 +643,7 @@ - - - - 0 - 0 - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - :/icons/white/repeat_inactive.png:/icons/white/repeat_inactive.png - - - - 48 - 58 - - - - false - - - true - - - - - + Qt::Horizontal @@ -549,71 +656,7 @@ - - - - 0 - 0 - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - :/icons/white/prev.png:/icons/white/prev.png - - - true - - - - - - - - 0 - 0 - - - - - 70 - 70 - - - - - 70 - 70 - - - - - - - - :/icons/white/play.png:/icons/white/play.png - - - true - - - - - + 0 @@ -637,39 +680,16 @@ - :/icons/white/stop.png:/icons/white/stop.png - - - true - - - - - - - - 0 - 0 - - - - - 70 - 70 - + :/icons/white/repeat_inactive.png:/icons/white/repeat_inactive.png - + - 70 - 70 + 48 + 58 - - - - - - :/icons/white/next.png:/icons/white/next.png + + false true @@ -677,7 +697,7 @@ - + Qt::Horizontal diff --git a/src/ui/saveplaylistdialog.ui b/src/ui/saveplaylistdialog.ui index cc12090..023b715 100644 --- a/src/ui/saveplaylistdialog.ui +++ b/src/ui/saveplaylistdialog.ui @@ -28,7 +28,8 @@ - + + diff --git a/src/ui/settingsdialog.ui b/src/ui/settingsdialog.ui index 8368d57..e58089d 100644 --- a/src/ui/settingsdialog.ui +++ b/src/ui/settingsdialog.ui @@ -32,40 +32,6 @@ - - - - - - - - - Icons theme: - - - - - - - - - Black - - - - - - - White - - - - - - - - - true @@ -111,23 +77,30 @@ - Enable portrait mode: + Orientation: - + + + Landscape + + + + + - Enable + Portrait - + - Disable + Auto diff --git a/src/ui/toolswidget.ui b/src/ui/toolswidget.ui new file mode 100644 index 0000000..fc1bd3f --- /dev/null +++ b/src/ui/toolswidget.ui @@ -0,0 +1,163 @@ + + + ToolsWidget + + + + 0 + 0 + 800 + 65 + + + + Form + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 60 + 60 + + + + + 60 + 60 + + + + + + + + :/icons/white/fullscreen.png:/icons/white/fullscreen.png + + + true + + + + + + + Qt::Horizontal + + + + 26 + 20 + + + + + + + + + 0 + 0 + + + + + 60 + 60 + + + + + 60 + 60 + + + + + + + + :/icons/white/back.png:/icons/white/back.png + + + true + + + + + + + + 1 + 0 + + + + + 0 + 60 + + + + + 16777215 + 60 + + + + false + + + + + + + + 0 + 0 + + + + + 60 + 60 + + + + + 60 + 60 + + + + + + + + :/icons/white/forward.png:/icons/white/forward.png + + + true + + + + + + + + + +