Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <QImageReader>
#include <QtNetwork/QHostInfo>
#include "global-settings.h"
#include "file-watcher.h"

using namespace Peony;

Expand All @@ -43,6 +44,9 @@ DetailsPropertiesPage::DetailsPropertiesPage(const QString &uri, QWidget *parent
{
m_uri = uri;

m_watcher = std::make_shared<FileWatcher>(m_uri);
m_watcher->startMonitor();

m_layout = new QVBoxLayout(this);
m_layout->setContentsMargins(0,10,0,0);
m_tableWidget = new QTableWidget(this);
Expand Down Expand Up @@ -239,6 +243,10 @@ void DetailsPropertiesPage::initDetailsPropertiesPage()
m_tableWidget->hideRow(m_tableWidget->rowCount() - 1);
this->updateFileInfo(m_uri);

connect(m_watcher.get(), &FileWatcher::locationChanged, [=](const QString&, const QString &uri) {
this->updateFileInfo(m_uri);
});

}

DetailsPropertiesPage::~DetailsPropertiesPage()
Expand Down Expand Up @@ -291,7 +299,6 @@ void DetailsPropertiesPage::updateFileInfo(const QString &uri)
nullptr,
nullptr);
g_object_unref(file);

quint64 timeNum2 = g_file_info_get_attribute_uint64(info,"time::modified");
QDateTime date2 = QDateTime::fromMSecsSinceEpoch(timeNum2*1000);
QString time2 = date2.toString(m_systemTimeFormat);
Expand Down
3 changes: 3 additions & 0 deletions libpeony-qt/controls/property-page/details-properties-page.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

namespace Peony {

class FileWatcher;

class DetailsPropertiesPage : public PropertiesWindowTabIface
{
Q_OBJECT
Expand Down Expand Up @@ -63,6 +65,7 @@ class DetailsPropertiesPage : public PropertiesWindowTabIface
private:
QString m_uri = nullptr;
std::shared_ptr<FileInfo> m_fileInfo = nullptr;
std::shared_ptr<FileWatcher> m_watcher;

QString m_systemTimeFormat = nullptr;
QVBoxLayout *m_layout = nullptr;
Expand Down