зеркало из https://github.com/nextcloud/desktop.git
Use the return braced init list pattern
This way we avoid repeating the return type while it is already known. Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
Родитель
ccc409dbd0
Коммит
6e62c8b430
|
@ -93,7 +93,7 @@ void QProgressIndicator::setColor(const QColor & color)
|
|||
|
||||
QSize QProgressIndicator::sizeHint() const
|
||||
{
|
||||
return QSize(20,20);
|
||||
return {20, 20};
|
||||
}
|
||||
|
||||
int QProgressIndicator::heightForWidth(int w) const
|
||||
|
|
|
@ -91,7 +91,7 @@ QSize FolderStatusDelegate::sizeHint(const QStyleOptionViewItem &option,
|
|||
h += margin + 2 * margin + errMsgs.count() * fm.height();
|
||||
}
|
||||
|
||||
return QSize(0, h);
|
||||
return {0, h};
|
||||
}
|
||||
|
||||
int FolderStatusDelegate::rootFolderHeightWithoutErrors(const QFontMetrics &fm, const QFontMetrics &aliasFm)
|
||||
|
|
|
@ -426,7 +426,7 @@ FolderStatusModel::SubFolderInfo *FolderStatusModel::infoForFileId(const QByteAr
|
|||
QModelIndex FolderStatusModel::indexForPath(Folder *f, const QString &path) const
|
||||
{
|
||||
if (!f) {
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
|
||||
int slashPos = path.lastIndexOf('/');
|
||||
|
@ -444,10 +444,10 @@ QModelIndex FolderStatusModel::indexForPath(Folder *f, const QString &path) cons
|
|||
return index(j, 0, index(i));
|
||||
}
|
||||
}
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
|
||||
auto parent = indexForPath(f, path.left(slashPos));
|
||||
|
@ -461,7 +461,7 @@ QModelIndex FolderStatusModel::indexForPath(Folder *f, const QString &path) cons
|
|||
|
||||
auto parentInfo = infoForIndex(parent);
|
||||
if (!parentInfo) {
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
for (int i = 0; i < parentInfo->_subs.size(); ++i) {
|
||||
if (parentInfo->_subs.at(i)._name == path.mid(slashPos + 1)) {
|
||||
|
@ -469,7 +469,7 @@ QModelIndex FolderStatusModel::indexForPath(Folder *f, const QString &path) cons
|
|||
}
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
|
||||
QModelIndex FolderStatusModel::index(int row, int column, const QModelIndex &parent) const
|
||||
|
@ -480,7 +480,7 @@ QModelIndex FolderStatusModel::index(int row, int column, const QModelIndex &par
|
|||
switch (classify(parent)) {
|
||||
case AddButton:
|
||||
case FetchLabel:
|
||||
return QModelIndex();
|
||||
return {};
|
||||
case RootFolder:
|
||||
if (_folders.count() <= parent.row())
|
||||
return QModelIndex(); // should not happen
|
||||
|
@ -488,26 +488,26 @@ QModelIndex FolderStatusModel::index(int row, int column, const QModelIndex &par
|
|||
case SubFolder: {
|
||||
auto pinfo = static_cast<SubFolderInfo *>(parent.internalPointer());
|
||||
if (pinfo->_subs.count() <= parent.row())
|
||||
return QModelIndex(); // should not happen
|
||||
return {}; // should not happen
|
||||
auto &info = pinfo->_subs[parent.row()];
|
||||
if (!info.hasLabel()
|
||||
&& info._subs.count() <= row)
|
||||
return QModelIndex(); // should not happen
|
||||
return {}; // should not happen
|
||||
return createIndex(row, column, &info);
|
||||
}
|
||||
}
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
|
||||
QModelIndex FolderStatusModel::parent(const QModelIndex &child) const
|
||||
{
|
||||
if (!child.isValid()) {
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
switch (classify(child)) {
|
||||
case RootFolder:
|
||||
case AddButton:
|
||||
return QModelIndex();
|
||||
return {};
|
||||
case SubFolder:
|
||||
case FetchLabel:
|
||||
break;
|
||||
|
|
|
@ -25,7 +25,7 @@ QModelIndex FolderStatusView::indexAt(const QPoint &point) const
|
|||
{
|
||||
QModelIndex index = QTreeView::indexAt(point);
|
||||
if (index.data(FolderStatusDelegate::AddButton).toBool() && !visualRect(index).contains(point)) {
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,10 @@ GeneralSettings::~GeneralSettings()
|
|||
|
||||
QSize GeneralSettings::sizeHint() const
|
||||
{
|
||||
return QSize(ownCloudGui::settingsDialogSize().width(), QWidget::sizeHint().height());
|
||||
return {
|
||||
ownCloudGui::settingsDialogSize().width(),
|
||||
QWidget::sizeHint().height()
|
||||
};
|
||||
}
|
||||
|
||||
void GeneralSettings::loadMiscSettings()
|
||||
|
|
|
@ -89,7 +89,10 @@ NetworkSettings::~NetworkSettings()
|
|||
|
||||
QSize NetworkSettings::sizeHint() const
|
||||
{
|
||||
return QSize(ownCloudGui::settingsDialogSize().width(), QWidget::sizeHint().height());
|
||||
return {
|
||||
ownCloudGui::settingsDialogSize().width(),
|
||||
QWidget::sizeHint().height()
|
||||
};
|
||||
}
|
||||
|
||||
void NetworkSettings::loadProxySettings()
|
||||
|
|
|
@ -101,7 +101,10 @@ QSize SlideShow::sizeHint() const
|
|||
pixmapSize.setWidth(std::max(pixmap.width(), pixmapSize.width()));
|
||||
pixmapSize.setHeight(std::max(pixmap.height(), pixmapSize.height()));
|
||||
}
|
||||
return QSize(std::max(labelSize.width(), pixmapSize.width()), labelSize.height() + Spacing + pixmapSize.height());
|
||||
return {
|
||||
std::max(labelSize.width(), pixmapSize.width()),
|
||||
labelSize.height() + Spacing + pixmapSize.height()
|
||||
};
|
||||
}
|
||||
|
||||
void SlideShow::startShow(int interval)
|
||||
|
|
|
@ -1593,7 +1593,7 @@ RemotePermissions SyncEngine::getPermissions(const QString &file) const
|
|||
if (it != _csync_ctx->remote.files.end()) {
|
||||
return it->second->remotePerm;
|
||||
}
|
||||
return RemotePermissions();
|
||||
return {};
|
||||
}
|
||||
|
||||
void SyncEngine::restoreOldFiles(SyncFileItemVector &syncItems)
|
||||
|
|
|
@ -139,7 +139,7 @@ SyncFileStatus SyncFileStatusTracker::fileStatus(const QString &relativePath)
|
|||
if (_syncEngine->excludedFiles().isExcluded(_syncEngine->localPath() + relativePath,
|
||||
_syncEngine->localPath(),
|
||||
_syncEngine->ignoreHiddenFiles())) {
|
||||
return SyncFileStatus(SyncFileStatus::StatusWarning);
|
||||
return SyncFileStatus::StatusWarning;
|
||||
}
|
||||
|
||||
if (_dirtyPaths.contains(relativePath))
|
||||
|
|
|
@ -447,12 +447,12 @@ QIcon Theme::folderOfflineIcon(bool sysTray) const
|
|||
|
||||
QColor Theme::wizardHeaderTitleColor() const
|
||||
{
|
||||
return QColor(APPLICATION_WIZARD_HEADER_TITLE_COLOR);
|
||||
return {APPLICATION_WIZARD_HEADER_TITLE_COLOR};
|
||||
}
|
||||
|
||||
QColor Theme::wizardHeaderBackgroundColor() const
|
||||
{
|
||||
return QColor(APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR);
|
||||
return {APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR};
|
||||
}
|
||||
|
||||
QPixmap Theme::wizardHeaderLogo() const
|
||||
|
@ -581,7 +581,7 @@ bool Theme::isDarkColor(const QColor &color)
|
|||
|
||||
QColor Theme::getBackgroundAwareLinkColor(const QColor &backgroundColor)
|
||||
{
|
||||
return QColor((isDarkColor(backgroundColor) ? QColor("#6193dc") : QGuiApplication::palette().color(QPalette::Link)));
|
||||
return {(isDarkColor(backgroundColor) ? QColor("#6193dc") : QGuiApplication::palette().color(QPalette::Link))};
|
||||
}
|
||||
|
||||
QColor Theme::getBackgroundAwareLinkColor()
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
if (QFileInfo(at(i)[0].toString()) == file)
|
||||
return at(i)[1].value<SyncFileStatus>();
|
||||
}
|
||||
return SyncFileStatus();
|
||||
return {};
|
||||
}
|
||||
|
||||
bool statusEmittedBefore(const QString &firstPath, const QString &secondPath) const {
|
||||
|
|
Загрузка…
Ссылка в новой задаче