]> git.sur5r.net Git - minitube/blobdiff - src/playlistmodel.cpp
Imported Upstream version 2.5.1
[minitube] / src / playlistmodel.cpp
index eb8a2ddb06ffc808244ee45887bb8452894ebdcc..63cd6a3ff675d2d04c087f8ef0c9cd8976e4bf89 100644 (file)
@@ -61,8 +61,6 @@ QVariant PlaylistModel::data(const QModelIndex &index, int role) const {
     if (row == videos.size()) {
         
         QPalette palette;
-        QFont boldFont;
-        boldFont.setBold(true);
         
         switch (role) {
         case ItemTypeRole:
@@ -85,8 +83,6 @@ QVariant PlaylistModel::data(const QModelIndex &index, int role) const {
                 return palette.color(QPalette::ToolTipBase);
             else
                 return QVariant();
-        case Qt::FontRole:
-            return boldFont;
         default:
             return QVariant();
         }
@@ -111,8 +107,10 @@ QVariant PlaylistModel::data(const QModelIndex &index, int role) const {
         return authorHovered;
     case AuthorPressedRole:
         return authorPressed;
+        /*
     case Qt::StatusTipRole:
         return video->description();
+        */
     }
     
     return QVariant();
@@ -218,7 +216,6 @@ void PlaylistModel::abortSearch() {
 }
 
 void PlaylistModel::searchFinished(int total) {
-    qDebug() << __PRETTY_FUNCTION__ << total;
     searching = false;
     canSearchMore = videoSource->hasMoreVideos();
 
@@ -232,7 +229,7 @@ void PlaylistModel::searchFinished(int total) {
         handleFirstVideo(videos.first());
 }
 
-void PlaylistModel::searchError(QString message) {
+void PlaylistModel::searchError(const QString &message) {
     errorMessage = message;
     // update the message item
     emit dataChanged( createIndex( maxItems, 0 ), createIndex( maxItems, columnCount() - 1 ) );
@@ -272,7 +269,7 @@ void PlaylistModel::handleFirstVideo(Video *video) {
 
         static const int maxRecentElements = 10;
 
-        YTSearch *search = dynamic_cast<YTSearch *>(videoSource);
+        YTSearch *search = qobject_cast<YTSearch *>(videoSource);
         SearchParams *searchParams = search->getSearchParams();
 
         // save keyword
@@ -340,7 +337,7 @@ bool PlaylistModel::removeRows(int position, int rows, const QModelIndex & /*par
 void PlaylistModel::removeIndexes(QModelIndexList &indexes) {
     QList<Video*> originalList(videos);
     QList<Video*> delitems;
-    foreach (QModelIndex index, indexes) {
+    foreach (const QModelIndex &index, indexes) {
         if (index.row() >= originalList.size()) continue;
         Video* video = originalList.at(index.row());
         int idx = videos.indexOf(video);
@@ -416,7 +413,7 @@ bool PlaylistModel::dropMimeData(const QMimeData *data,
     else
         beginRow = rowCount(QModelIndex());
 
-    const VideoMimeData* videoMimeData = dynamic_cast<const VideoMimeData*>( data );
+    const VideoMimeData* videoMimeData = qobject_cast<const VideoMimeData*>( data );
     if(!videoMimeData ) return false;
 
     QList<Video*> droppedVideos = videoMimeData->videos();
@@ -464,7 +461,7 @@ QModelIndex PlaylistModel::indexForVideo(Video* video) {
 void PlaylistModel::move(QModelIndexList &indexes, bool up) {
     QList<Video*> movedVideos;
 
-    foreach (QModelIndex index, indexes) {
+    foreach (const QModelIndex &index, indexes) {
         int row = index.row();
         if (row >= videos.size()) continue;
         // qDebug() << "index row" << row;