MCPcopy Create free account
hub / github.com/Martchus/syncthingtray / SyncthingFileModel

Method SyncthingFileModel

syncthingmodel/syncthingfilemodel.cpp:77–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75/// \endcond
76
77SyncthingFileModel::SyncthingFileModel(SyncthingConnection &connection, const SyncthingDir &dir, QObject *parent)
78 : SyncthingModel(connection, parent)
79 , m_connection(connection)
80 , m_dirId(dir.id)
81 , m_root(std::make_unique<SyncthingItem>())
82 , m_columns(4)
83 , m_selectionMode(false)
84 , m_hasIgnorePatterns(false)
85 , m_isIgnoringAllByDefault(false)
86 , m_recursiveSelectionEnabled(false)
87{
88 connect(this, &SyncthingFileModel::selectionModeEnabledChanged, this, &SyncthingFileModel::selectionActionsChanged);
89 connect(this, &SyncthingFileModel::hasStagedChangesChanged, this, &SyncthingFileModel::selectionActionsChanged);
90 if (m_connection.isLocal()) {
91 m_root->existsLocally = true;
92 m_localPath = Data::substituteTilde(dir.pathWithoutTrailingSlash().toString(), m_connection.tilde(), m_connection.pathSeparator());
93 m_columns += 1;
94 connect(&m_localItemLookup, &QFutureWatcherBase::finished, this, &SyncthingFileModel::handleLocalLookupFinished);
95 }
96 m_pathSeparator = m_connection.pathSeparator().size() == 1 ? m_connection.pathSeparator().front() : QDir::separator();
97 m_ignoreAllByDefaultPattern = m_pathSeparator + QStringLiteral("**");
98 m_root->name = dir.displayName();
99 m_root->existsInDb = true;
100 m_root->modificationTime = dir.lastFileTime;
101 m_root->size = dir.globalStats.bytes;
102 m_root->type = SyncthingItemType::Directory;
103 m_root->path = QStringLiteral(""); // assign an empty QString that is not null
104 m_fetchQueue.append(m_root->path);
105 queryIgnores();
106 processFetchQueue();
107}
108
109SyncthingFileModel::~SyncthingFileModel()
110{

Callers

nothing calls this directly

Calls 6

substituteTildeFunction · 0.85
isLocalMethod · 0.80
toStringMethod · 0.80
displayNameMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected