Skip to content

Commit

Permalink
Consistently use folder icon
Browse files Browse the repository at this point in the history
TheOneRing committed Sep 7, 2023
1 parent 7e98b40 commit 40bf9b0
Showing 7 changed files with 26 additions and 34 deletions.
1 change: 0 additions & 1 deletion src/gui/folderstatusdelegate.cpp
Original file line number Diff line number Diff line change
@@ -25,7 +25,6 @@

#include "resources/resources.h"

#include <QFileIconProvider>
#include <QPainter>
#include <QApplication>

5 changes: 4 additions & 1 deletion src/gui/folderstatusmodel.cpp
Original file line number Diff line number Diff line change
@@ -209,7 +209,10 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
case Qt::CheckStateRole:
return x._checked;
case Qt::DecorationRole:
return QFileIconProvider().icon(x._isExternal ? QFileIconProvider::Network : QFileIconProvider::Folder);
if (x._isExternal) {
return QFileIconProvider().icon(QFileIconProvider::Network);
}
return Resources::getCoreIcon(QStringLiteral("folder-sync"));
case Qt::ForegroundRole:
if (x._isUndecided) {
return QColor(Qt::red);
2 changes: 1 addition & 1 deletion src/gui/folderwizard/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -12,6 +12,6 @@ add_library(folderwizard STATIC
spacespage.ui
)

target_link_libraries(folderwizard PUBLIC Qt::Widgets libsync)
target_link_libraries(folderwizard PUBLIC Qt::Widgets libsync owncloudResources)
set_target_properties(folderwizard PROPERTIES AUTOUIC ON AUTORCC ON)
apply_common_target_settings(folderwizard)
7 changes: 3 additions & 4 deletions src/gui/folderwizard/folderwizardremotepath.cpp
Original file line number Diff line number Diff line change
@@ -26,8 +26,9 @@

#include "libsync/theme.h"

#include "resources/resources.h"

#include <QDir>
#include <QFileIconProvider>
#include <QInputDialog>

using namespace OCC;
@@ -161,9 +162,7 @@ void FolderWizardRemotePath::recursiveInsert(QTreeWidgetItem *parent, QStringLis
QTreeWidgetItem *item = findFirstChild(parent, folderName);
if (!item) {
item = new QTreeWidgetItem(parent);
QFileIconProvider prov;
QIcon folderIcon = prov.icon(QFileIconProvider::Folder);
item->setIcon(0, folderIcon);
item->setIcon(0, Resources::getCoreIcon(QStringLiteral("folder-sync")));
item->setText(0, folderName);
item->setData(0, Qt::UserRole, folderPath);
item->setToolTip(0, folderPath);
7 changes: 3 additions & 4 deletions src/gui/selectivesyncwidget.cpp
Original file line number Diff line number Diff line change
@@ -18,8 +18,9 @@
#include "libsync/networkjobs.h"
#include "libsync/theme.h"

#include "resources/resources.h"

#include <QDialogButtonBox>
#include <QFileIconProvider>
#include <QHeaderView>
#include <QLabel>
#include <QScopedValueRollback>
@@ -132,8 +133,6 @@ static QTreeWidgetItem *findFirstChild(QTreeWidgetItem *parent, const QString &t

void SelectiveSyncWidget::recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path, qint64 size)
{
QFileIconProvider prov;
QIcon folderIcon = prov.icon(QFileIconProvider::Folder);
if (pathTrail.size() == 0) {
if (path.endsWith(QLatin1Char('/'))) {
path.chop(1);
@@ -157,7 +156,7 @@ void SelectiveSyncWidget::recursiveInsert(QTreeWidgetItem *parent, QStringList p
} else if (parent->checkState(0) == Qt::Unchecked) {
item->setCheckState(0, Qt::Unchecked);
}
item->setIcon(0, folderIcon);
item->setIcon(0, Resources::getCoreIcon(QStringLiteral("folder-sync")));
item->setText(0, pathTrail.first());
if (size >= 0) {
item->setText(1, Utility::octetsToString(size));
8 changes: 3 additions & 5 deletions src/gui/sharedialog.cpp
Original file line number Diff line number Diff line change
@@ -28,11 +28,11 @@
#include "configfile.h"
#include "theme.h"

#include <QFileInfo>
#include <QFileIconProvider>
#include <QFileInfo>
#include <QFrame>
#include <QPointer>
#include <QPushButton>
#include <QFrame>
#include <QRegularExpression>

using namespace std::chrono_literals;
@@ -76,9 +76,7 @@ ShareDialog::ShareDialog(AccountStatePtr accountState,
closeButton->setAutoDefault(false);

// Set icon
QFileInfo f_info(_localPath);
QFileIconProvider icon_provider;
const QIcon icon = icon_provider.icon(f_info);
const QIcon icon = QFileIconProvider().icon(QFileInfo(_localPath));
if (!icon.isNull()) {
auto pixmap = icon.pixmap(thumbnailSize, thumbnailSize);
_ui->label_icon->setPixmap(pixmap);
30 changes: 12 additions & 18 deletions src/gui/shareusergroupwidget.cpp
Original file line number Diff line number Diff line change
@@ -13,40 +13,34 @@
*/

#include "shareusergroupwidget.h"
#include "ui_shareusergroupwidget.h"
#include "ui_shareuserline.h"
#include "account.h"
#include "folderman.h"
#include "folder.h"
#include "accountmanager.h"
#include "theme.h"
#include "configfile.h"
#include "capabilities.h"
#include "configfile.h"
#include "guiutility.h"
#include "thumbnailjob.h"
#include "sharee.h"
#include "sharemanager.h"
#include "guiutility.h"
#include "thumbnailjob.h"
#include "ui_shareusergroupwidget.h"
#include "ui_shareuserline.h"

#include "resources/resources.h"

#include "QProgressIndicator.h"

#include <QAbstractProxyModel>
#include <QAction>
#include <QBuffer>
#include <QFileIconProvider>
#include <QClipboard>
#include <QFileInfo>
#include <QAbstractProxyModel>
#include <QColor>
#include <QCompleter>
#include <qscrollarea.h>
#include <qlayout.h>
#include <QPropertyAnimation>
#include <QMenu>
#include <QAction>
#include <QCryptographicHash>
#include <QDesktopServices>
#include <QFileInfo>
#include <QMenu>
#include <QMessageBox>
#include <QCryptographicHash>
#include <QColor>
#include <QPainter>
#include <QPropertyAnimation>

namespace OCC {

0 comments on commit 40bf9b0

Please sign in to comment.