diff options
author | Ken Moore <ken@pcbsd.org> | 2015-03-12 20:50:43 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-03-12 20:50:43 -0400 |
commit | 0864314ca2083ad584323997e1eabc570125d2a1 (patch) | |
tree | af2c529549b5ee78ea49946ff5add5c4eb962d18 | |
parent | Change the icon used for the "favorite files" button. Now it matches the User... (diff) | |
download | lumina-0864314ca2083ad584323997e1eabc570125d2a1.tar.gz lumina-0864314ca2083ad584323997e1eabc570125d2a1.tar.bz2 lumina-0864314ca2083ad584323997e1eabc570125d2a1.zip |
Add Checksum support for FreeBSD, and tie it into lumina-fm.
-rw-r--r-- | libLumina/LuminaOS-Debian.cpp | 5 | ||||
-rw-r--r-- | libLumina/LuminaOS-DragonFly.cpp | 5 | ||||
-rw-r--r-- | libLumina/LuminaOS-FreeBSD.cpp | 12 | ||||
-rw-r--r-- | libLumina/LuminaOS-Linux.cpp | 4 | ||||
-rw-r--r-- | libLumina/LuminaOS-OpenBSD.cpp | 4 | ||||
-rw-r--r-- | libLumina/LuminaOS-kFreeBSD.cpp | 6 | ||||
-rw-r--r-- | libLumina/LuminaOS-template.cpp | 5 | ||||
-rw-r--r-- | libLumina/LuminaOS.h | 3 | ||||
-rw-r--r-- | lumina-fm/BackgroundWorker.cpp | 2 | ||||
-rw-r--r-- | lumina-fm/MainUI.cpp | 22 | ||||
-rw-r--r-- | lumina-fm/MainUI.h | 2 |
11 files changed, 65 insertions, 5 deletions
diff --git a/libLumina/LuminaOS-Debian.cpp b/libLumina/LuminaOS-Debian.cpp index 8228d7c4..4f2032fa 100644 --- a/libLumina/LuminaOS-Debian.cpp +++ b/libLumina/LuminaOS-Debian.cpp @@ -193,4 +193,9 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining return 0; //not implemented yet for Linux } +//File Checksums +QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file + return QStringList(); +} + #endif diff --git a/libLumina/LuminaOS-DragonFly.cpp b/libLumina/LuminaOS-DragonFly.cpp index dd9320fc..35bff04c 100644 --- a/libLumina/LuminaOS-DragonFly.cpp +++ b/libLumina/LuminaOS-DragonFly.cpp @@ -171,4 +171,9 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining return LUtils::getCmdOutput("apm -t").join("").toInt(); } +//File Checksums +QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file + return QStringList(); +} + #endif diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp index c58d2397..269bed52 100644 --- a/libLumina/LuminaOS-FreeBSD.cpp +++ b/libLumina/LuminaOS-FreeBSD.cpp @@ -183,4 +183,16 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining return LUtils::getCmdOutput("apm -t").join("").toInt(); } +//File Checksums +QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file + QStringList info = LUtils::getCmdOutput("md5 \""+filepaths.join("\" \"")+"\""); + for(int i=0; i<info.length(); i++){ + if( !info[i].contains(" = ") ){ info.removeAt(i); i--; } + else{ + //Strip out the extra information + info[i] = info[i].section(" = ",1,1); + } + } + return info; +} #endif diff --git a/libLumina/LuminaOS-Linux.cpp b/libLumina/LuminaOS-Linux.cpp index f0f427f4..7587a29b 100644 --- a/libLumina/LuminaOS-Linux.cpp +++ b/libLumina/LuminaOS-Linux.cpp @@ -190,4 +190,8 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining return 0; //not implemented yet for Linux } +//File Checksums +QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file + return QStringList(); +} #endif diff --git a/libLumina/LuminaOS-OpenBSD.cpp b/libLumina/LuminaOS-OpenBSD.cpp index 2c86995a..7cf6c571 100644 --- a/libLumina/LuminaOS-OpenBSD.cpp +++ b/libLumina/LuminaOS-OpenBSD.cpp @@ -190,4 +190,8 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining return (min * 60); } +//File Checksums +QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file + return QStringList(); +} #endif diff --git a/libLumina/LuminaOS-kFreeBSD.cpp b/libLumina/LuminaOS-kFreeBSD.cpp index ab9f9827..16c8e6eb 100644 --- a/libLumina/LuminaOS-kFreeBSD.cpp +++ b/libLumina/LuminaOS-kFreeBSD.cpp @@ -153,6 +153,10 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining return 0; //not implemented yet for Linux } +//File Checksums +QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file + return QStringList(); +} + #endif #endif - diff --git a/libLumina/LuminaOS-template.cpp b/libLumina/LuminaOS-template.cpp index d481984f..c06b8b11 100644 --- a/libLumina/LuminaOS-template.cpp +++ b/libLumina/LuminaOS-template.cpp @@ -101,4 +101,9 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining return 0; //not implemented yet } +//File Checksums +QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file + return QStringList(); +} + #endif diff --git a/libLumina/LuminaOS.h b/libLumina/LuminaOS.h index e0eb2895..92a7dc7e 100644 --- a/libLumina/LuminaOS.h +++ b/libLumina/LuminaOS.h @@ -80,6 +80,9 @@ public: static bool batteryIsCharging(); //Battery Time Remaining static int batterySecondsLeft(); //Returns: estimated number of seconds remaining + + //Get the checksum for a file + static QStringList Checksums(QStringList filepaths); //Return: checksum of each input file (same order) }; #endif diff --git a/lumina-fm/BackgroundWorker.cpp b/lumina-fm/BackgroundWorker.cpp index cdb0644d..1438f71e 100644 --- a/lumina-fm/BackgroundWorker.cpp +++ b/lumina-fm/BackgroundWorker.cpp @@ -83,6 +83,6 @@ void BackgroundWorker::startDirChecks(QString path){ snapDirs[i] = dir.absolutePath()+"/"+snapDirs[i].section("::::",1,50)+"/"+reldir; } if(!snapDirs.isEmpty()){ emit SnapshotsAvailable(baseSnapDir, snapDirs); } - qDebug() << "Found snapshots:" << snapDirs; + qDebug() << "Found snapshots"; } }
\ No newline at end of file diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index c9b651fa..df5c898a 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -938,6 +938,7 @@ void MainUI::OpenContextMenu(const QPoint &pt){ contextMenu->addAction(LXDG::findIcon("run-build-configure",""), tr("Open With..."), this, SLOT(OpenItemWith()) ); } contextMenu->addAction(LXDG::findIcon("edit-rename",""), tr("Rename"), this, SLOT(RenameItem()) )->setEnabled(info.isWritable()); + contextMenu->addAction(LXDG::findIcon("document-encrypted",""), tr("View Checksums"), this, SLOT(ChecksumItems()) ); contextMenu->addSeparator(); } bool hasSelection = !getSelectedItems().isEmpty(); @@ -1463,8 +1464,25 @@ void MainUI::PasteItems(){ QApplication::clipboard()->setMimeData(dat); } } - ItemSelectionChanged(); - + ItemSelectionChanged(); +} + +void MainUI::ChecksumItems(){ + if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; } + QFileInfoList sel = getSelectedItems(); + if(sel.isEmpty()){ return; } + QStringList info, files; + for(int i=0; i<sel.length(); i++){ + files << sel[i].absoluteFilePath(); + } + qDebug() << "Run Checksums:" << files; + info = LOS::Checksums(files); + qDebug() << " - Info:" << info; + if(info.isEmpty() || (info.length() != files.length()) ){ return; } + for(int i=0; i<info.length(); i++){ + info[i] = QString("%2\t(%1)").arg(files[i].section("/",-1), info[i]); + } + QMessageBox::information(this, tr("File Checksums"), info.join("\n") ); } void MainUI::resizeEvent(QResizeEvent *event){ diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h index 40ef25ff..97cadf86 100644 --- a/lumina-fm/MainUI.h +++ b/lumina-fm/MainUI.h @@ -89,7 +89,6 @@ private: //Phonon Widgets for the multimedia player QMediaPlayer *mediaObj; QVideoWidget *videoDisplay; - //Phonon::AudioOutput *audioOut; QSlider *playerSlider; QString playerTTime; //total time - to prevent recalculation every tick @@ -219,6 +218,7 @@ private slots: void CutItems(); void CopyItems(); void PasteItems(); + void ChecksumItems(); signals: void DirChanged(QString path); |