From 556cf441d55188184caaff274bcfbbf2d083e3f5 Mon Sep 17 00:00:00 2001 From: Flavio Date: Wed, 12 Dec 2012 17:39:05 +0100 Subject: [PATCH] Renamed uppercase filenames to lowercase --- .gitignore | 2 + CHANGES | 4 ++ minitube.pro | 54 +++++++++++-------- resources.qrc | 1 + src/View.h | 13 ----- src/{AboutView.cpp => aboutview.cpp} | 2 +- src/{AboutView.h => aboutview.h} | 7 ++- src/downloadlistview.cpp | 4 +- src/downloadmanager.cpp | 2 +- src/downloadmodel.cpp | 2 +- src/downloadsettings.cpp | 2 +- src/downloadview.cpp | 6 +-- src/downloadview.h | 7 ++- src/{ListModel.cpp => listmodel.cpp} | 14 ++--- src/{ListModel.h => listmodel.h} | 0 src/main.cpp | 2 +- src/{MainWindow.cpp => mainwindow.cpp} | 46 +++++++++------- src/{MainWindow.h => mainwindow.h} | 14 ++--- src/{MediaView.cpp => mediaview.cpp} | 8 +-- src/{MediaView.h => mediaview.h} | 13 +---- ...mDelegate.cpp => playlistitemdelegate.cpp} | 42 +++++++-------- ...yItemDelegate.h => playlistitemdelegate.h} | 6 +-- src/playlistview.cpp | 6 +-- src/{SearchView.cpp => searchview.cpp} | 4 +- src/{SearchView.h => searchview.h} | 11 ++-- src/videoareawidget.h | 2 +- src/view.h | 13 +++++ 27 files changed, 147 insertions(+), 140 deletions(-) delete mode 100644 src/View.h rename src/{AboutView.cpp => aboutview.cpp} (99%) rename src/{AboutView.h => aboutview.h} (80%) rename src/{ListModel.cpp => listmodel.cpp} (97%) rename src/{ListModel.h => listmodel.h} (100%) rename src/{MainWindow.cpp => mainwindow.cpp} (97%) rename src/{MainWindow.h => mainwindow.h} (95%) rename src/{MediaView.cpp => mediaview.cpp} (99%) rename src/{MediaView.h => mediaview.h} (91%) rename src/{playlist/PrettyItemDelegate.cpp => playlistitemdelegate.cpp} (91%) rename src/{playlist/PrettyItemDelegate.h => playlistitemdelegate.h} (89%) rename src/{SearchView.cpp => searchview.cpp} (99%) rename src/{SearchView.h => searchview.h} (87%) create mode 100644 src/view.h diff --git a/.gitignore b/.gitignore index d3fbddf..c645b5d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ minitube.pro.user local/ *.swp .tx +android +qtc_packaging diff --git a/CHANGES b/CHANGES index ed037c4..6be6d80 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +2.0 +- Autoupdate on Mac and Windows +- Fixed clicking on channel names not working in some cases + 1.9 - September 27, 2012 - Adapted to YouTube changes - New search filter UI. Filter results by publication date, video duration and video quality. diff --git a/minitube.pro b/minitube.pro index e705eb1..1846c02 100644 --- a/minitube.pro +++ b/minitube.pro @@ -1,6 +1,6 @@ CONFIG += release TEMPLATE = app -VERSION = 1.9 +VERSION = 2.0 DEFINES += APP_VERSION="$$VERSION" APP_NAME = Minitube @@ -11,29 +11,23 @@ DEFINES += APP_UNIX_NAME="$$APP_UNIX_NAME" DEFINES += QT_USE_FAST_CONCATENATION DEFINES += QT_USE_FAST_OPERATOR_PLUS +DEFINES += QT_STRICT_ITERATORS # TODO Saner string behaviour -# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII QT_STRICT_ITERATORS +# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII TARGET = minitube -QT += network \ - xml \ - phonon +QT += network xml phonon declarative include(src/qtsingleapplication/qtsingleapplication.pri) -HEADERS += src/MainWindow.h \ - src/SearchView.h \ - src/MediaView.h \ - src/AboutView.h \ +HEADERS += \ src/youtubesearch.h \ src/video.h \ src/youtubestreamreader.h \ - src/View.h \ src/searchlineedit.h \ src/urllineedit.h \ src/spacer.h \ src/constants.h \ src/iconloader/qticonloader.h \ - src/ListModel.h \ - src/playlist/PrettyItemDelegate.h \ + src/playlistitemdelegate.h \ src/networkaccess.h \ src/videomimedata.h \ src/global.h \ @@ -62,12 +56,18 @@ HEADERS += src/MainWindow.h \ src/playlistview.h \ src/refinesearchwidget.h \ src/refinesearchbutton.h \ - src/sidebarwidget.h + src/sidebarwidget.h \ + src/homeview.h \ + src/aboutview.h \ + src/listmodel.h \ + src/mainwindow.h \ + src/mediaview.h \ + src/searchview.h \ + src/view.h \ + src/categoriesview.h \ + src/userview.h \ + src/youtubecategories.h SOURCES += src/main.cpp \ - src/MainWindow.cpp \ - src/SearchView.cpp \ - src/MediaView.cpp \ - src/AboutView.cpp \ src/youtubesearch.cpp \ src/youtubestreamreader.cpp \ src/searchlineedit.cpp \ @@ -75,8 +75,6 @@ SOURCES += src/main.cpp \ src/spacer.cpp \ src/video.cpp \ src/iconloader/qticonloader.cpp \ - src/ListModel.cpp \ - src/playlist/PrettyItemDelegate.cpp \ src/videomimedata.cpp \ src/updatechecker.cpp \ src/networkaccess.cpp \ @@ -104,7 +102,17 @@ SOURCES += src/main.cpp \ src/playlistview.cpp \ src/refinesearchwidget.cpp \ src/refinesearchbutton.cpp \ - src/sidebarwidget.cpp + src/sidebarwidget.cpp \ + src/homeview.cpp \ + src/mainwindow.cpp \ + src/mediaview.cpp \ + src/listmodel.cpp \ + src/aboutview.cpp \ + src/searchview.cpp \ + src/categoriesview.cpp \ + src/userview.cpp \ + src/playlistitemdelegate.cpp \ + src/youtubecategories.cpp RESOURCES += resources.qrc DESTDIR = build/target/ OBJECTS_DIR = build/obj/ @@ -117,8 +125,7 @@ CODECFORSRC = UTF-8 include(locale/locale.pri) # deploy -DISTFILES += CHANGES \ - COPYING +DISTFILES += CHANGES COPYING unix:!mac { INCLUDEPATH += /usr/include/phonon QT += dbus @@ -167,3 +174,6 @@ unix:!mac { icon512.files += data/512x512/minitube.png } mac|win32:include(local/local.pri) + +OTHER_FILES += \ + qml/categories.qml diff --git a/resources.qrc b/resources.qrc index 64c2549..5961a8f 100644 --- a/resources.qrc +++ b/resources.qrc @@ -6,5 +6,6 @@ images/search-sortBy.png images/search-quality.png images/search-duration.png + qml/categories.qml diff --git a/src/View.h b/src/View.h deleted file mode 100644 index ea701bd..0000000 --- a/src/View.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef VIEW_H -#define VIEW_H - -class View { - - public: - virtual QMap metadata() = 0; - virtual void appear() = 0; - virtual void disappear() = 0; - -}; - -#endif // VIEW_H diff --git a/src/AboutView.cpp b/src/aboutview.cpp similarity index 99% rename from src/AboutView.cpp rename to src/aboutview.cpp index 8cbfad7..9a5e259 100644 --- a/src/AboutView.cpp +++ b/src/aboutview.cpp @@ -1,4 +1,4 @@ -#include "AboutView.h" +#include "aboutview.h" #include "constants.h" #ifndef Q_WS_X11 #include "extra.h" diff --git a/src/AboutView.h b/src/aboutview.h similarity index 80% rename from src/AboutView.h rename to src/aboutview.h index e1977dd..912c63c 100644 --- a/src/AboutView.h +++ b/src/aboutview.h @@ -2,7 +2,7 @@ #define ABOUTVIEW_H #include -#include "View.h" +#include "view.h" #include "constants.h" class AboutView : public QWidget, public View { @@ -12,9 +12,8 @@ class AboutView : public QWidget, public View { public: AboutView(QWidget *parent); void appear(); - void disappear() {} - QMap metadata() { - QMap metadata; + QHash metadata() { + QHash metadata; metadata.insert("title", tr("About")); metadata.insert("description", tr("What you always wanted to know about %1 and never dared to ask") diff --git a/src/downloadlistview.cpp b/src/downloadlistview.cpp index 25ddf2f..4ebb34c 100644 --- a/src/downloadlistview.cpp +++ b/src/downloadlistview.cpp @@ -1,6 +1,6 @@ #include "downloadlistview.h" #include "downloadmodel.h" -#include "playlist/PrettyItemDelegate.h" +#include "playlistitemdelegate.h" DownloadListView::DownloadListView(QWidget *parent) : QListView(parent) { @@ -48,7 +48,7 @@ bool DownloadListView::isHoveringPlayIcon(QMouseEvent *event) { const QRect itemRect = visualRect(itemIndex); // qDebug() << " itemRect.x()" << itemRect.x(); - PrettyItemDelegate *delegate = dynamic_cast(itemDelegate()); + PlaylistItemDelegate *delegate = dynamic_cast(itemDelegate()); if (!delegate) return false; QRect buttonRect = delegate->downloadButtonRect(itemRect); diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index b06b3ec..6430205 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -3,7 +3,7 @@ #include "downloadmodel.h" #include "video.h" #include "constants.h" -#include "MainWindow.h" +#include "mainwindow.h" #ifdef APP_ACTIVATION #include "activation.h" #endif diff --git a/src/downloadmodel.cpp b/src/downloadmodel.cpp index d68db0e..702711e 100644 --- a/src/downloadmodel.cpp +++ b/src/downloadmodel.cpp @@ -2,7 +2,7 @@ #include "downloadmanager.h" #include "downloaditem.h" #include "video.h" -#include "ListModel.h" +#include "listmodel.h" DownloadModel::DownloadModel(DownloadManager *downloadManager, QObject *parent) : QAbstractListModel(parent), diff --git a/src/downloadsettings.cpp b/src/downloadsettings.cpp index 990f5c7..d73182e 100644 --- a/src/downloadsettings.cpp +++ b/src/downloadsettings.cpp @@ -1,6 +1,6 @@ #include "downloadsettings.h" #include "downloadmanager.h" -#include "MainWindow.h" +#include "mainwindow.h" DownloadSettings::DownloadSettings(QWidget *parent) : QWidget(parent) { diff --git a/src/downloadview.cpp b/src/downloadview.cpp index 3ed343b..11b7400 100644 --- a/src/downloadview.cpp +++ b/src/downloadview.cpp @@ -4,8 +4,8 @@ #include "downloadlistview.h" #include "downloaditem.h" #include "downloadsettings.h" -#include "ListModel.h" -#include "playlist/PrettyItemDelegate.h" +#include "listmodel.h" +#include "playlistitemdelegate.h" #include "segmentedcontrol.h" DownloadView::DownloadView(QWidget *parent) : QWidget(parent) { @@ -28,7 +28,7 @@ DownloadView::DownloadView(QWidget *parent) : QWidget(parent) { p.setColor(QPalette::Base, palette().color(QPalette::Window)); listView->setPalette(p); */ - PrettyItemDelegate *delegate = new PrettyItemDelegate(this, true); + PlaylistItemDelegate *delegate = new PlaylistItemDelegate(this, true); listView->setItemDelegate(delegate); listView->setSelectionMode(QAbstractItemView::NoSelection); diff --git a/src/downloadview.h b/src/downloadview.h index fdbbb54..2ac7b3d 100644 --- a/src/downloadview.h +++ b/src/downloadview.h @@ -2,7 +2,7 @@ #define DOWNLOADVIEW_H #include -#include "View.h" +#include "view.h" class SegmentedControl; class DownloadModel; @@ -17,10 +17,9 @@ public: DownloadView(QWidget *parent); void appear(); void disappear(); - QMap metadata() { - QMap metadata; + QHash metadata() { + QHash metadata; metadata.insert("title", tr("Downloads")); - metadata.insert("description", ""); return metadata; } diff --git a/src/ListModel.cpp b/src/listmodel.cpp similarity index 97% rename from src/ListModel.cpp rename to src/listmodel.cpp index 851c152..4e8662b 100644 --- a/src/ListModel.cpp +++ b/src/listmodel.cpp @@ -1,4 +1,4 @@ -#include "ListModel.h" +#include "listmodel.h" #include "videomimedata.h" #define MAX_ITEMS 10 @@ -311,16 +311,12 @@ Qt::DropActions ListModel::supportedDropActions() const { } Qt::ItemFlags ListModel::flags(const QModelIndex &index) const { - Qt::ItemFlags defaultFlags = QAbstractListModel::flags(index); - - if (index.isValid()) { + if (index.isValid()) if (index.row() == videos.size()) { // don't drag the "show 10 more" item - return defaultFlags; - } else - return ( defaultFlags | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled ); - } else - return Qt::ItemIsDropEnabled | defaultFlags; + return Qt::ItemIsEnabled; + } else return (Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled); + return Qt::ItemIsDropEnabled; } QStringList ListModel::mimeTypes() const { diff --git a/src/ListModel.h b/src/listmodel.h similarity index 100% rename from src/ListModel.h rename to src/listmodel.h diff --git a/src/main.cpp b/src/main.cpp index fa60457..02b4abe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,7 @@ #include #include #include "constants.h" -#include "MainWindow.h" +#include "mainwindow.h" #include "searchparams.h" #include "iconloader/qticonloader.h" #ifndef Q_WS_X11 diff --git a/src/MainWindow.cpp b/src/mainwindow.cpp similarity index 97% rename from src/MainWindow.cpp rename to src/mainwindow.cpp index b0e184e..c427d91 100644 --- a/src/MainWindow.cpp +++ b/src/mainwindow.cpp @@ -1,4 +1,9 @@ -#include "MainWindow.h" +#include "mainwindow.h" +#include "homeview.h" +#include "searchview.h" +#include "mediaview.h" +#include "aboutview.h" +#include "downloadview.h" #include "spacer.h" #include "constants.h" #include "iconloader/qticonloader.h" @@ -57,10 +62,10 @@ MainWindow::MainWindow() : views = new QStackedWidget(this); // views - searchView = new SearchView(this); - connect(searchView, SIGNAL(search(SearchParams*)), this, SLOT(showMedia(SearchParams*))); - views->addWidget(searchView); + homeView = new HomeView(this); + views->addWidget(homeView); + // TODO make this lazy mediaView = new MediaView(this); mediaView->setEnabled(false); views->addWidget(mediaView); @@ -97,7 +102,7 @@ MainWindow::MainWindow() : setMinimumWidth(0); // show the initial view - showSearch(false); + showHome(false); #ifdef APP_ACTIVATION if (!Activation::instance().isActivated()) @@ -763,12 +768,12 @@ void MainWindow::showWidget(QWidget* widget, bool transition) { if (newView) { widget->setEnabled(true); newView->appear(); - QMap metadata = newView->metadata(); - QString windowTitle = metadata.value("title").toString(); - if (windowTitle.length()) - windowTitle += " - "; - setWindowTitle(windowTitle + Constants::NAME); - statusBar()->showMessage((metadata.value("description").toString())); + QHash metadata = newView->metadata(); + QString title = metadata.value("title").toString(); + if (!title.isEmpty()) title += " - "; + setWindowTitle(title + Constants::NAME); + QString desc = metadata.value("description").toString(); + if (!desc.isEmpty()) showMessage(desc); } const bool isMediaView = widget == mediaView; @@ -779,9 +784,9 @@ void MainWindow::showWidget(QWidget* widget, bool transition) { copyPageAct->setEnabled(isMediaView); copyLinkAct->setEnabled(isMediaView); findVideoPartsAct->setEnabled(isMediaView); - toolbarSearch->setEnabled(widget == searchView || isMediaView || widget == downloadView); + toolbarSearch->setEnabled(widget == homeView || isMediaView || widget == downloadView); - if (widget == searchView) { + if (widget == homeView) { skipAct->setEnabled(false); The::globalActions()->value("previous")->setEnabled(false); The::globalActions()->value("download")->setEnabled(false); @@ -887,8 +892,8 @@ bool MainWindow::confirmQuit() { return true; } -void MainWindow::showSearch(bool transition) { - showWidget(searchView, transition); +void MainWindow::showHome(bool transition) { + showWidget(homeView, transition); currentTime->clear(); totalTime->clear(); } @@ -950,7 +955,7 @@ void MainWindow::stateChanged(Phonon::State newState, Phonon::State /* oldState void MainWindow::stop() { mediaView->stop(); - showSearch(); + showHome(); } void MainWindow::resizeEvent(QResizeEvent*) { @@ -1272,9 +1277,12 @@ void MainWindow::clearRecentKeywords() { QSettings settings; settings.remove("recentKeywords"); settings.remove("recentChannels"); - searchView->updateRecentKeywords(); - searchView->updateRecentChannels(); - statusBar()->showMessage(tr("Your privacy is now safe")); + if (views->currentWidget() == homeView) { + SearchView *searchView = homeView->getSearchView(); + searchView->updateRecentKeywords(); + searchView->updateRecentChannels(); + } + showMessage(tr("Your privacy is now safe")); } void MainWindow::setManualPlay(bool enabled) { diff --git a/src/MainWindow.h b/src/mainwindow.h similarity index 95% rename from src/MainWindow.h rename to src/mainwindow.h index b0b3b74..cdb66f5 100644 --- a/src/MainWindow.h +++ b/src/mainwindow.h @@ -6,14 +6,14 @@ #include #include #include -#include "View.h" -#include "SearchView.h" -#include "MediaView.h" -#include "AboutView.h" -#include "downloadview.h" +#include "view.h" +class HomeView; +class MediaView; +class DownloadView; class SearchLineEdit; class UpdateChecker; +class SearchParams; class MainWindow : public QMainWindow { @@ -29,6 +29,7 @@ public: static void printHelp(); public slots: + void showHome(bool transition = true); void showMedia(SearchParams *params); void restore(); void messageReceived(const QString &message); @@ -54,7 +55,6 @@ protected: private slots: void checkForUpdate(); void gotNewVersion(QString version); - void showSearch(bool transition = true); void visitSite(); void donate(); void reportIssue(); @@ -111,7 +111,7 @@ private: QStack *history; // view widgets - SearchView *searchView; + HomeView *homeView; MediaView *mediaView; QWidget *aboutView; QWidget *downloadView; diff --git a/src/MediaView.cpp b/src/mediaview.cpp similarity index 99% rename from src/MediaView.cpp rename to src/mediaview.cpp index 1b0dce1..32540b3 100644 --- a/src/MediaView.cpp +++ b/src/mediaview.cpp @@ -1,13 +1,13 @@ -#include "MediaView.h" +#include "mediaview.h" #include "playlistview.h" -#include "playlist/PrettyItemDelegate.h" +#include "playlistitemdelegate.h" #include "networkaccess.h" #include "videowidget.h" #include "minisplitter.h" #include "constants.h" #include "downloadmanager.h" #include "downloaditem.h" -#include "MainWindow.h" +#include "mainwindow.h" #include "temporary.h" #include "sidebarwidget.h" #include "playlistwidget.h" @@ -42,7 +42,7 @@ MediaView::MediaView(QWidget *parent) : QWidget(parent) { splitter->setChildrenCollapsible(false); listView = new PlaylistView(this); - listView->setItemDelegate(new PrettyItemDelegate(this)); + listView->setItemDelegate(new PlaylistItemDelegate(this)); listView->setSelectionMode(QAbstractItemView::ExtendedSelection); // dragndrop diff --git a/src/MediaView.h b/src/mediaview.h similarity index 91% rename from src/MediaView.h rename to src/mediaview.h index 54a2803..088b98c 100644 --- a/src/MediaView.h +++ b/src/mediaview.h @@ -6,8 +6,8 @@ #include #include #include -#include "View.h" -#include "ListModel.h" +#include "view.h" +#include "listmodel.h" #include "segmentedcontrol.h" #include "searchparams.h" #include "loadingwidget.h" @@ -28,17 +28,8 @@ public: MediaView(QWidget *parent); void initialize(); - // View void appear(); void disappear(); - QMap metadata() { - QMap metadata; - if (searchParams) { - metadata.insert("title", ""); - metadata.insert("description", ""); - } - return metadata; - } void setMediaObject(Phonon::MediaObject *mediaObject); void setSlider(Phonon::SeekSlider *slider) { this->seekSlider = slider; } diff --git a/src/playlist/PrettyItemDelegate.cpp b/src/playlistitemdelegate.cpp similarity index 91% rename from src/playlist/PrettyItemDelegate.cpp rename to src/playlistitemdelegate.cpp index 846650f..7ca439c 100644 --- a/src/playlist/PrettyItemDelegate.cpp +++ b/src/playlistitemdelegate.cpp @@ -1,22 +1,22 @@ -#include "PrettyItemDelegate.h" -#include "../ListModel.h" -#include "../fontutils.h" -#include "../downloaditem.h" -#include "../iconloader/qticonloader.h" -#include "../videodefinition.h" +#include "playlistitemdelegate.h" +#include "listmodel.h" +#include "fontutils.h" +#include "downloaditem.h" +#include "iconloader/qticonloader.h" +#include "videodefinition.h" #include #include #include -const qreal PrettyItemDelegate::THUMB_HEIGHT = 90.0; -const qreal PrettyItemDelegate::THUMB_WIDTH = 120.0; -const qreal PrettyItemDelegate::PADDING = 10.0; +const qreal PlaylistItemDelegate::THUMB_HEIGHT = 90.0; +const qreal PlaylistItemDelegate::THUMB_WIDTH = 120.0; +const qreal PlaylistItemDelegate::PADDING = 10.0; QRect lastAuthorRect; QHash authorRects; -PrettyItemDelegate::PrettyItemDelegate(QObject* parent, bool downloadInfo) +PlaylistItemDelegate::PlaylistItemDelegate(QObject* parent, bool downloadInfo) : QStyledItemDelegate(parent), downloadInfo(downloadInfo) { boldFont.setBold(true); @@ -33,7 +33,7 @@ PrettyItemDelegate::PrettyItemDelegate(QObject* parent, bool downloadInfo) } else createPlayIcon(); } -void PrettyItemDelegate::createPlayIcon() { +void PlaylistItemDelegate::createPlayIcon() { playIcon = QPixmap(THUMB_WIDTH, THUMB_HEIGHT); playIcon.fill(Qt::transparent); QPainter painter(&playIcon); @@ -52,13 +52,13 @@ void PrettyItemDelegate::createPlayIcon() { painter.drawPolygon(polygon); } -PrettyItemDelegate::~PrettyItemDelegate() { } +PlaylistItemDelegate::~PlaylistItemDelegate() { } -QSize PrettyItemDelegate::sizeHint( const QStyleOptionViewItem& /*option*/, const QModelIndex& /*index*/ ) const { +QSize PlaylistItemDelegate::sizeHint( const QStyleOptionViewItem& /*option*/, const QModelIndex& /*index*/ ) const { return QSize( 256, THUMB_HEIGHT+1.0); } -void PrettyItemDelegate::paint( QPainter* painter, +void PlaylistItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const { int itemType = index.data(ItemTypeRole).toInt(); @@ -73,7 +73,7 @@ void PrettyItemDelegate::paint( QPainter* painter, } -void PrettyItemDelegate::paintBody( QPainter* painter, +void PlaylistItemDelegate::paintBody( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const { @@ -213,7 +213,7 @@ void PrettyItemDelegate::paintBody( QPainter* painter, } -void PrettyItemDelegate::paintActiveOverlay( QPainter *painter, qreal x, qreal y, qreal w, qreal h ) const { +void PlaylistItemDelegate::paintActiveOverlay( QPainter *painter, qreal x, qreal y, qreal w, qreal h ) const { QPalette palette; QColor highlightColor = palette.color(QPalette::Highlight); @@ -242,14 +242,14 @@ void PrettyItemDelegate::paintActiveOverlay( QPainter *painter, qreal x, qreal y painter->restore(); } -void PrettyItemDelegate::paintPlayIcon(QPainter *painter) const { +void PlaylistItemDelegate::paintPlayIcon(QPainter *painter) const { painter->save(); painter->setOpacity(.5); painter->drawPixmap(playIcon.rect(), playIcon); painter->restore(); } -void PrettyItemDelegate::drawTime(QPainter *painter, QString time, QRectF line) const { +void PlaylistItemDelegate::drawTime(QPainter *painter, QString time, QRectF line) const { static const int timePadding = 4; QRectF textBox = painter->boundingRect(line, Qt::AlignLeft | Qt::AlignTop, time); // add padding @@ -270,7 +270,7 @@ void PrettyItemDelegate::drawTime(QPainter *painter, QString time, QRectF line) painter->restore(); } -void PrettyItemDelegate::paintDownloadInfo( QPainter* painter, +void PlaylistItemDelegate::paintDownloadInfo( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const { @@ -379,7 +379,7 @@ void PrettyItemDelegate::paintDownloadInfo( QPainter* painter, } -QRect PrettyItemDelegate::downloadButtonRect(QRect line) const { +QRect PlaylistItemDelegate::downloadButtonRect(QRect line) const { return QRect( line.width() - PADDING*2 - 16, PADDING + progressBar->sizeHint().height() / 2 - 8, @@ -387,6 +387,6 @@ QRect PrettyItemDelegate::downloadButtonRect(QRect line) const { 16); } -QRect PrettyItemDelegate::authorRect(const QModelIndex& index) const { +QRect PlaylistItemDelegate::authorRect(const QModelIndex& index) const { return authorRects.value(index.row()); } diff --git a/src/playlist/PrettyItemDelegate.h b/src/playlistitemdelegate.h similarity index 89% rename from src/playlist/PrettyItemDelegate.h rename to src/playlistitemdelegate.h index 8934f57..5f8399b 100644 --- a/src/playlist/PrettyItemDelegate.h +++ b/src/playlistitemdelegate.h @@ -7,13 +7,13 @@ class QPainter; class QProgressBar; -class PrettyItemDelegate : public QStyledItemDelegate { +class PlaylistItemDelegate : public QStyledItemDelegate { Q_OBJECT public: - PrettyItemDelegate(QObject* parent, bool downloadInfo = false); - ~PrettyItemDelegate(); + PlaylistItemDelegate(QObject* parent, bool downloadInfo = false); + ~PlaylistItemDelegate(); QSize sizeHint( const QStyleOptionViewItem&, const QModelIndex& ) const; void paint( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const; diff --git a/src/playlistview.cpp b/src/playlistview.cpp index d976b09..d73fd39 100644 --- a/src/playlistview.cpp +++ b/src/playlistview.cpp @@ -1,6 +1,6 @@ #include "playlistview.h" -#include "ListModel.h" -#include "playlist/PrettyItemDelegate.h" +#include "listmodel.h" +#include "playlistitemdelegate.h" PlaylistView::PlaylistView(QWidget *parent) : QListView(parent) { connect(this, SIGNAL(entered(const QModelIndex &)), SLOT(itemEntered(const QModelIndex &))); @@ -62,7 +62,7 @@ bool PlaylistView::isHoveringAuthor(QMouseEvent *event) { const QRect itemRect = visualRect(itemIndex); // qDebug() << " itemRect.x()" << itemRect.x(); - PrettyItemDelegate *delegate = dynamic_cast(itemDelegate()); + PlaylistItemDelegate *delegate = dynamic_cast(itemDelegate()); if (!delegate) return false; QRect rect = delegate->authorRect(itemIndex); diff --git a/src/SearchView.cpp b/src/searchview.cpp similarity index 99% rename from src/SearchView.cpp rename to src/searchview.cpp index 89dc98a..ee6e972 100644 --- a/src/SearchView.cpp +++ b/src/searchview.cpp @@ -1,4 +1,4 @@ -#include "SearchView.h" +#include "searchview.h" #include "constants.h" #include "fontutils.h" #include "searchparams.h" @@ -15,7 +15,7 @@ #ifdef APP_ACTIVATION #include "activation.h" #endif -#include "MainWindow.h" +#include "mainwindow.h" namespace The { QMap* globalActions(); diff --git a/src/SearchView.h b/src/searchview.h similarity index 87% rename from src/SearchView.h rename to src/searchview.h index b6be275..a62390d 100644 --- a/src/SearchView.h +++ b/src/searchview.h @@ -2,7 +2,7 @@ #define __SEARCHVIEW_H__ #include -#include "View.h" +#include "view.h" class SearchLineEdit; class SearchParams; @@ -17,17 +17,14 @@ public: SearchView(QWidget *parent); void updateRecentKeywords(); void updateRecentChannels(); - void appear(); - void disappear() {} - - QMap metadata() { - QMap metadata; - metadata.insert("title", ""); + QHash metadata() { + QHash metadata; metadata.insert("description", tr("Make yourself comfortable")); return metadata; } public slots: + void appear(); void watch(QString query); void watchChannel(QString channel); void watchKeywords(QString query); diff --git a/src/videoareawidget.h b/src/videoareawidget.h index a34cfbf..8f9db2f 100644 --- a/src/videoareawidget.h +++ b/src/videoareawidget.h @@ -4,7 +4,7 @@ #include #include "video.h" #include "loadingwidget.h" -#include "ListModel.h" +#include "listmodel.h" class VideoAreaWidget : public QWidget { diff --git a/src/view.h b/src/view.h new file mode 100644 index 0000000..0609c38 --- /dev/null +++ b/src/view.h @@ -0,0 +1,13 @@ +#ifndef VIEW_H +#define VIEW_H + +class View { + +public: + virtual QHash metadata() { return QHash(); } + virtual void appear() {} + virtual void disappear() {} + +}; + +#endif // VIEW_H -- 2.39.5