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
1 change: 1 addition & 0 deletions src/common/syncjournaldb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ qint64 SyncJournalDb::keyValueStoreGetInt(const QString &key, qint64 defaultValu

void SyncJournalDb::keyValueStoreDelete(const QString &key)
{
QMutexLocker locker(&_mutex);
const auto query = _queryManager.get(PreparedSqlQueryManager::DeleteKeyValueStoreQuery, QByteArrayLiteral("DELETE FROM key_value_store WHERE key=?1;"), _db);
if (!query) {
qCWarning(lcDb) << "database error:" << query->error();
Expand Down
2 changes: 0 additions & 2 deletions src/gui/tray/CurrentAccountHeaderButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ Button {

Layout.leftMargin: Style.trayHorizontalMargin
verticalAlignment: Qt.AlignCenter
cache: false
source: (UserModel.currentUser && UserModel.currentUser.avatar !== "") ? UserModel.currentUser.avatar : "image://avatars/fallbackWhite"
Layout.preferredHeight: Style.accountAvatarSize
Layout.preferredWidth: Style.accountAvatarSize
Expand Down Expand Up @@ -266,7 +265,6 @@ Button {
&& UserModel.currentUser.status !== NC.userStatus.Invisible
&& UserModel.currentUser.status !== NC.userStatus.Offline
source: UserModel.currentUser ? UserModel.currentUser.statusIcon : ""
cache: false
anchors.centerIn: currentAccountStatusIndicatorBackground
sourceSize.width: Style.accountAvatarStateIndicatorSize
sourceSize.height: Style.accountAvatarStateIndicatorSize
Expand Down
4 changes: 4 additions & 0 deletions src/gui/tray/UnifiedSearchResultItemSkeleton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ RowLayout {

property color baseGradientColor: palette.light
property int animationRectangleWidth: Style.trayWindowWidth
property real sharedAnimationX: Number.NaN

Item {
property int whiteSpace: (Style.trayListItemIconSize - unifiedSearchResultSkeletonItemDetails.iconWidth)
Expand All @@ -67,6 +68,7 @@ RowLayout {
sourceComponent: UnifiedSearchResultItemSkeletonGradientRectangle {
width: unifiedSearchResultSkeletonItemDetails.animationRectangleWidth
height: parent.height
sharedAnimationX: unifiedSearchResultSkeletonItemDetails.sharedAnimationX
}
}
}
Expand Down Expand Up @@ -110,6 +112,7 @@ RowLayout {
sourceComponent: UnifiedSearchResultItemSkeletonGradientRectangle {
width: unifiedSearchResultSkeletonItemDetails.animationRectangleWidth
height: parent.height
sharedAnimationX: unifiedSearchResultSkeletonItemDetails.sharedAnimationX
}
}
}
Expand Down Expand Up @@ -146,6 +149,7 @@ RowLayout {
sourceComponent: UnifiedSearchResultItemSkeletonGradientRectangle {
width: unifiedSearchResultSkeletonItemDetails.animationRectangleWidth
height: parent.height
sharedAnimationX: unifiedSearchResultSkeletonItemDetails.sharedAnimationX
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/gui/tray/UnifiedSearchResultItemSkeletonContainer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ ColumnLayout {

property int animationRectangleWidth: Style.trayWindowWidth

// Single shared animation driver for all child skeleton items.
property real sharedAnimationX: -animationRectangleWidth

NumberAnimation on sharedAnimationX {
from: -unifiedSearchResultsListViewSkeletonColumn.animationRectangleWidth
to: unifiedSearchResultsListViewSkeletonColumn.animationRectangleWidth
duration: 1000
loops: Animation.Infinite
running: true
}

Item {
id: placeholderSectionHeader

Expand Down Expand Up @@ -46,6 +57,7 @@ ColumnLayout {
sourceComponent: UnifiedSearchResultItemSkeletonGradientRectangle {
width: unifiedSearchResultsListViewSkeletonColumn.animationRectangleWidth
height: parent.height
sharedAnimationX: unifiedSearchResultsListViewSkeletonColumn.sharedAnimationX
}
}
}
Expand All @@ -71,6 +83,7 @@ ColumnLayout {
width: unifiedSearchResultsListViewSkeletonColumn.width
height: Style.trayWindowHeaderHeight
animationRectangleWidth: unifiedSearchResultsListViewSkeletonColumn.animationRectangleWidth
sharedAnimationX: unifiedSearchResultsListViewSkeletonColumn.sharedAnimationX
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Rectangle {
property color progressGradientColor: Style.darkMode ? Qt.lighter(palette.light, 1.2) : Qt.darker(palette.light, 1.1)
property int animationStartX: -width
property int animationEndX: width
// If sharedAnimationX is provided by a parent container, bind x to it directly.
// Otherwise fall back to the local NumberAnimation.
property real sharedAnimationX: Number.NaN
readonly property bool useSharedAnimation: !isNaN(sharedAnimationX)

gradient: Gradient {
orientation: Gradient.Horizontal
Expand All @@ -42,6 +46,13 @@ Rectangle {
to: root.animationEndX
duration: 1000
loops: Animation.Infinite
running: true
running: !root.useSharedAnimation
}

Binding {
target: root
property: "x"
value: root.sharedAnimationX
when: root.useSharedAnimation
}
}
3 changes: 0 additions & 3 deletions src/gui/tray/UserLine.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ AbstractButton {
id: accountAvatar
Layout.leftMargin: Style.accountIconsMenuMargin
verticalAlignment: Qt.AlignCenter
cache: false
source: model.avatar !== "" ? model.avatar : Style.darkMode ? "image://avatars/fallbackWhite" : "image://avatars/fallbackBlack"
Layout.preferredHeight: Style.accountAvatarSize
Layout.preferredWidth: Style.accountAvatarSize
Expand All @@ -58,7 +57,6 @@ AbstractButton {
id: accountStatusIndicator
visible: model.isConnected && model.serverHasUserStatus
source: model.statusIcon
cache: false
anchors.centerIn: accountStatusIndicatorBackground
sourceSize.width: Style.accountAvatarStateIndicatorSize
sourceSize.height: Style.accountAvatarStateIndicatorSize
Expand Down Expand Up @@ -157,7 +155,6 @@ AbstractButton {
id: syncStatusIndicator
visible: !model.syncStatusOk
source: model.syncStatusIcon
cache: false
anchors.centerIn: parent
sourceSize.width: Style.accountAvatarStateIndicatorSize + Style.trayFolderStatusIndicatorSizeOffset
sourceSize.height: Style.accountAvatarStateIndicatorSize + Style.trayFolderStatusIndicatorSizeOffset
Expand Down
29 changes: 27 additions & 2 deletions src/libsync/bandwidthmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ BandwidthManager::BandwidthManager(OwncloudPropagator *p)
_switchingTimer.start();
QMetaObject::invokeMethod(this, "switchingTimerExpired", Qt::QueuedConnection);

// absolute uploads/downloads
// absolute uploads/downloads — only start the timer when a limit is actually configured
QObject::connect(&_absoluteLimitTimer, &QTimer::timeout, this, &BandwidthManager::absoluteLimitTimerExpired);
_absoluteLimitTimer.setInterval(1000);
_absoluteLimitTimer.start();
if (usingAbsoluteUploadLimit() || usingAbsoluteDownloadLimit()) {
_absoluteLimitTimer.start();
}

}

Expand All @@ -52,6 +54,7 @@ BandwidthManager::~BandwidthManager() = default;
void BandwidthManager::registerUploadDevice(UploadDevice *p)
{
_absoluteUploadDeviceList.push_back(p);
_dirty = true;
QObject::connect(p, &QObject::destroyed, this, &BandwidthManager::unregisterUploadDevice);

if (usingAbsoluteUploadLimit()) {
Expand All @@ -67,11 +70,13 @@ void BandwidthManager::unregisterUploadDevice(QObject *o)
{
auto p = reinterpret_cast<UploadDevice *>(o); // note, we might already be in the ~QObject
_absoluteUploadDeviceList.remove(p);
_dirty = true;
}

void BandwidthManager::registerDownloadJob(GETFileJob *j)
{
_downloadJobList.push_back(j);
_dirty = true;
QObject::connect(j, &QObject::destroyed, this, &BandwidthManager::unregisterDownloadJob);

if (usingAbsoluteDownloadLimit()) {
Expand All @@ -87,10 +92,16 @@ void BandwidthManager::unregisterDownloadJob(QObject *o)
{
auto *j = reinterpret_cast<GETFileJob *>(o); // note, we might already be in the ~QObject
_downloadJobList.remove(j);
_dirty = true;
}

void BandwidthManager::switchingTimerExpired()
{
if (!_dirty) {
return;
}
_dirty = false;

const auto newUploadLimit = _propagator->_uploadLimit;
if (newUploadLimit != _currentUploadLimit) {
qCInfo(lcBandwidthManager) << "Upload Bandwidth limit changed" << _currentUploadLimit << newUploadLimit;
Expand Down Expand Up @@ -126,10 +137,24 @@ void BandwidthManager::switchingTimerExpired()
}
}
}

// Start or stop the absolute-limit timer based on whether any limit is now active.
if (usingAbsoluteUploadLimit() || usingAbsoluteDownloadLimit()) {
if (!_absoluteLimitTimer.isActive()) {
_absoluteLimitTimer.start();
}
} else {
_absoluteLimitTimer.stop();
}
}

void BandwidthManager::absoluteLimitTimerExpired()
{
if (!_dirty) {
return;
}
_dirty = false;

if (usingAbsoluteUploadLimit() && !_absoluteUploadDeviceList.empty()) {
const auto quotaPerDevice = _currentUploadLimit / qMax((std::list<UploadDevice *>::size_type)1, _absoluteUploadDeviceList.size());

Expand Down
2 changes: 2 additions & 0 deletions src/libsync/bandwidthmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public slots:

std::list<GETFileJob *> _downloadJobList;
qint64 _currentDownloadLimit = 0;

bool _dirty = false;
};

} // namespace OCC
Expand Down
12 changes: 8 additions & 4 deletions src/libsync/vfs/cfapi/cfapiwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1163,12 +1163,16 @@ OCC::Result<void, QString> OCC::CfApiWrapper::createPlaceholdersInfo(const QStri
return { "Couldn't create placeholder info" };
}

// Hoist the parent placeholder lookup outside the per-file loop: all files placed
// under localBasePath share the same parent directory, so one lookup suffices.
const auto sharedParentInfo = findPlaceholderInfo(QDir::toNativeSeparators(QFileInfo(localBasePath).absoluteFilePath()));
const auto sharedState = sharedParentInfo && sharedParentInfo->PinState == CF_PIN_STATE_UNPINNED
? CF_PIN_STATE_UNPINNED
: CF_PIN_STATE_INHERIT;

for(auto itemIndice = 0; itemIndice < filteredItemsInfo.size(); ++itemIndice) {
const auto &placeholderInfo = filteredItemsInfo[itemIndice];
const auto parentInfo = findPlaceholderInfo(QDir::toNativeSeparators(QFileInfo(localBasePath + QDir::separator() + placeholderInfo.relativePath).absolutePath()));
const auto state = parentInfo && parentInfo->PinState == CF_PIN_STATE_UNPINNED ? CF_PIN_STATE_UNPINNED : CF_PIN_STATE_INHERIT;

if (!setPinState(QDir::toNativeSeparators(QFileInfo(localBasePath + QDir::separator() + placeholderInfo.relativePath).absoluteFilePath()), cfPinStateToPinState(state), NoRecurse)) {
if (!setPinState(QDir::toNativeSeparators(QFileInfo(localBasePath + QDir::separator() + placeholderInfo.relativePath).absoluteFilePath()), cfPinStateToPinState(sharedState), NoRecurse)) {
return { "Couldn't set the default inherit pin state" };
}
}
Expand Down