rodlie / qtfm

Qt File Manager
https://qtfm.eu
GNU General Public License v2.0
156 stars 43 forks source link

Add mounted volumes #149

Open sonichy opened 5 years ago

sonichy commented 5 years ago

1.Add mounted volumes - HomePage (https://github.com/sonichy/HTYFileManager)

QStorageInfo storage("/");
QString mountPath = storage.rootPath();
foreach (const QStorageInfo &storage, QStorageInfo::mountedVolumes()) {
    if (storage.isValid() && storage.isReady()) {
        QString name = storage.name();
        QString mountPath = storage.rootPath();
        QListWidgetItem *LWI = new QListWidgetItem(QIcon::fromTheme("drive-harddisk"), name);
        LWI->setData(LOCATION_OF_REAL_PATH, mountPath);
        ui->listWidget_nav->insertItem(ui->listWidget_nav->count(), LWI);
        LWI = new QListWidgetItem(QIcon::fromTheme("drive-harddisk"), name + "\n" + BS(storage.bytesFree()) + " / " + BS(storage.bytesTotal()));
        LWI->setData(LOCATION_OF_REAL_PATH, mountPath);
        ui->listWidget_partition->insertItem(ui->listWidget_partition->count(), LWI);
    }
}

alt 2.Use qSetMessagePattern("[ %{file}: %{line} ] %{message}"); to show line number when qDebug(). 3.I want to ask: FileManager how to realize drag drop to other application to open file