Changeset 8735ea4


Ignore:
Timestamp:
06/19/14 17:48:57 (5 weeks ago)
Author:
Ken Moore <ken@…>
Branches:
master
Children:
f77fbb1
Parents:
dc9ffe6
Message:

Get the lumina-fm slideshow viewer working. The only thing missing right now is scaling down images larger than the window to fit properly.

Location:
lumina/lumina-fm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lumina/lumina-fm/MainUI.cpp

    r55470a5 r8735ea4  
    9999  connect(ui->tool_goToImages, SIGNAL(clicked()), this, SLOT(goToSlideshowPage()) ); 
    100100  connect(ui->actionBackToBrowser, SIGNAL(triggered()), this, SLOT(goToBrowserPage()) ); 
     101         
     102  //Slideshow page 
     103  connect(ui->combo_image_name, SIGNAL(currentIndexChanged(int)), this, SLOT(showNewPicture()) ); 
     104  connect(ui->tool_image_goBegin, SIGNAL(clicked()), this, SLOT(firstPicture()) ); 
     105  connect(ui->tool_image_goEnd, SIGNAL(clicked()), this, SLOT(lastPicture()) ); 
     106  connect(ui->tool_image_goNext, SIGNAL(clicked()), this, SLOT(nextPicture()) ); 
     107  connect(ui->tool_image_goPrev, SIGNAL(clicked()), this, SLOT(prevPicture()) ); 
    101108} 
    102109 
     
    166173  tabBar->setTabData(tabBar->currentIndex(), history); 
    167174  //Now adjust the items as necessary 
     175  QTimer::singleShot(0, this, SLOT(checkForMultimediaFiles())); 
     176  QTimer::singleShot(0, this, SLOT(checkForBackups())); 
     177  QTimer::singleShot(0, this, SLOT(checkForPictures())); 
    168178  ui->actionUpDir->setEnabled(dir!="/"); 
    169179  ui->actionBack->setEnabled(history.length() > 1); 
     
    174184//    PRIVATE SLOTS 
    175185//============== 
     186//General button check functions 
     187void MainUI::checkForMultimediaFiles(){ 
     188  ui->tool_goToPlayer->setVisible(false); 
     189  //Check for multimedia files not implemented yet!      
     190} 
     191 
     192void MainUI::checkForBackups(){ 
     193  ui->tool_goToRestore->setVisible(false); 
     194  //Check for ZFS snapshots not implemented yet! 
     195} 
     196 
     197void MainUI::checkForPictures(){ 
     198  ui->tool_goToImages->setVisible(false); 
     199  //Check for images not implemented yet! 
     200  QDir dir(getCurrentDir()); 
     201  QStringList pics = dir.entryList(QStringList() << "*.png" << "*.jpg", QDir::Files | QDir::NoDotAndDotDot, QDir::Name); 
     202  if(!pics.isEmpty()){ 
     203    ui->combo_image_name->clear(); 
     204    ui->combo_image_name->addItems(pics); 
     205    ui->tool_goToImages->setVisible(true);         
     206  } 
     207         
     208} 
    176209 
    177210//General page switching 
     
    227260  ui->menuExternal_Devices->setEnabled(false); 
    228261  //Now go to the Slideshow player 
    229   ui->stackedWidget->setCurrentWidget(ui->page_image_view);      
     262  showNewPicture(); //update the image viewer first 
     263  ui->stackedWidget->setCurrentWidget(ui->page_image_view); 
    230264} 
    231265 
     
    382416} 
    383417 
     418//Slideshow Functions 
     419void MainUI::showNewPicture(){ 
     420  QString file = getCurrentDir(); 
     421  if(!file.endsWith("/")){ file.append("/"); } 
     422  file.append(ui->combo_image_name->currentText()); 
     423  if(!file.endsWith(".png") && !file.endsWith(".jpg")){ return; } //invalid - no change 
     424  qDebug() << "Show Image:" << file; 
     425  QPixmap pix(file); 
     426  //if(pix.size() > ui->label_image->size()){ pix = pix.scaled(ui->label_image->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); } 
     427  ui->label_image->setPixmap(pix); 
     428  //Now set/load the buttons 
     429  ui->tool_image_goBegin->setEnabled(ui->combo_image_name->currentIndex()>0); 
     430  ui->tool_image_goPrev->setEnabled(ui->combo_image_name->currentIndex()>0); 
     431  ui->tool_image_goEnd->setEnabled(ui->combo_image_name->currentIndex()<(ui->combo_image_name->count()-1)); 
     432  ui->tool_image_goNext->setEnabled(ui->combo_image_name->currentIndex()<(ui->combo_image_name->count()-1)); 
     433  ui->label_image_index->setText( QString::number(ui->combo_image_name->currentIndex()+1)+"/"+QString::number(ui->combo_image_name->count()) ); 
     434} 
     435 
     436void MainUI::firstPicture(){ 
     437  ui->combo_image_name->setCurrentIndex(0); 
     438} 
     439 
     440void MainUI::prevPicture(){ 
     441  ui->combo_image_name->setCurrentIndex( ui->combo_image_name->currentIndex()-1 ); 
     442} 
     443 
     444void MainUI::nextPicture(){ 
     445  ui->combo_image_name->setCurrentIndex( ui->combo_image_name->currentIndex()+1 ); 
     446} 
     447 
     448void MainUI::lastPicture(){ 
     449  ui->combo_image_name->setCurrentIndex( ui->combo_image_name->count()-1 ); 
     450} 
     451 
     452// Context Menu Actions 
    384453void MainUI::OpenItem(){ 
    385454  if(!CItem.isValid()){ return; } 
  • lumina/lumina-fm/MainUI.h

    r55470a5 r8735ea4  
    6868        } 
    6969         
     70        //General button check functions (start in a new thread!) 
     71        void checkForMultimediaFiles(); 
     72        void checkForBackups(); 
     73        void checkForPictures(); 
     74         
    7075        //General page switching 
    7176        void goToMultimediaPage(); 
     
    9196        void OpenContextMenu(const QPoint&); 
    9297 
     98        //Slideshow Functions 
     99        void showNewPicture(); 
     100        void firstPicture(); 
     101        void prevPicture(); 
     102        void nextPicture(); 
     103        void lastPicture(); 
     104         
    93105        //Context Menu Actions 
    94106        void OpenItem(); //run "lumina-open" on it 
  • lumina/lumina-fm/MainUI.ui

    r55470a5 r8735ea4  
    189189           </sizepolicy> 
    190190          </property> 
     191          <property name="styleSheet"> 
     192           <string notr="true">QLabel{ background: grey; }</string> 
     193          </property> 
    191194          <property name="frameShape"> 
    192195           <enum>QFrame::StyledPanel</enum> 
     
    194197          <property name="text"> 
    195198           <string notr="true"/> 
     199          </property> 
     200          <property name="scaledContents"> 
     201           <bool>false</bool> 
    196202          </property> 
    197203          <property name="alignment"> 
     
    462468     <y>0</y> 
    463469     <width>550</width> 
    464      <height>20</height> 
     470     <height>21</height> 
    465471    </rect> 
    466472   </property> 
Note: See TracChangeset for help on using the changeset viewer.