Skip to content

Commit 02152d5

Browse files
committed
wip font config
1 parent 2418054 commit 02152d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+282
-267
lines changed

src/gui/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ ecm_add_qml_module(OpenCloudGui
104104
VERSION 1.0
105105
NAMESPACE OCC
106106
QML_FILES
107+
qml/OpenCloud.js
108+
107109
qml/AccountBar.qml
108110
qml/AccountButton.qml
109111
qml/FolderDelegate.qml

src/gui/accountsettings.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121
#include "accountmanager.h"
2222
#include "accountstate.h"
2323
#include "application.h"
24-
#include "common/utility.h"
2524
#include "commonstrings.h"
2625
#include "configfile.h"
27-
#include "creds/httpcredentialsgui.h"
2826
#include "folderman.h"
2927
#include "folderstatusmodel.h"
3028
#include "folderwizard/folderwizard.h"
@@ -34,15 +32,14 @@
3432
#include "gui/qmlutils.h"
3533
#include "gui/selectivesyncwidget.h"
3634
#include "gui/spaces/spaceimageprovider.h"
37-
#include "guiutility.h"
3835
#include "libsync/graphapi/spacesmanager.h"
3936
#include "libsync/syncresult.h"
4037
#include "libsync/theme.h"
4138
#include "networkjobs/jsonjob.h"
39+
#include "resources/fonticon.h"
4240
#include "scheduling/syncscheduler.h"
4341
#include "settingsdialog.h"
4442

45-
#include <QAction>
4643
#include <QMessageBox>
4744
#include <QSortFilterProxyModel>
4845
#include <QtQuickWidgets/QtQuickWidgets>
@@ -254,7 +251,7 @@ void AccountSettings::showConnectionLabel(const QString &message, SyncResult::St
254251
qCDebug(lcAccountSettings) << msg;
255252
_connectionLabel = msg;
256253
}
257-
_accountStateIconName = QStringLiteral("states/%1").arg(Theme::instance()->syncStateIconName(SyncResult(status)));
254+
_accountStateIconGlype = SyncResult(status).glype();
258255
Q_EMIT connectionLabelChanged();
259256
}
260257

@@ -350,7 +347,7 @@ void AccountSettings::updateNotifications()
350347
auto newNotifications = _notifications;
351348
newNotifications.subtract(oldNotifications);
352349
for (const auto &notification : newNotifications) {
353-
ocApp()->slotShowOptionalTrayMessage(notification.title, notification.message, Resources::getCoreIcon(QStringLiteral("bell")));
350+
ocApp()->slotShowOptionalTrayMessage(notification.title, notification.message, Resources::FontIcon(u''));
354351
}
355352
Q_EMIT notificationsChanged();
356353
});
@@ -522,9 +519,9 @@ QString AccountSettings::connectionLabel()
522519
return _connectionLabel;
523520
}
524521

525-
QString AccountSettings::accountStateIconName()
522+
QChar AccountSettings::accountStateIconGlype()
526523
{
527-
return _accountStateIconName;
524+
return _accountStateIconGlype;
528525
}
529526

530527
const QSet<Notification> &AccountSettings::notifications() const

src/gui/accountsettings.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class OPENCLOUD_GUI_EXPORT AccountSettings : public QWidget
5454
Q_PROPERTY(uint unsyncedSpaces READ unsyncedSpaces NOTIFY unsyncedSpacesChanged)
5555
Q_PROPERTY(uint syncedSpaces READ syncedSpaces NOTIFY syncedSpacesChanged)
5656
Q_PROPERTY(QString connectionLabel READ connectionLabel NOTIFY connectionLabelChanged)
57-
Q_PROPERTY(QString accountStateIconName READ accountStateIconName NOTIFY connectionLabelChanged)
57+
Q_PROPERTY(QChar accountStateIconGlype READ accountStateIconGlype NOTIFY connectionLabelChanged)
5858
Q_PROPERTY(QSet<Notification> notifications READ notifications NOTIFY notificationsChanged)
5959
OC_DECLARE_WIDGET_FOCUS
6060
QML_ELEMENT
@@ -78,7 +78,7 @@ class OPENCLOUD_GUI_EXPORT AccountSettings : public QWidget
7878
auto model() const;
7979

8080
QString connectionLabel();
81-
QString accountStateIconName();
81+
QChar accountStateIconGlype();
8282

8383
const QSet<Notification> &notifications() const;
8484

@@ -124,7 +124,7 @@ protected Q_SLOTS:
124124
uint _syncedSpaces = 0;
125125
uint _unsyncedSpaces = 0;
126126
QString _connectionLabel;
127-
QString _accountStateIconName;
127+
QChar _accountStateIconGlype;
128128

129129
QSet<Notification> _notifications;
130130
};

src/gui/activitywidget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
#include "activitywidget.h"
1616

17-
#include "account.h"
17+
1818
#include "issueswidget.h"
1919
#include "protocolwidget.h"
20+
#include "resources/fonticon.h"
2021
#include "theme.h"
2122

22-
#include <QHBoxLayout>
2323
#include <QtGui>
2424
#include <QtWidgets>
2525

@@ -41,10 +41,10 @@ ActivitySettings::ActivitySettings(QWidget *parent)
4141
hbox->addWidget(_tab);
4242

4343
_protocolWidget = new ProtocolWidget(this);
44-
_tab->addTab(_protocolWidget, Resources::getCoreIcon(QStringLiteral("states/sync")), tr("Local Activity"));
44+
_tab->addTab(_protocolWidget, Resources::FontIcon(u''), tr("Local Activity"));
4545

4646
_issuesWidget = new IssuesWidget(this);
47-
const int issueTabId = _tab->addTab(_issuesWidget, Resources::getCoreIcon(QStringLiteral("states/warning")), tr("Not Synced"));
47+
const int issueTabId = _tab->addTab(_issuesWidget, Resources::FontIcon(u''), tr("Not Synced"));
4848
connect(_issuesWidget, &IssuesWidget::issueCountUpdated, this, [issueTabId, this](int issueCount) {
4949
QString cntText = tr("Not Synced");
5050
if (issueCount) {

src/gui/application.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "gui/newwizard/setupwizardcontroller.h"
3131
#include "gui/systray.h"
3232
#include "libsync/graphapi/spacesmanager.h"
33+
#include "resources/fonticon.h"
3334
#include "settingsdialog.h"
3435
#include "socketapi/socketapi.h"
3536
#include "theme.h"
@@ -265,7 +266,7 @@ void Application::showAbout()
265266

266267
void Application::slotShowTrayMessage(const QString &title, const QString &msg, const QIcon &icon)
267268
{
268-
_systray->showMessage(title, msg, icon.isNull() ? Resources::getCoreIcon(QStringLiteral("states/information")) : icon);
269+
_systray->showMessage(title, msg, icon.isNull() ? Resources::FontIcon(u'') : icon);
269270
}
270271

271272
void Application::slotShowOptionalTrayMessage(const QString &title, const QString &msg, const QIcon &icon)

src/gui/folderstatusmodel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ namespace {
4040
// minimum delay between progress updates
4141
constexpr auto progressUpdateTimeOutC = 1s;
4242

43-
QString statusIconName(Folder *f)
43+
QChar statusIconName(Folder *f)
4444
{
4545
auto status = f->syncResult();
4646
if (!f->accountState()->isConnected()) {
4747
status.setStatus(SyncResult::Status::Offline);
4848
} else if (f->isSyncPaused() || NetworkInformation::instance()->isBehindCaptivePortal() || NetworkInformation::instance()->isMetered()) {
4949
status.setStatus(SyncResult::Status::Paused);
5050
}
51-
return QStringLiteral("states/%1").arg(Theme::instance()->syncStateIconName(status));
51+
return status.glype();
5252
}
5353

5454
class SubFolderInfo

src/gui/logbrowser.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,18 @@
1414

1515
#include "logbrowser.h"
1616

17-
#include "stdio.h"
1817
#include <iostream>
1918

2019
#include <QDesktopServices>
2120
#include <QDir>
2221
#include <QLayout>
2322
#include <QMessageBox>
24-
#include <QTextStream>
2523
#include <optional>
2624

2725
#include "configfile.h"
2826
#include "guiutility.h"
2927
#include "logger.h"
28+
#include "resources/fonticon.h"
3029
#include "ui_logbrowser.h"
3130

3231
#include "resources/resources.h"
@@ -41,7 +40,7 @@ LogBrowser::LogBrowser(QWidget *parent)
4140
{
4241
ui->setupUi(this);
4342

44-
ui->warningIcon->setPixmap(Resources::getCoreIcon(QStringLiteral("warning")).pixmap(ui->warningIcon->size()));
43+
ui->warningIcon->setPixmap(Resources::FontIcon(u'').pixmap(ui->warningIcon->size()));
4544
ui->locationLabel->setText(Logger::instance()->temporaryFolderLogDirPath());
4645

4746
ui->enableLoggingButton->setChecked(ConfigFile().automaticLogDir());

src/gui/models/protocolitemmodel.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
#include "account.h"
1717
#include "accountstate.h"
18-
#include "models.h"
1918
#include "gui/folderman.h"
19+
#include "models.h"
20+
#include "resources/fonticon.h"
2021

2122
#include "theme.h"
2223

23-
#include <QIcon>
2424

2525
using namespace OCC;
2626

@@ -84,12 +84,12 @@ QVariant ProtocolItemModel::data(const QModelIndex &index, int role) const
8484
|| status == SyncFileItem::FatalError
8585
|| status == SyncFileItem::DetailError
8686
|| status == SyncFileItem::BlacklistedError) {
87-
return Resources::getCoreIcon(QStringLiteral("states/error"));
87+
return Resources::FontIcon(u'');
8888
;
8989
} else if (Progress::isWarningKind(status) || status == SyncFileItem::Excluded) {
90-
return Resources::getCoreIcon(QStringLiteral("states/information"));
90+
return Resources::FontIcon(u'');
9191
} else {
92-
return Resources::getCoreIcon(QStringLiteral("states/ok"));
92+
return Resources::FontIcon(u'');
9393
}
9494
}
9595
break;

src/gui/newwizard/pages/accountconfiguredwizardpage.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#include "accountconfiguredwizardpage.h"
2+
23
#include "ui_accountconfiguredwizardpage.h"
34

45
#include "gui/application.h"
56
#include "libsync/theme.h"
7+
#include "resources/fonticon.h"
68

7-
#include "resources/resources.h"
89

910
#include <QDir>
1011
#include <QFileDialog>
@@ -101,8 +102,8 @@ AccountConfiguredWizardPage::AccountConfiguredWizardPage(
101102
_ui->advancedConfigGroupBox->setChecked(false);
102103

103104
// allows resetting local directory to default value once changed
104-
_ui->resetLocalDirectoryButton->setIcon(Resources::getCoreIcon(QStringLiteral("undo")));
105-
_ui->chooseLocalDirectoryButton->setIcon(Resources::getCoreIcon(QStringLiteral("more")));
105+
_ui->resetLocalDirectoryButton->setIcon(Resources::FontIcon(u''));
106+
_ui->chooseLocalDirectoryButton->setIcon(Resources::FontIcon(u''));
106107
auto enableResetLocalDirectoryButton = [this, defaultSyncTargetDir]() {
107108
return _ui->localDirectoryLineEdit->text() != QDir::toNativeSeparators(defaultSyncTargetDir);
108109
};

src/gui/qml/AccountBar.qml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Pane {
6767
Layout.maximumWidth: widthHint
6868
Accessible.role: Accessible.PageTab
6969
checked: settingsDialog.currentAccount === accountState.account
70-
icon.source: accountState.account.hasAvatar ? QMLResources.resourcePath2("avatar", accountState.account.uid, enabled) : undefined
70+
icon.source: accountState.account.hasAvatar ? OpenCloud.resourcePath2("avatar", accountState.account.uid, enabled) : undefined
7171
icon.cache: false
7272
altText: accountState.account.initials
7373
text: accountState.account.hostName
@@ -87,7 +87,7 @@ Pane {
8787
function onAvatarChanged() {
8888
icon.source = undefined;
8989
if (accountState.account.hasAvatar) {
90-
icon.source = QMLResources.resourcePath2("avatar", accountState.account.uid, enabled);
90+
icon.source = OpenCloud.resourcePath2("avatar", accountState.account.uid, enabled);
9191
}
9292
}
9393
}
@@ -110,7 +110,7 @@ Pane {
110110

111111
Layout.fillHeight: true
112112
Layout.maximumWidth: widthHint
113-
icon.source: QMLResources.resourcePath("core", "plus-solid", enabled)
113+
icon.source: OpenCloud.resourcePath("fontawesome", "+", enabled)
114114
text: qsTr("Add Account")
115115
visible: Theme.multiAccount || AccountManager.accounts.length === 0
116116

@@ -137,7 +137,7 @@ Pane {
137137
Layout.maximumWidth: widthHint
138138
Accessible.role: Accessible.PageTab
139139
checked: settingsDialog.currentPage === SettingsDialog.Activity
140-
icon.source: QMLResources.resourcePath("core", "activity", enabled)
140+
icon.source: OpenCloud.resourcePath("fontawesome", "", enabled)
141141
text: qsTr("Activity")
142142

143143
onClicked: {
@@ -151,7 +151,7 @@ Pane {
151151
Layout.maximumWidth: widthHint
152152
Accessible.role: Accessible.PageTab
153153
checked: settingsDialog.currentPage === SettingsDialog.Settings
154-
icon.source: QMLResources.resourcePath("core", "settings", enabled)
154+
icon.source: OpenCloud.resourcePath("fontawesome", "", enabled)
155155
text: qsTr("Settings")
156156

157157
onClicked: {
@@ -167,7 +167,7 @@ Pane {
167167

168168
Layout.fillHeight: true
169169
Layout.maximumWidth: widthHint
170-
icon.source: QMLResources.resourcePath("universal", urlButton.icon, enabled)
170+
icon.source: OpenCloud.resourcePath("universal", urlButton.icon, enabled)
171171
text: urlButton.name
172172

173173
onClicked: {
@@ -180,7 +180,7 @@ Pane {
180180

181181
Layout.fillHeight: true
182182
Layout.maximumWidth: widthHint
183-
icon.source: QMLResources.resourcePath("core", "quit", enabled)
183+
icon.source: OpenCloud.resourcePath("fontawesome", "", enabled)
184184
text: qsTr("Quit")
185185

186186
Keys.onTabPressed: {

0 commit comments

Comments
 (0)