diff options
author | Ken Moore <ken@ixsystems.com> | 2016-10-11 08:33:33 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-10-11 08:33:33 -0400 |
commit | 566a86a71d4f76fcd4d1db604aa4e38712bdea7a (patch) | |
tree | 5eb3cfff1735907195b2a3661e70723a40a1bcd6 /src-qt5 | |
parent | Move a couple "delete" calls to "deleteLater()" within the desktop. (diff) | |
download | lumina-566a86a71d4f76fcd4d1db604aa4e38712bdea7a.tar.gz lumina-566a86a71d4f76fcd4d1db604aa4e38712bdea7a.tar.bz2 lumina-566a86a71d4f76fcd4d1db604aa4e38712bdea7a.zip |
Fix a bug in LFileInfo, and update lumina-fileinfo to show the size of the image (if an image file is being viewed)
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.cpp | 1 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp | 17 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index dbb70e43..8ae77ea6 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -568,6 +568,7 @@ QString LFileInfo::iconfile(){ // -- Check if this is an XDG desktop file bool LFileInfo::isDesktopFile(){ + if(desk==0){ return false; } return (!desk->filePath.isEmpty()); } diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp index dfa1ec36..8a16f03f 100644 --- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp @@ -41,8 +41,8 @@ void MainUI::LoadFile(QString path, QString type){ if(INFO->exists()){ canwrite = INFO->isWritable(); } else if(!INFO->filePath().isEmpty()){ //See if the containing directory can be written - QFileInfo chk(INFO->absolutePath()); - canwrite = (chk.isDir() && chk.isWritable()); + //QFileInfo chk(INFO->absolutePath()); + canwrite = (INFO->isDir() && INFO->isWritable()); }else{ canwrite = true; //no associated file yet } @@ -82,21 +82,29 @@ void MainUI::LoadFile(QString path, QString type){ ui->label_file_type->setText(ftype); //Now load the icon for the file if(INFO->isImage()){ - ui->label_file_icon->setPixmap( QPixmap(INFO->absoluteFilePath()).scaledToHeight(64) ); + //qDebug() << "Set Image:"; + QPixmap pix(INFO->absoluteFilePath()); + ui->label_file_icon->setPixmap( pix.scaledToHeight(64) ); + ui->label_file_size->setText( ui->label_file_size->text()+" ("+QString::number(pix.width())+" x "+QString::number(pix.height())+" px)" ); + //qDebug() << " - done with image"; }else{ ui->label_file_icon->setPixmap( LXDG::findIcon( INFO->iconfile(), "unknown").pixmap(QSize(64,64)) ); } //Now verify the tab is available in the widget + //qDebug() << "Check tab widget"; if(ui->tabWidget->indexOf(ui->tab_file)<0){ + //qDebug() << "Add File Info Tab"; ui->tabWidget->addTab(ui->tab_file, tr("File Information")); } + //qDebug() << "Done with Tab Check"; }else{ if(ui->tabWidget->indexOf(ui->tab_file)>=0){ ui->tabWidget->removeTab( ui->tabWidget->indexOf(ui->tab_file) ); } } //Now load the special XDG desktop info - qDebug() << INFO->isDesktopFile() << type; + qDebug() << "Check XDG Info:" << type; + //qDebug() << INFO->isDesktopFile() << type; if(INFO->isDesktopFile() || !type.isEmpty()){ if(INFO->XDG()->type == XDGDesktop::APP){ @@ -142,6 +150,7 @@ void MainUI::LoadFile(QString path, QString type){ //Setup the tab if(type.isEmpty()){ ui->tabWidget->setCurrentIndex(0); } else if(ui->tabWidget->count()>1){ ui->tabWidget->setCurrentIndex(1); } + qDebug() << "Done Loading File"; } void MainUI::UpdateIcons(){ |