From 097a8022131ef83b7a417b453cc9c443775c3d6b Mon Sep 17 00:00:00 2001 From: Flavio Tordini Date: Mon, 2 Nov 2009 21:21:17 +0100 Subject: [PATCH] Select search text on Ctrl+F Remove unused settings view --- src/MainWindow.cpp | 28 ++++++++++++++++------------ src/MainWindow.h | 6 +++--- src/searchlineedit.h | 1 + 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index f442aca..f59f483 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -23,7 +23,7 @@ MainWindow::MainWindow() { // lazily initialized views aboutView = 0; - settingsView = 0; + // settingsView = 0; toolbarSearch = new SearchLineEdit(this); toolbarSearch->setFont(qApp->font()); @@ -68,7 +68,7 @@ void MainWindow::createActions() { connect(settingsAct, SIGNAL(triggered()), this, SLOT(showSettings())); */ - backAct = new QAction(QIcon(":/images/go-previous.png"), tr("&Back"), this); + backAct = new QAction(tr("&Back"), this); backAct->setEnabled(false); backAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Left)); backAct->setStatusTip(tr("Go to the previous view")); @@ -135,14 +135,14 @@ void MainWindow::createActions() { actions->insert("remove", removeAct); connect(removeAct, SIGNAL(triggered()), mediaView, SLOT(removeSelected())); - moveUpAct = new QAction(QtIconLoader::icon("go-up", QIcon(":/images/go-up.png")), tr("Move &Up"), this); + moveUpAct = new QAction(tr("Move &Up"), this); moveUpAct->setStatusTip(tr("Move up the selected videos in the playlist")); moveUpAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up)); moveUpAct->setEnabled(false); actions->insert("moveUp", moveUpAct); connect(moveUpAct, SIGNAL(triggered()), mediaView, SLOT(moveUpSelected())); - moveDownAct = new QAction(QtIconLoader::icon("go-down", QIcon(":/images/go-down.png")), tr("Move &Down"), this); + moveDownAct = new QAction(tr("Move &Down"), this); moveDownAct->setStatusTip(tr("Move down the selected videos in the playlist")); moveDownAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down)); moveDownAct->setEnabled(false); @@ -202,7 +202,7 @@ void MainWindow::createActions() { addAction(volumeMuteAct); QAction *hdAct = new QAction(this); - hdAct->setShortcuts(QList() << QKeySequence(Qt::CTRL + Qt::Key_H)); + hdAct->setShortcuts(QList() << QKeySequence(Qt::CTRL + Qt::Key_D)); hdAct->setIcon(createHDIcon()); hdAct->setCheckable(true); actions->insert("hd", hdAct); @@ -336,7 +336,9 @@ void MainWindow::createStatusBar() { // remove ugly borders on OSX // and remove some excessive padding - statusBar()->setStyleSheet("::item{border:0 solid} QStatusBar, QToolBar {padding:0;margin:0} QToolButton {padding:1px}"); + statusBar()->setStyleSheet("::item{border:0 solid} " + "QStatusBar, QToolBar, QToolButton {spacing:0;padding:0;margin:0} " + ); QToolBar *toolBar = new QToolBar(this); int iconHeight = 24; // statusBar()->height(); @@ -467,13 +469,14 @@ void MainWindow::closeEvent(QCloseEvent *event) { QWidget::closeEvent(event); } +/* void MainWindow::showSettings() { if (!settingsView) { settingsView = new SettingsView(this); views->addWidget(settingsView); } showWidget(settingsView); -} +}*/ void MainWindow::showSearch() { showWidget(searchView); @@ -625,6 +628,7 @@ void MainWindow::compactView(bool enable) { void MainWindow::searchFocus() { QWidget *view = views->currentWidget(); if (view == mediaView) { + toolbarSearch->selectAll(); toolbarSearch->setFocus(); } } @@ -802,11 +806,11 @@ QPixmap MainWindow::createHDPixmap(bool enabled) { QPen pen; pen.setColor(Qt::black); + pen.setWidth(1); painter.setPen(pen); if (enabled) { - QPalette palette; - painter.setBrush(palette.highlight()); + painter.setBrush(palette().highlight()); } else { QLinearGradient gradient(QPointF(0, 0), QPointF(0, rect.height() / 2)); gradient.setColorAt(0, QColor(0x6d, 0x6d, 0x6d)); @@ -816,10 +820,9 @@ QPixmap MainWindow::createHDPixmap(bool enabled) { painter.drawRoundedRect(rect, 5, 5); if (enabled) { - pen.setColor(Qt::white); + pen.setColor(palette().highlightedText().color()); } else { - QPalette palette; - pen.setColor(palette.highlightedText().color()); + pen.setColor(Qt::white); } painter.setPen(pen); @@ -851,6 +854,7 @@ void MainWindow::saveHdSetting(bool enabled) { } else { hdAct->setStatusTip(tr("High Definition video is not enabled") + " (" + hdAct->shortcut().toString(QKeySequence::NativeText) + ")"); } + statusBar()->showMessage(hdAct->statusTip()); } void MainWindow::hdIndicator(bool isHd) { diff --git a/src/MainWindow.h b/src/MainWindow.h index f8b81e0..eb0cd69 100755 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -40,7 +40,7 @@ protected: private slots: void fadeInWidget(QWidget *oldWidget, QWidget *newWidget); void goBack(); - void showSettings(); + // void showSettings(); void showSearch(); void showMedia(QString query); void visitSite(); @@ -95,12 +95,12 @@ private: // view widgets QWidget *searchView; MediaView *mediaView; - QWidget *settingsView; + // QWidget *settingsView; QWidget *aboutView; // actions QAction *addGadgetAct; - QAction *settingsAct; + // QAction *settingsAct; QAction *backAct; QAction *quitAct; QAction *siteAct; diff --git a/src/searchlineedit.h b/src/searchlineedit.h index 75ac299..0f20a08 100644 --- a/src/searchlineedit.h +++ b/src/searchlineedit.h @@ -92,6 +92,7 @@ public: void updateGeometries(); void enableSuggest(); void preventSuggest(); + void selectAll() { lineEdit()->selectAll(); }; protected: void resizeEvent(QResizeEvent *event); -- 2.39.5