src/saveplaylistdialog.cpp \
src/settingsdialog.cpp \
src/dbusadaptor.cpp \
- src/toolswidget.cpp
+ src/toolswidget.cpp \
+ src/managelibraryform.cpp
HEADERS += src/mainwindow.h \
src/player/player.h \
src/settingsdialog.h \
src/abstractitemrenderer.h \
src/dbusadaptor.h \
- src/toolswidget.h
+ src/toolswidget.h \
+ src/managelibraryform.h
FORMS += src/ui/mainwindow.ui \
src/ui/playerform.ui \
src/ui/equalizerdialog.ui \
src/ui/saveplaylistdialog.ui \
src/ui/settingsdialog.ui \
- src/ui/toolswidget.ui
+ src/ui/toolswidget.ui \
+ src/ui/managelibraryform.ui
CONFIG += mobility
MOBILITY =
#include <QSqlQuery>
#include <QSqlResult>
#include <QDebug>
+#include <QFileInfo>
using namespace SomePlayer::Storage;
using namespace SomePlayer::DataObjects;
DbStorage::DbStorage(QString path) {
- QString dbname = path+_DATABASE_NAME_;
+ QString dbname = path + _DATABASE_NAME_;
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(dbname);
if (!db.open()) {
_get_track_id_by_source_query = new QSqlQuery(db);
_get_track_id_by_source_query->prepare("SELECT id FROM tracks WHERE source = :source");
+ _get_directories_query = new QSqlQuery(db);
+ _get_directories_query->prepare("SELECT id, path FROM directories");
+
_check_artist_query = new QSqlQuery(db);
_check_artist_query->prepare("SELECT id FROM artist WHERE uname = :uname");
_check_album_query = new QSqlQuery(db);
_check_album_query->prepare("SELECT id FROM album WHERE uname = :uname AND artist_id = :artist_id");
+ _check_directory_query = new QSqlQuery(db);
+ _check_directory_query->prepare("SELECT id from directories WHERE path = :path");
+
_insert_artist_query = new QSqlQuery(db);
_insert_artist_query->prepare("INSERT INTO artist (name, uname) values (:name, :uname)");
_insert_album_query->prepare("INSERT INTO album (name, uname, artist_id, year) values (:name, :uname, :artist_id, :year)");
_insert_track_query = new QSqlQuery(db);
- _insert_track_query->prepare("INSERT INTO tracks (title, utitle, artist_id, album_id, source, length) values (:title, :utitle, :artist_id, :album_id, :source, :length)");
+ _insert_track_query->prepare("INSERT INTO tracks (title, utitle, artist_id, album_id, source, directory, length) values (:title, :utitle, :artist_id, :album_id, :source, :directory_id, :length)");
_insert_date_query = new QSqlQuery(db);
_insert_date_query->prepare("INSERT INTO adding_date (track_id, date) values (:track_id, strftime('%s', 'now'))");
_insert_favorites_query = new QSqlQuery(db);
_insert_favorites_query->prepare("INSERT INTO favorites (track_id) values (:track_id)");
+ _insert_directory_query = new QSqlQuery(db);
+ _insert_directory_query->prepare("INSERT INTO directories (path) values (:path)");
+
_update_track_count_query = new QSqlQuery(db);
_update_track_count_query->prepare("UPDATE tracks SET count = :count where id = :id");
"title text, "
"utitle text, "
"source text, "
+ "directory integer, "
"count integer default 0, "
"length integer default 0, "
"foreign key(artist_id) references artist(id), "
"on album.artist_id = artist.id) "
"on aartist_id = tracks.artist_id "
"and aalbum_id = tracks.album_id");
+
+ query->exec("create table directories (id integer primary key, path text)");
}
DbStorage::~DbStorage() {
delete _get_recently_added_query;
delete _get_tracks_for_album_query;
delete _get_tracks_by_pattern_query;
+ delete _get_directories_query;
delete _check_album_query;
delete _check_artist_query;
+ delete _check_directory_query;
delete _get_track_id_by_source_query;
delete _insert_album_query;
delete _insert_artist_query;
delete _insert_date_query;
delete _insert_track_query;
delete _insert_favorites_query;
+ delete _insert_directory_query;
delete _update_track_count_query;
delete _remove_track_query;
db.close();
QString artist = track.metadata().artist();
QString album = track.metadata().album();
QString source = track.source();
+ QFileInfo info(source);
+ QString path = info.canonicalPath();
int year = track.metadata().year();
int artist_id = _check_add_artist(artist);
int album_id = _check_add_album(album, artist_id, year);
query->bindValue(":artist_id", artist_id);
query->bindValue(":album_id", album_id);
query->bindValue(":source", source);
+ query->bindValue(":directory", _check_add_directory(path));
query->bindValue(":length", track.metadata().length());
if (query->exec()) {
//ok
_remove_empty_albums_query->exec();
_remove_empty_artists_query->exec();
}
+
+int DbStorage::_check_add_directory(QString path) {
+ QSqlQuery *query = _check_directory_query;
+ query->bindValue(":path", path);
+ query->exec();
+ if (query->next()) {
+ return query->value(0).toInt();
+ } else {
+ query = _insert_directory_query;
+ query->bindValue(":path", path);
+ query->exec();
+ return _check_add_directory(path);
+ }
+}
+
+QList<QString> DbStorage::getDirectories() {
+ QSqlQuery *query = _get_directories_query;
+ query->exec();
+ QList<QString> directories;
+ while (query->next()) {
+ directories.append(query->value(1).toString());
+ }
+ return directories;
+}
public:
DbStorage(QString path);
~DbStorage();
+ QList<QString> getDirectories();
QList<QString> getArtists();
QMap<QString, int> getAlbumsForArtist(QString artist);
QList<Track> getTracksForAlbum(QString album, QString artist); // hm...
int _check_add_artist(QString artist);
int _check_add_album(QString album, int artist_id, int year);
+ int _check_add_directory(QString path);
void _cleanup();
QSqlQuery *_get_track_count;
QSqlQuery *_get_tracks_by_pattern_query;
QSqlQuery *_get_track_id_by_source_query;
+ QSqlQuery *_get_directories_query;
QSqlQuery *_check_artist_query;
QSqlQuery *_check_album_query;
+ QSqlQuery *_check_directory_query;
QSqlQuery *_insert_artist_query;
QSqlQuery *_insert_album_query;
QSqlQuery *_insert_track_query;
QSqlQuery *_insert_date_query;
QSqlQuery *_insert_favorites_query;
+ QSqlQuery *_insert_directory_query;
QSqlQuery *_update_track_count_query;
Playlist FileStorage::getPlaylist(QString name) {
if (name == _CURRENT_PLAYLIST_SUBST_)
name = _CURRENT_PLAYLIST_NAME_;
- QFile playlistFile (_path_prefix+"/"+name+"."+_PLAYLIST_FILE_EXTENSION_OLD_); // remove OLD_ in next version
+ QFile playlistFile (_path_prefix + "/" + name + "." + _PLAYLIST_FILE_EXTENSION_OLD_); // remove OLD_ in next version
Playlist playlist;
playlist.setName(PLAYLIST_BAD_NAME);
// legacy _start_
playlistFile.close();
playlistFile.remove();
} else {
- playlistFile.setFileName(_path_prefix+"/"+name+"."+_PLAYLIST_FILE_EXTENSION_);
+ playlistFile.setFileName(_path_prefix + "/" + name + "." + _PLAYLIST_FILE_EXTENSION_);
// legacy _end_
if (playlistFile.exists()) {
playlist.setName(name);
QString name = playlist.name();
if (playlist.name() == _CURRENT_PLAYLIST_SUBST_)
name = _CURRENT_PLAYLIST_NAME_;
- QString filename = _path_prefix + "/" +name+"."_PLAYLIST_FILE_EXTENSION_;
+ QString filename = _path_prefix + "/" + name + "."_PLAYLIST_FILE_EXTENSION_;
QFile playlistFile(filename);
if (playlistFile.exists()) {
playlistFile.remove();
ui->listView->setModel(_model);
ui->listView->setColumnWidth(0, 70);
ui->toolsLayout->addWidget(_tools_widget);
+ _tools_widget->hideFSButton();
_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(_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()));
connect(search_in_library, SIGNAL(toggled(bool)), this, SLOT(_search_button(bool)));
+ connect(ui->playerButton, SIGNAL(clicked()), this, SLOT(hide()));
_view_button();
- _current_playlist_changed = true;
_top_gradient = ui->topWidget->styleSheet();
_bottom_gradient = ui->bottomWidget->styleSheet();
_is_dynamic = false;
LibraryForm::~LibraryForm()
{
- _lib->saveCurrentPlaylist(_lib->getCurrentPlaylist()); // wtf?
- _current_playlist_changed = true;
delete ui;
}
-void LibraryForm::_player() {
- emit player(_current_playlist_changed);
- _current_playlist_changed = false;
-}
-
void LibraryForm::_view_button() {
QList<QString> artitst = _lib->getArtists();
__fill_model(_model, artitst, _icons_theme);
if (_state == STATE_NONE) return;
QModelIndexList selected = ui->listView->selectionModel()->selectedIndexes();
ui->listView->selectionModel()->clearSelection();
- emit busy(QString("<H1>Adding... Please wait</H1>"));
Playlist cur = _lib->getCurrentPlaylist();
QRegExp regexp("\\[\\d+\\]\\ (.*)");
switch (_state) {
_add_artist(&cur, id.data().toString());
}
_lib->saveCurrentPlaylist(cur);
- _current_playlist_changed = true;
+ emit refreshPlayer();
break;
case STATE_ALBUM:
foreach (QModelIndex id, selected) {
}
}
_lib->saveCurrentPlaylist(cur);
- _current_playlist_changed = true;
+ emit refreshPlayer();
break;
case STATE_TRACK:
foreach (QModelIndex id, selected) {
_add_track(&cur, _current_tracks.at(id.row()));
}
_lib->saveCurrentPlaylist(cur);
- _current_playlist_changed = true;
+ emit refreshPlayer();
break;
case STATE_PLAYLIST:
foreach (QModelIndex id, selected) {
_add_playlist(&cur, id.data().toString());
}
_lib->saveCurrentPlaylist(cur);
- _current_playlist_changed = true;
+ emit refreshPlayer();
break;
case STATE_PLAYLIST_TRACK:
foreach (QModelIndex id, selected) {
_add_track(&cur, _current_tracks.at(id.row()));
}
_lib->saveCurrentPlaylist(cur);
- _current_playlist_changed = true;
+ emit refreshPlayer();
break;
case STATE_SEARCH:
foreach (QModelIndex id, selected) {
_add_track(&cur, _current_tracks.at(id.row()));
}
_lib->saveCurrentPlaylist(cur);
- _current_playlist_changed = true;
+ emit refreshPlayer();
break;
default:
- emit done();
return;
}
- emit done();
}
}
_current_tracks = _current_playlist.tracks();
_lib->savePlaylist(_current_playlist);
- _current_playlist_changed = true;
+ emit refreshPlayer();
__fill_model_tracks(_model, _current_tracks, _icons_theme);
ui->listView->setColumnWidth(0, 70);
} else if (_state == STATE_PLAYLIST) {
Playlist current = _lib->getCurrentPlaylist();
current.removeTrack(track);
_lib->saveCurrentPlaylist(current);
- _current_playlist_changed = true;
+ emit refreshPlayer();
}
void LibraryForm::_use_button() {
_lib->saveCurrentPlaylist(_current_playlist);
- _current_playlist_changed = true;
+ emit refreshPlayer();
_current_playlist = _lib->getCurrentPlaylist();
}
} else {
ui->moreButton->setIcon(QIcon(landscape ? ":/icons/"+_icons_theme+"/unmore_l.png" : ":/icons/"+_icons_theme+"/more.png"));
}
- ui->playerButton->setIcon(QIcon(":/icons/"+_icons_theme+"/player.png"));
ui->playlistsButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playlists.png"));
ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/artists.png"));
if (ui->listView->selectionModel()->selectedRows().count() == _model->rowCount()) {
- ui->selectAllButton->setIcon(QIcon(":/icons/"+_icons_theme+"/unselect_all.png"));
+ ui->selectAllButton->setIcon(QIcon(":/icons/"+_icons_theme+"/deselect_all.png"));
} else {
ui->selectAllButton->setIcon(QIcon(":/icons/"+_icons_theme+"/select_all.png"));
}
Track track = _current_tracks.at(id.row());
cur.addTrack(track);
_lib->saveCurrentPlaylist(cur);
- _current_playlist_changed = true;
+ emit refreshPlayer();
emit addAndPlay(track);
ui->listView->clearSelection();
}
public:
explicit LibraryForm(Library *lib, QWidget *parent = 0);
- ~LibraryForm();
+ ~LibraryForm();
signals:
- void player(bool);
- void busy(QString);
- void done();
- void fullscreen(bool);
+ void refreshPlayer();
void addAndPlay(Track);
public slots:
void search(QString);
void updateIcons();
void checkGradient();
private slots:
- void _player();
void _view_button();
void _dynamic_button();
void _playlists_button();
QList<Track> _current_tracks;
QString _search_pattern;
int _search_current_id;
- bool _current_playlist_changed;
ToolsWidget *_tools_widget;
bool landscape;
QString _icons_theme;
connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(settings()));
setAnimated(true);
- _player_form = new PlayerForm(_library, ui->stackedWidget);
- _library_form = new LibraryForm(_library, ui->stackedWidget);
- _busy_widget = new BusyWidget(ui->stackedWidget);
+ setAttribute(Qt::WA_Maemo5StackedWindow);
+ _player_form = new PlayerForm(_library, this);
+ ui->centralWidget->layout()->addWidget(_player_form);
+ _library_form = new LibraryForm(_library, this);
+ _library_form->setAttribute(Qt::WA_Maemo5StackedWindow);
+ _library_form->setWindowFlags(_library_form->windowFlags() | Qt::Window);
+ _busy_widget = new BusyWidget(this);
+ ui->centralWidget->layout()->addWidget(_busy_widget);
+ _busy_widget->hide();
_timer = new QTimer(this);
_equalizer_dialog = new EqualizerDialog(this);
- ui->stackedWidget->insertWidget(0, _player_form);
- ui->stackedWidget->insertWidget(1, _library_form);
- ui->stackedWidget->insertWidget(2, _busy_widget);
- QAction *add_directory = ui->menuLibrary->addAction("Add directory");
- QAction *save_playlist = ui->menuLibrary->addAction("Save playlist");
- QAction *clear_playlist = ui->menuLibrary->addAction("Clear current playlist");
- QAction *add_files = ui->menuLibrary->addAction("Add file to current playlist");
- QAction *set_timer = ui->menuBar->addAction("Set timer");
- QAction *equalizer = ui->menuBar->addAction("Equalizer");
+ _manage_library_form = new ManageLibraryForm(_library, this);
+ _manage_library_form->setAttribute(Qt::WA_Maemo5StackedWindow);
+ _manage_library_form->setWindowFlags(Qt::Window | _manage_library_form->windowFlags());
connect(_player_form, SIGNAL(library()), this, SLOT(library()));
- connect(_library_form, SIGNAL(player(bool)), this, SLOT(player(bool)));
- connect(add_directory, SIGNAL(triggered()), this, SLOT(_add_directory()));
- connect(save_playlist, SIGNAL(triggered()), this, SLOT(_save_playlist()));
- connect(clear_playlist, SIGNAL(triggered()), this, SLOT(_clear_current_playlist()));
- connect(add_files, SIGNAL(triggered()), this, SLOT(_add_files()));
- connect(set_timer, SIGNAL(triggered()), this, SLOT(_set_timer()));
- connect(equalizer, SIGNAL(triggered()), this, SLOT(_equalizer()));
+ connect(_library_form, SIGNAL(refreshPlayer()), this, SLOT(player()));
+ connect(ui->actionManageLibrary, SIGNAL(triggered()), this, SLOT(_manage_library()));
+ connect(ui->actionSavePlaylist, SIGNAL(triggered()), this, SLOT(_save_playlist()));
+ connect(_player_form, SIGNAL(clearPlaylist()), this, SLOT(_clear_current_playlist()));
+ connect(ui->actionSetTimer, SIGNAL(triggered()), this, SLOT(_set_timer()));
+ connect(ui->actionEqualizer, SIGNAL(triggered()), this, SLOT(_equalizer()));
connect(_library, SIGNAL(done()), this, SLOT(library()));
connect(_library, SIGNAL(done()), _library_form, SLOT(refresh()));
connect(_library, SIGNAL(addingTracks(int)), _busy_widget, SLOT(setMax(int)));
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(_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()));
connect(_player_form, SIGNAL(fullscreen(bool)), this, SLOT(_fullscreen(bool)));
- connect(_library_form, SIGNAL(fullscreen(bool)), this, SLOT(_fullscreen(bool)));
connect(_library_form, SIGNAL(addAndPlay(Track)), _player_form, SLOT(play(Track)));
_player_form->reload(true);
- library();
QString mode = config.getValue("ui/orientation").toString();
if (mode == "landscape") {
setAttribute(Qt::WA_Maemo5LandscapeOrientation);
_player_form->updateIcons();
_player_form->checkGradient();
_library_form->checkGradient();
+ setWindowTitle("SomePlayer");
}
MainWindow::~MainWindow()
"Author: Nikolay Tischenko aka \"somebody\" <niktischenko@gmail.com>");
}
-void MainWindow::player(bool reread) {
- ui->stackedWidget->setCurrentIndex(0);
- _player_form->reload(reread);
- setWindowTitle("SomePlayer");
+void MainWindow::player() {
+ _player_form->reload(true);
_orientation_changed(); // workaround
}
void MainWindow::library() {
ui->menuBar->setEnabled(true);
- _library_form->refresh();
- ui->stackedWidget->setCurrentIndex(1);
- setWindowTitle("SomePlayer Library");
+ _library_form->show();
_orientation_changed(); // workaround
+ _busy_widget->hide();
+ _manage_library_form->hide();
+ _player_form->show();
}
-void MainWindow::_add_directory() {
- QString directory = QFileDialog::getExistingDirectory (this, "Select directory", "/home/user/MyDocs", QFileDialog::ShowDirsOnly );
- if (!directory.isEmpty()) {
- showBusyWidget("<H1>Scanning... Please wait</H1>");
- _library->addDirectory(directory);
- }
+void MainWindow::_manage_library() {
+ _manage_library_form->show();
}
void MainWindow::_save_playlist() {
void MainWindow::showBusyWidget(QString caption) {
_busy_widget->setText(caption);
ui->menuBar->setEnabled(false);
- ui->stackedWidget->setCurrentIndex(2);
+ _player_form->hide();
+ _busy_widget->show();
}
void MainWindow::_add_files() {
#include "libraryform.h"
#include "busywidget.h"
#include "equalizerdialog.h"
+#include "managelibraryform.h"
#include "library.h"
#include <QTimer>
public slots:
void about();
- void player(bool);
+ void player();
void library();
void settings();
void showBusyWidget(QString);
private slots:
- void _add_directory();
+ void _manage_library();
+// void _add_directory();
void _save_playlist();
void _clear_current_playlist();
void _add_files();
Library *_library;
QTimer *_timer;
EqualizerDialog *_equalizer_dialog;
+ ManageLibraryForm *_manage_library_form;
};
#endif // MAINWINDOW_H
--- /dev/null
+/*
+ * SomePlayer - An alternate music player for Maemo 5
+ * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
+ *
+ * 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 "managelibraryform.h"
+#include "ui_managelibraryform.h"
+#include "library.h"
+#include <QFileDialog>
+
+using namespace SomePlayer::DataObjects;
+
+ManageLibraryForm::ManageLibraryForm(Library *library, QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::ManageLibraryForm),
+ _library (library)
+{
+ ui->setupUi(this);
+ connect(ui->addButton, SIGNAL(clicked()), this, SLOT(add()));
+}
+
+ManageLibraryForm::~ManageLibraryForm()
+{
+ delete ui;
+}
+
+void ManageLibraryForm::add() {
+ QString directory = QFileDialog::getExistingDirectory (this, "Select directory", "/home/user/MyDocs", QFileDialog::ShowDirsOnly );
+ if (!directory.isEmpty()) {
+ _library->addDirectory(directory);
+ }
+}
--- /dev/null
+/*
+ * SomePlayer - An alternate music player for Maemo 5
+ * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
+ *
+ * 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 MANAGELIBRARYFORM_H
+#define MANAGELIBRARYFORM_H
+
+#include <QWidget>
+#include "someplayer.h"
+
+namespace Ui {
+ class ManageLibraryForm;
+}
+
+using SomePlayer::DataObjects::Library;
+
+class ManageLibraryForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit ManageLibraryForm(Library *library, QWidget *parent = 0);
+ ~ManageLibraryForm();
+
+private slots:
+ void add();
+
+private:
+ Ui::ManageLibraryForm *ui;
+ Library *_library;
+};
+
+#endif // MANAGELIBRARYFORM_H
_model = new QStandardItemModel(0, 2, this);
ui->playlistView->setModel(_model);
_context_menu = new QMenu(ui->playlistView);
+ QAction *clear_playlist = _context_menu->addAction("Clear playlist");
QAction *delete_action = _context_menu->addAction("Delete");
QAction *add_to_favorites = _context_menu->addAction("Add to favorites");
QAction *enqueue_action = _context_menu->addAction("Enqueue");
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_menu_requested(QPoint)));
+ connect(clear_playlist, SIGNAL(triggered()), this, SIGNAL(clearPlaylist()));
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()));
_tools_widget->updateIcons();
ui->libraryButton->setIcon(QIcon(":/icons/"+_icons_theme+"/library.png"));
if (_tools_widget->isVisible()) {
- ui->moreButton->setIcon(QIcon(landscape ? ":/icons/"+_icons_theme+"/unmore.png" : ":/icons/"+_icons_theme+"/more.png"));
+ ui->moreButton->setIcon(QIcon(landscape ? ":/icons/" + _icons_theme + "/unmore.png" : ":/icons/" + _icons_theme + "/more.png"));
} else {
- ui->moreButton->setIcon(QIcon(landscape ? ":/icons/"+_icons_theme+"/more.png" : ":/icons/"+_icons_theme+"/unmore.png"));
+ ui->moreButton->setIcon(QIcon(landscape ? ":/icons/" + _icons_theme + "/more.png" : ":/icons/" + _icons_theme + "/unmore.png"));
}
ui->nextButton->setIcon(QIcon(":/icons/"+_icons_theme+"/next.png"));
ui->stopButton->setIcon(QIcon(":/icons/"+_icons_theme+"/stop.png"));
signals:
void library();
void fullscreen(bool);
+ void clearPlaylist();
public slots:
void reload(bool);
ui->nextButton->setVisible(state);
ui->prevButton->setVisible(state);
}
+
+void ToolsWidget::hideFSButton() {
+ ui->fscreenButton->hide();
+}
void updateIcons();
void show();
void toggleArrows(bool);
+ void hideFSButton();
signals:
void toggleFullscreen(bool);
<height>480</height>
</rect>
</property>
- <property name="palette">
- <palette>
- <active>
- <colorrole role="Text">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>0</red>
- <green>85</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="Text">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>0</red>
- <green>85</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="Text">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>127</red>
- <green>127</green>
- <blue>126</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
<property name="windowTitle">
- <string>Form</string>
+ <string>SomePlayer Library</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<string>someplayer</string>
</property>
<widget class="QWidget" name="centralWidget">
- <layout class="QVBoxLayout" name="verticalLayout" stretch="0">
+ <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
- <item>
- <widget class="QStackedWidget" name="stackedWidget">
- <widget class="QWidget" name="page"/>
- <widget class="QWidget" name="page_2"/>
- </widget>
- </item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="title">
<string>Library</string>
</property>
+ <addaction name="actionManageLibrary"/>
+ </widget>
+ <widget class="QMenu" name="menuTools">
+ <property name="title">
+ <string>Tools</string>
+ </property>
+ <addaction name="actionEqualizer"/>
+ <addaction name="actionSetTimer"/>
+ </widget>
+ <widget class="QMenu" name="menuPlayer">
+ <property name="title">
+ <string>Player</string>
+ </property>
+ <addaction name="actionSavePlaylist"/>
</widget>
<addaction name="menuHelp"/>
+ <addaction name="menuPlayer"/>
<addaction name="menuLibrary"/>
+ <addaction name="menuTools"/>
</widget>
<action name="actionAbout">
<property name="text">
<string>Settings</string>
</property>
</action>
+ <action name="actionManageLibrary">
+ <property name="text">
+ <string>Manage library</string>
+ </property>
+ </action>
+ <action name="actionEqualizer">
+ <property name="text">
+ <string>Equalizer</string>
+ </property>
+ </action>
+ <action name="actionSetTimer">
+ <property name="text">
+ <string>Set timer</string>
+ </property>
+ </action>
+ <action name="actionSavePlaylist">
+ <property name="text">
+ <string>Save playlist</string>
+ </property>
+ </action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ManageLibraryForm</class>
+ <widget class="QWidget" name="ManageLibraryForm">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>553</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>9</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="addButton">
+ <property name="text">
+ <string>Add new</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="updateButton">
+ <property name="text">
+ <string>Update</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="deleteButton">
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Added directories:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTableView" name="dirView">
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="editTriggers">
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::MultiSelection</enum>
+ </property>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>50</width>
+ <height>50</height>
+ </size>
+ </property>
+ <property name="showGrid">
+ <bool>false</bool>
+ </property>
+ <attribute name="horizontalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderDefaultSectionSize">
+ <number>70</number>
+ </attribute>
+ <attribute name="verticalHeaderMinimumSectionSize">
+ <number>70</number>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="artistsLabel">
+ <property name="text">
+ <string>0 artitst</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="albumsLabel">
+ <property name="text">
+ <string>0 albums</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="tracksView">
+ <property name="text">
+ <string>0 tracks</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
</rect>
</property>
<property name="windowTitle">
- <string>Form</string>
+ <string>SomePlayer</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">