src/timerdialog.h \
src/equalizerdialog.h \
src/saveplaylistdialog.h \
- src/settingsdialog.h
+ src/settingsdialog.h \
+ src/abstractitemrenderer.h
FORMS += src/ui/mainwindow.ui \
src/ui/playerform.ui \
--- /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 ABSTRACTITEMRENDERER_H
+#define ABSTRACTITEMRENDERER_H
+
+#include <QAbstractItemDelegate>
+#include <QPainter>
+
+class AbstractItemRenderer : public QAbstractItemDelegate
+{
+ Q_OBJECT
+public:
+ explicit AbstractItemRenderer(QObject *parent = 0) : QAbstractItemDelegate(parent) {}
+
+signals:
+
+public slots:
+ void setActiveRow(int r) {_active_row = r;}
+ void setSearchRow(int r) {_search_row = r;}
+ int activeRow() {return _active_row;}
+ int searchRow() {return _search_row;}
+protected:
+ int _active_row;
+ int _search_row;
+
+};
+
+#endif // ABSTRACTITEMRENDERER_H
_model->setItem(1, new QStandardItem("Most played"));
_model->setItem(2, new QStandardItem("Never played"));
_model->setItem(3, new QStandardItem("Recently added"));
+ ui->listLabel->setText("Dynamic playlists");
_state = STATE_DYNAMIC;
}
ui->searchLine->show();
ui->nextButton->show();
ui->prevButton->show();
+ ui->searchLine->setFocus(Qt::MouseFocusReason);
}
}
void MainWindow::showSearchPanel() {
ui->searchButton->show();
- ui->searchLine->setFocus();
}
void MainWindow::hideSearchPanel() {
#include <QColor>
TrackRenderer::TrackRenderer(QObject *parent) :
- QAbstractItemDelegate(parent)
+ AbstractItemRenderer(parent)
{
}
QSize TrackRenderer::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &/*index*/) const {
return QSize(option.rect.width(), 80);
}
-
-void TrackRenderer::setActiveRow(int r) {
- _active_row = r;
-}
-
-void TrackRenderer::setSearchRow(int r) {
- _search_row = r;
-}
#define TRACKRENDERER_H
#include <QAbstractItemDelegate>
+#include "abstractitemrenderer.h"
#include <QPainter>
-class TrackRenderer : public QAbstractItemDelegate
+class TrackRenderer : public AbstractItemRenderer
{
- Q_OBJECT
+ Q_OBJECT
public:
- explicit TrackRenderer(QObject *parent = 0);
+ explicit TrackRenderer(QObject *parent = 0);
void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const;
-
-signals:
-
-public slots:
- void setActiveRow(int);
- void setSearchRow(int);
- int activeRow() {return _active_row;}
- int searchRow() {return _search_row;}
-private:
- int _active_row;
- int _search_row;
-
};
#endif // TRACKRENDERER_H