Implemented search
[someplayer] / src / mainwindow.cpp
index f9d470e..3ad7ea1 100644 (file)
@@ -43,6 +43,7 @@ MainWindow::MainWindow(QWidget *parent) :
        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()));
        hideSearchPanel();
        library();
 }
@@ -122,6 +123,7 @@ void MainWindow::_toggle_search_line() {
 
 void MainWindow::showSearchPanel() {
        ui->searchButton->show();
+       ui->searchLine->setFocus();
 }
 
 void MainWindow::hideSearchPanel() {
@@ -136,23 +138,41 @@ void MainWindow::hideSearchPanel() {
 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/fullscreen.png"));
+               showNormal();
+       } else {
+               ui->fscreenButton->setIcon(QIcon(":/icons/window.png"));
+               showFullScreen();
        }
 }