Ticket #2204: mythgallery.patch
| File mythgallery.patch, 15.4 KB (added by , 19 years ago) |
|---|
-
mythgallery/mythgallery/glsingleview.cpp
243 243 244 244 bool wasInfo = m_info_show; 245 245 m_info_show = false; 246 bool wasInfoShort = m_info_show_short; 247 m_info_show_short = false; 246 248 247 249 QStringList actions; 248 250 gContext->GetMainWindow()->TranslateKeyPress("Gallery", e, actions); … … 250 252 float scrollX = 0.02f; 251 253 float scrollY = 0.02f; 252 254 255 if( actions.size() == 0 ) { 256 handled = false; 257 m_info_show = wasInfo; 258 m_info_show_short = true; 259 m_slideshow_running = wasRunning; 260 } 261 253 262 for (unsigned int i = 0; i < actions.size() && !handled; i++) 254 263 { 255 264 QString action = actions[i]; … … 257 266 258 267 if (action == "LEFT" || action == "UP") 259 268 { 269 m_info_show = wasInfo; 270 m_slideshow_running = wasRunning; 260 271 DisplayPrev(true, true); 261 272 } 262 273 else if (action == "RIGHT" || action == "DOWN") 263 274 { 275 m_info_show = wasInfo; 276 m_slideshow_running = wasRunning; 264 277 DisplayNext(true, true); 265 278 } 266 279 else if (action == "ZOOMOUT") … … 380 393 item->SetPixmap(NULL); 381 394 DisplayNext(true, true); 382 395 } 396 m_info_show = wasInfo; 397 m_slideshow_running = wasRunning; 383 398 } 384 399 else if (action == "PLAY" || action == "SLIDESHOW" || 385 400 action == "RANDOMSHOW") … … 387 402 m_source_x = 0; 388 403 m_source_y = 0; 389 404 SetZoom(1.0f); 405 m_info_show = wasInfo; 406 m_info_show_short = true; 390 407 m_slideshow_running = !wasRunning; 391 408 } 392 409 else if (action == "INFO") 393 410 { 394 m_info_show = !wasInfo; 411 m_info_show = !wasInfo && !wasInfoShort; 412 m_slideshow_running = wasRunning; 395 413 } 396 414 else 415 { 397 416 handled = false; 417 m_info_show = wasInfo; 418 m_info_show_short = true; 419 m_slideshow_running = wasRunning; 420 } 398 421 } 399 422 423 if (m_slideshow_running || m_info_show_short) 424 { 425 m_slideshow_timer->start(m_slideshow_frame_delay_state, true); 426 } 400 427 if (m_slideshow_running) 401 428 { 402 m_slideshow_timer->start(m_slideshow_frame_delay_state, true);403 429 gContext->DisableScreensaver(); 404 430 } 405 431 432 updateGL(); 406 433 if (handled) 407 434 { 408 updateGL();409 435 e->accept(); 410 436 } 411 437 else { … … 423 449 424 450 m_texItem[m_texCur].MakeQuad(); 425 451 426 if (m_info_show )452 if (m_info_show || m_info_show_short) 427 453 { 428 454 createTexInfo(); 429 455 … … 1150 1176 // timed out after showing current image 1151 1177 // load next image and start effect 1152 1178 1153 if (m_effect_random) 1154 m_effect_method = GetRandomEffect(); 1179 if (m_slideshow_running) 1180 { 1181 if (m_effect_random) 1182 m_effect_method = GetRandomEffect(); 1155 1183 1156 DisplayNext(false, false);1184 DisplayNext(false, false); 1157 1185 1158 wasMovie = m_movieState > 0; 1159 LoadImage(); 1160 isMovie = m_movieState > 0; 1161 // If transitioning to/from a movie, don't do an effect, 1162 // and shorten timeout 1163 if (wasMovie || isMovie) 1164 { 1165 m_slideshow_frame_delay_state = 1; 1186 wasMovie = m_movieState > 0; 1187 LoadImage(); 1188 isMovie = m_movieState > 0; 1189 // If transitioning to/from a movie, don't do an effect, 1190 // and shorten timeout 1191 if (wasMovie || isMovie) 1192 { 1193 m_slideshow_frame_delay_state = 1; 1194 } 1195 else 1196 { 1197 m_slideshow_frame_delay_state = 10; 1198 m_effect_running = true; 1199 m_effect_current_frame = 0; 1200 } 1201 m_effect_frame_time.restart(); 1166 1202 } 1167 else 1168 { 1169 m_slideshow_frame_delay_state = 10; 1170 m_effect_running = true; 1171 m_effect_current_frame = 0; 1172 } 1173 m_effect_frame_time.restart(); 1203 m_info_show_short = false; 1174 1204 } 1175 1205 } 1176 1206 1177 1207 updateGL(); 1178 m_slideshow_timer->start(m_slideshow_frame_delay_state, true); 1208 if (m_slideshow_running) 1209 { 1210 m_slideshow_timer->start(m_slideshow_frame_delay_state, true); 1179 1211 1180 // If transitioning to/from a movie, no effect is running so 1181 // next timeout should trigger proper immage delay. 1182 if (wasMovie || isMovie) 1183 { 1184 m_slideshow_frame_delay_state = -1; 1212 // If transitioning to/from a movie, no effect is running so 1213 // next timeout should trigger proper immage delay. 1214 if (wasMovie || isMovie) 1215 { 1216 m_slideshow_frame_delay_state = -1; 1217 } 1185 1218 } 1186 1219 } 1187 1220 … … 1190 1223 if (m_texInfo) 1191 1224 glDeleteTextures(1, &m_texInfo); 1192 1225 1193 QString info = m_texItem[m_texCur].GetDescription( );1226 QString info = m_texItem[m_texCur].GetDescription(GetDescriptionStatus()); 1194 1227 if (info.isEmpty()) 1195 1228 return; 1196 1229 -
mythgallery/mythgallery/thumbview.cpp
90 90 return GalleryUtil::GetNaturalRotation(m_path); 91 91 } 92 92 93 QString ThumbItem::GetDescription(const QS ize &sz, int angle) const93 QString ThumbItem::GetDescription(const QString status, const QSize &sz, int angle) const 94 94 { 95 95 QFileInfo fi(GetPath()); 96 96 97 97 QString info = GetName(); 98 info += status; 98 99 info += "\n\n" + QObject::tr("Folder: ") + fi.dir().dirName(); 99 100 info += "\n" + QObject::tr("Created: ") + fi.created().toString(); 100 101 info += "\n" + QObject::tr("Modified: ") + -
mythgallery/mythgallery/singleview.cpp
239 239 p.end(); 240 240 } 241 241 242 if (m_info_show )242 if (m_info_show || m_info_show_short) 243 243 { 244 244 if (!m_info_pixmap) 245 245 { … … 255 255 ThumbItem *item = m_itemList.at(m_pos); 256 256 QString info = QString::null; 257 257 if (item) 258 info = item->GetDescription( m_image.size(), m_angle);258 info = item->GetDescription(GetDescriptionStatus(), m_image.size(), m_angle); 259 259 260 260 if (!info.isEmpty()) 261 261 { … … 292 292 293 293 bool wasInfo = m_info_show; 294 294 m_info_show = false; 295 bool wasInfoShort = m_info_show_short; 296 m_info_show_short = false; 295 297 296 298 QStringList actions; 297 299 gContext->GetMainWindow()->TranslateKeyPress("Gallery", e, actions); … … 299 301 int scrollX = (int)(10*wmult); 300 302 int scrollY = (int)(10*hmult); 301 303 304 if( actions.size() == 0 ) { 305 handled = false; 306 m_info_show = wasInfo; 307 m_info_show_short = true; 308 m_slideshow_running = wasRunning; 309 } 310 302 311 for (unsigned int i = 0; i < actions.size() && !handled; i++) 303 312 { 304 313 QString action = actions[i]; … … 306 315 307 316 if (action == "LEFT" || action == "UP") 308 317 { 318 m_info_show = wasInfo; 319 m_slideshow_running = wasRunning; 309 320 DisplayPrev(true, true); 310 321 } 311 322 else if (action == "RIGHT" || action == "DOWN") 312 323 { 324 m_info_show = wasInfo; 325 m_slideshow_running = wasRunning; 313 326 DisplayNext(true, true); 314 327 } 315 328 else if (action == "ZOOMOUT") … … 431 444 item->SetPixmap(NULL); 432 445 DisplayNext(true, true); 433 446 } 447 m_info_show = wasInfo; 448 m_slideshow_running = wasRunning; 434 449 } 435 450 else if (action == "PLAY" || action == "SLIDESHOW" || 436 451 action == "RANDOMSHOW") … … 438 453 m_source_loc = QPoint(0, 0); 439 454 m_zoom = 1.0f; 440 455 m_angle = 0; 456 m_info_show = wasInfo; 457 m_info_show_short = true; 441 458 m_slideshow_running = !wasRunning; 442 459 } 443 460 else if (action == "INFO") 444 461 { 445 m_info_show = !wasInfo; 462 m_info_show = !wasInfo && !wasInfoShort; 463 m_slideshow_running = wasRunning; 446 464 } 447 465 else 466 { 448 467 handled = false; 468 m_info_show = wasInfo; 469 m_info_show_short = true; 470 m_slideshow_running = wasRunning; 471 } 449 472 } 450 473 474 if (m_slideshow_running || m_info_show_short) 475 { 476 m_slideshow_timer->start(m_slideshow_frame_delay_state, true); 477 } 451 478 if (m_slideshow_running) 452 479 { 453 m_slideshow_timer->start(m_slideshow_frame_delay_state, true);454 480 gContext->DisableScreensaver(); 455 481 } 456 482 483 update(); 457 484 if (handled) 458 485 { 459 update();460 486 } 461 487 else 462 488 { … … 1315 1341 { 1316 1342 // timed out after showing current image 1317 1343 // load next image and start effect 1318 if (m_effect_random) 1319 m_effect_method = GetRandomEffect(); 1344 if (m_slideshow_running) 1345 { 1346 if (m_effect_random) 1347 m_effect_method = GetRandomEffect(); 1320 1348 1321 DisplayNext(false, false);1349 DisplayNext(false, false); 1322 1350 1323 wasMovie = m_movieState > 0; 1324 LoadImage(); 1325 isMovie = m_movieState > 0; 1326 // If transitioning to/from a movie, don't do an effect, 1327 // and shorten timeout 1328 if (wasMovie || isMovie) 1329 { 1330 m_slideshow_frame_delay_state = 1; 1331 } 1332 else 1333 { 1334 CreateEffectPixmap(); 1335 m_effect_running = true; 1336 m_slideshow_frame_delay_state = 10; 1337 m_effect_current_frame = 0; 1338 } 1339 } 1351 wasMovie = m_movieState > 0; 1352 LoadImage(); 1353 isMovie = m_movieState > 0; 1354 // If transitioning to/from a movie, don't do an effect, 1355 // and shorten timeout 1356 if (wasMovie || isMovie) 1357 { 1358 m_slideshow_frame_delay_state = 1; 1359 } 1360 else 1361 { 1362 CreateEffectPixmap(); 1363 m_effect_running = true; 1364 m_slideshow_frame_delay_state = 10; 1365 m_effect_current_frame = 0; 1366 } 1367 } 1368 m_info_show_short = false; 1369 } 1340 1370 } 1341 1371 1342 1372 update(); 1343 m_slideshow_timer->start(m_slideshow_frame_delay_state, true); 1373 if (m_slideshow_running) 1374 { 1375 m_slideshow_timer->start(m_slideshow_frame_delay_state, true); 1344 1376 1345 // If transitioning to/from a movie, no effect is running so 1346 // next timeout should trigger proper immage delay. 1347 if (wasMovie || isMovie) 1348 { 1349 m_slideshow_frame_delay_state = -1; 1377 // If transitioning to/from a movie, no effect is running so 1378 // next timeout should trigger proper immage delay. 1379 if (wasMovie || isMovie) 1380 { 1381 m_slideshow_frame_delay_state = -1; 1382 } 1350 1383 } 1351 1384 } 1352 1385 -
mythgallery/mythgallery/imageview.cpp
41 41 42 42 // Info variables 43 43 m_info_show(false), 44 m_info_show_short(false), 44 45 45 46 // Common slideshow variables 46 47 m_slideshow_running(false), … … 108 109 if (slideShow > 1) 109 110 { 110 111 m_slideshow_sequence = new SequenceShuffle(m_itemList.count()); 112 m_slideshow_mode = "Random Slideshow"; 111 113 m_pos = 0; 112 114 } 113 115 else 114 116 { 115 117 m_slideshow_sequence = new SequenceInc(m_itemList.count()); 118 m_slideshow_mode = "Slideshow"; 116 119 } 117 120 118 121 m_pos = m_slideshow_sequence->index(m_pos); … … 163 166 164 167 lcd->switchToGeneric(&textItems); 165 168 } 169 170 const QString ImageView::GetDescriptionStatus(void) 171 { 172 QString info; 173 174 if( m_slideshow_running ) { 175 info = " [" + QObject::tr(m_slideshow_mode) + "]"; 176 } else { 177 info = " [" + QObject::tr("Paused") + "]"; 178 } 179 180 return info; 181 } -
mythgallery/mythgallery/thumbview.h
49 49 QString GetCaption(void) const { return m_caption; } 50 50 QString GetPath(void) const { return m_path; } 51 51 bool IsDir(void) const { return m_isDir; } 52 QString GetDescription(const QS ize &sz, int angle) const;52 QString GetDescription(const QString status, const QSize &sz, int angle) const; 53 53 54 54 // non-const gets 55 55 QPixmap *GetPixmap(void) { return m_pixmap; } -
mythgallery/mythgallery/imageview.h
58 58 virtual void RunEffect(const QString &effect) = 0; 59 59 60 60 void UpdateLCD(const ThumbItem *item); 61 const QString GetDescriptionStatus(void); 61 62 protected: 62 63 QSize m_screenSize; 63 64 float m_wmult; … … 68 69 float m_zoom; 69 70 70 71 bool m_info_show; 72 bool m_info_show_short; 71 73 72 74 // Common slideshow variables 73 75 bool m_slideshow_running; … … 77 79 int m_slideshow_frame_delay; 78 80 int m_slideshow_frame_delay_state; 79 81 QTimer *m_slideshow_timer; 82 const char *m_slideshow_mode; 80 83 81 84 // Common effect state variables 82 85 bool m_effect_running; -
mythgallery/mythgallery/gltexture.cpp
104 104 } 105 105 } 106 106 107 QString GLTexture::GetDescription( void) const107 QString GLTexture::GetDescription(const QString status) const 108 108 { 109 109 if (item) 110 return item->GetDescription( GetSize(), angle);110 return item->GetDescription(status, GetSize(), angle); 111 111 112 112 return QString::null; 113 113 } -
mythgallery/mythgallery/gltexture.h
59 59 float GetTextureX(void) const { return cx; } 60 60 float GetTextureY(void) const { return cy; } 61 61 int GetAngle(void) const { return angle; } 62 QString GetDescription( void) const;62 QString GetDescription(const QString status) const; 63 63 64 64 private: 65 65 GLuint tex;
