From 566a86a71d4f76fcd4d1db604aa4e38712bdea7a Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 11 Oct 2016 08:33:33 -0400 Subject: Fix a bug in LFileInfo, and update lumina-fileinfo to show the size of the image (if an image file is being viewed) --- src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp') 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(){ -- cgit