Ticket #1760: 1760-v1.patch
File 1760-v1.patch, 12.7 KB (added by , 18 years ago) |
---|
-
mythgallery/glsingleview.cpp
42 42 #define LOC QString("GLXDialog: ") 43 43 #define LOC_ERR QString("GLXDialog, Error: ") 44 44 45 GLSDialog::GLSDialog(const ThumbList& itemList, int pos, int slideShow, 45 GLSDialog::GLSDialog(const ThumbList& itemList, 46 int pos, int slideShow, int sortOrder, 46 47 MythMainWindow *parent, const char *name) 47 48 : MythDialog(parent, name) 48 49 { 49 50 QBoxLayout *l = new QVBoxLayout(this); 50 m_view = new GLSingleView(itemList, pos, slideShow, this);51 m_view = new GLSingleView(itemList, pos, slideShow, sortOrder, this); 51 52 l->addWidget(m_view); 52 53 53 54 setFocusProxy(m_view); … … 63 64 e->accept(); 64 65 } 65 66 66 GLSingleView::GLSingleView(ThumbList itemList, int pos, int slideShow, 67 QWidget *parent)67 GLSingleView::GLSingleView(ThumbList itemList, int pos, int slideShow, 68 int sortorder, QWidget *parent) 68 69 : QGLWidget(parent) 69 70 { 70 71 m_pos = pos; … … 94 95 { 95 96 if (recurse) 96 97 { 97 GalleryUtil::loadDirectory(m_itemList, item->path, 98 GalleryUtil::loadDirectory(m_itemList, item->path, sortorder, 98 99 recurse, NULL, NULL); 99 100 } 100 101 m_itemList.remove(item); -
mythgallery/galleryutil.h
31 31 32 32 static QString getCaption(const QString &filePath); 33 33 34 static bool loadDirectory(ThumbList& itemList, 35 const QString& dir, bool recurse,34 static bool loadDirectory(ThumbList& itemList, const QString& dir, 35 int sortorder, bool recurse, 36 36 ThumbDict *itemDict, ThumbGenerator* thumbGen); 37 37 38 38 static bool CopyMove(const QFileInfo &src, QFileInfo &dst, bool move) -
mythgallery/glsingleview.h
37 37 { 38 38 public: 39 39 40 GLSDialog(const ThumbList& itemList, int pos, int slideShow, 40 GLSDialog(const ThumbList& itemList, 41 int pos, int slideShow, int sortOrder, 41 42 MythMainWindow *parent, const char *name=0); 42 43 43 44 protected: … … 55 56 56 57 public: 57 58 58 GLSingleView(ThumbList itemList, int pos, int slideShow, QWidget *parent); 59 GLSingleView(ThumbList itemList, int pos, int slideShow, int sordorder, 60 QWidget *parent); 59 61 ~GLSingleView(); 60 62 61 63 void cleanUp(); -
mythgallery/singleview.cpp
35 35 #include "galleryutil.h" 36 36 37 37 SingleView::SingleView(ThumbList itemList, int pos, int slideShow, 38 MythMainWindow *parent, const char *name)38 int sortorder, MythMainWindow *parent, const char *name) 39 39 : MythDialog(parent, name) 40 40 { 41 41 m_itemList = itemList; … … 53 53 ThumbItem* next = m_itemList.next(); 54 54 if (item->isDir) { 55 55 if (recurse) 56 GalleryUtil::loadDirectory(m_itemList, item->path, recurse, NULL, NULL); 56 GalleryUtil::loadDirectory(m_itemList, item->path, sortorder, 57 recurse, NULL, NULL); 57 58 m_itemList.remove(item); 58 59 } 59 60 item = next; -
mythgallery/gallerysettings.cpp
30 30 return gc; 31 31 }; 32 32 33 static HostComboBox *MythGallerySortOrder() 34 { 35 HostComboBox *gc = new HostComboBox("GallerySortOrder"); 36 gc->setLabel(QObject::tr("Sort order when browsing")); 37 gc->addSelection("Name (A-Z alpha)", QString::number(QDir::Name | QDir::DirsFirst | QDir::IgnoreCase)); 38 gc->addSelection("Reverse Name (Z-A alpha)", QString::number(QDir::Name | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed)); 39 gc->addSelection("Mod Time (earliest first)", QString::number(QDir::Time | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed)); 40 gc->addSelection("Reverse Mod Time (most recent first)", QString::number(QDir::Time | QDir::DirsFirst | QDir::IgnoreCase)); 41 gc->setHelpText(QObject::tr("This is the sort order for the displayed " 42 "picture thumbnails.")); 43 return gc; 44 }; 45 33 46 static HostLineEdit *MythGalleryMoviePlayerCmd() 34 47 { 35 48 HostLineEdit *gc = new HostLineEdit("GalleryMoviePlayerCmd"); … … 161 174 162 175 addChild(MythGalleryDir()); 163 176 addChild(MythGalleryThumbnailLocation()); 177 addChild(MythGallerySortOrder()); 164 178 addChild(MythGalleryImportDirs()); 165 179 addChild(MythGalleryMoviePlayerCmd()); 166 180 -
mythgallery/singleview.h
32 32 33 33 public: 34 34 35 SingleView(ThumbList itemList, int pos, int slideShow, 35 SingleView(ThumbList itemList, int pos, int slideShow, int sortorder, 36 36 MythMainWindow *parent, const char *name=0); 37 37 ~SingleView(); 38 38 -
mythgallery/iconview.cpp
91 91 return false; 92 92 } 93 93 94 IconView::IconView(const QString& galleryDir, MythMediaDevice *initialDevice, 95 MythMainWindow* parent, const char* name ) 96 : MythDialog(parent, name) 94 IconView::IconView(const QString &galleryDir, MythMediaDevice *initialDevice, 95 const int sortorder, MythMainWindow *parent, 96 const char *name) 97 : MythDialog(parent, name), 98 m_galleryDir(galleryDir), m_sortorder(sortorder) 97 99 { 98 m_galleryDir = galleryDir;99 100 100 m_inMenu = false; 101 101 m_inSubMenu = false; 102 102 m_itemList.setAutoDelete(true); … … 531 531 532 532 if (QGLFormat::hasOpenGL()) 533 533 { 534 GLSDialog gv(m_itemList, pos, slideShow, 534 GLSDialog gv(m_itemList, pos, 535 slideShow, m_sortorder, 535 536 gContext->GetMainWindow()); 536 537 gv.exec(); 537 538 } … … 546 547 else 547 548 #endif 548 549 { 549 SingleView sv(m_itemList, pos, slideShow, 550 SingleView sv(m_itemList, pos, slideShow, m_sortorder, 550 551 gContext->GetMainWindow()); 551 552 sv.exec(); 552 553 } … … 874 875 m_lastRow = 0; 875 876 m_lastCol = 0; 876 877 877 m_isGallery = GalleryUtil::loadDirectory(m_itemList, dir, false, &m_itemDict, m_thumbGen);; 878 m_isGallery = GalleryUtil::loadDirectory(m_itemList, dir, m_sortorder, 879 false, &m_itemDict, m_thumbGen); 878 880 m_lastRow = QMAX((int)ceilf((float)m_itemList.count()/(float)m_nCols)-1,0); 879 881 m_lastCol = QMAX(m_itemList.count()-m_lastRow*m_nCols-1,0); 880 882 … … 1182 1184 int useOpenGL = gContext->GetNumSetting("SlideshowUseOpenGL"); 1183 1185 if (useOpenGL) { 1184 1186 if (QGLFormat::hasOpenGL()) { 1185 GLSDialog gv(m_itemList, pos, 1, gContext->GetMainWindow()); 1187 GLSDialog gv(m_itemList, pos, 1, m_sortorder, 1188 gContext->GetMainWindow()); 1186 1189 gv.exec(); 1187 1190 } 1188 1191 else { … … 1194 1197 else 1195 1198 #endif 1196 1199 { 1197 SingleView sv(m_itemList, pos, 1, gContext->GetMainWindow()); 1200 SingleView sv(m_itemList, pos, 1, m_sortorder, 1201 gContext->GetMainWindow()); 1198 1202 sv.exec(); 1199 1203 } 1200 1204 } … … 1213 1217 int useOpenGL = gContext->GetNumSetting("SlideshowUseOpenGL"); 1214 1218 if (useOpenGL) { 1215 1219 if (QGLFormat::hasOpenGL()) { 1216 GLSDialog gv(m_itemList, pos, 2, gContext->GetMainWindow()); 1220 GLSDialog gv(m_itemList, pos, 2, m_sortorder, 1221 gContext->GetMainWindow()); 1217 1222 gv.exec(); 1218 1223 } 1219 1224 else { … … 1225 1230 else 1226 1231 #endif 1227 1232 { 1228 SingleView sv(m_itemList, pos, 2, gContext->GetMainWindow()); 1233 SingleView sv(m_itemList, pos, 2, m_sortorder, 1234 gContext->GetMainWindow()); 1229 1235 sv.exec(); 1230 1236 } 1231 1237 } … … 1451 1457 return; 1452 1458 1453 1459 d.setNameFilter(MEDIA_FILENAMES); 1454 d.setSorting( QDir::Name | QDir::DirsFirst | QDir::IgnoreCase);1460 d.setSorting(m_sortorder); 1455 1461 d.setFilter(QDir::Files | QDir::Dirs | QDir::NoSymLinks | QDir::Readable); 1456 1462 d.setMatchAllDirs(true); 1457 1463 const QFileInfoList *list = d.entryInfoList(); -
mythgallery/main.cpp
25 25 void runGallery(void) 26 26 { 27 27 gContext->addCurrentLocation("mythgallery"); 28 int sortorder = gContext->GetNumSetting("GallerySortOrder"); 28 29 QString startdir = gContext->GetSetting("GalleryDir"); 29 30 QDir dir(startdir); 30 31 if (!dir.exists() || !dir.isReadable()) { … … 36 37 } 37 38 else 38 39 { 39 IconView icv(startdir, NULL, gContext->GetMainWindow(), "IconView"); 40 IconView icv(startdir, NULL, sortorder, 41 gContext->GetMainWindow(), "IconView"); 40 42 icv.exec(); 41 43 } 42 44 gContext->removeCurrentLocation(); … … 44 46 45 47 void handleMedia(MythMediaDevice *dev) 46 48 { 49 int sortorder = gContext->GetNumSetting("GallerySortOrder"); 47 50 QString galleryDir = gContext->GetSetting("GalleryDir"); 48 51 QDir dir(galleryDir); 49 52 if (!dir.exists() || !dir.isReadable()) … … 56 59 } 57 60 else 58 61 { 59 IconView icv(galleryDir, dev, gContext->GetMainWindow(), "IconView"); 62 IconView icv(galleryDir, dev, sortorder, 63 gContext->GetMainWindow(), "IconView"); 60 64 icv.exec(); 61 65 } 62 66 } -
mythgallery/iconview.h
65 65 { 66 66 Q_OBJECT 67 67 public: 68 IconView(const QString &galleryDir, MythMediaDevice *initialDevice,69 MythMainWindow* parent, const char*name = 0);68 IconView(const QString &galleryDir, MythMediaDevice *initialDevice, 69 int sortorder, MythMainWindow *parent, const char *name = 0); 70 70 ~IconView(); 71 71 72 72 protected: … … 122 122 QDict<ThumbItem> m_itemDict; 123 123 QStringList m_itemMarked; 124 124 QString m_galleryDir; 125 int m_sortorder; 125 126 126 127 XMLParse *m_theme; 127 128 QRect m_menuRect; -
mythgallery/galleryutil.cpp
137 137 return rotateAngle; 138 138 } 139 139 140 bool GalleryUtil::loadDirectory(ThumbList& itemList, 141 const QString& dir, bool recurse,140 bool GalleryUtil::loadDirectory(ThumbList& itemList, const QString& dir, 141 int sortorder, bool recurse, 142 142 ThumbDict *itemDict, ThumbGenerator* thumbGen) 143 143 { 144 144 QString blah = dir; … … 157 157 thumbGen->getThumbcacheDir(currDir); 158 158 159 159 d.setNameFilter(MEDIA_FILENAMES); 160 d.setSorting( QDir::Name | QDir::DirsFirst | QDir::IgnoreCase);160 d.setSorting(sortorder); 161 161 162 162 d.setMatchAllDirs(true); 163 163 const QFileInfoList *list = d.entryInfoList(); … … 188 188 189 189 if (fi->isDir() && recurse) 190 190 { 191 GalleryUtil::loadDirectory( itemList,192 QDir::cleanDirPath(fi->absFilePath()), true,193 191 GalleryUtil::loadDirectory( 192 itemList, QDir::cleanDirPath(fi->absFilePath()), 193 sortorder, true, itemDict, thumbGen); 194 194 } 195 195 else 196 196 {