Przeglądaj źródła

(Maybe) finished implementation of themed wizard buttons and accessibility refinements and thus implementation of helper fct. to retrieve themed QIcons.

Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
Dominique Fuchs 6 lat temu
rodzic
commit
ace3da841c

+ 3 - 14
src/gui/wizard/owncloudsetupnocredspage.ui

@@ -76,17 +76,13 @@
        </property>
        <property name="maximumSize">
         <size>
-         <width>80</width>
+         <width>40</width>
          <height>16777215</height>
         </size>
        </property>
        <property name="text">
         <string/>
        </property>
-       <property name="icon">
-        <iconset resource="../../../theme.qrc">
-         <normaloff>:/client/theme/black/control-prev.svg</normaloff>:/client/theme/black/control-prev.svg</iconset>
-       </property>
        <property name="flat">
         <bool>true</bool>
        </property>
@@ -113,17 +109,13 @@
        </property>
        <property name="maximumSize">
         <size>
-         <width>80</width>
+         <width>40</width>
          <height>16777215</height>
         </size>
        </property>
        <property name="text">
         <string/>
        </property>
-       <property name="icon">
-        <iconset resource="../../../theme.qrc">
-         <normaloff>:/client/theme/black/control-next.svg</normaloff>:/client/theme/black/control-next.svg</iconset>
-       </property>
        <property name="flat">
         <bool>true</bool>
        </property>
@@ -418,14 +410,11 @@
      </item>
      <item>
       <widget class="QWidget" name="widget" native="true">
-       <property name="focusPolicy">
-        <enum>Qt::TabFocus</enum>
-       </property>
        <layout class="QVBoxLayout" name="verticalLayout_3">
         <item>
          <widget class="QLabel" name="installLink">
           <property name="text">
-           <string>&lt;a href=&quot;https://docs.nextcloud.com/server/15/admin_manual/installation/index.html#installation&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Host your own server&lt;/span&gt;&lt;/a&gt;</string>
+           <string>&lt;a href=&quot;https://docs.nextcloud.com/server/15/admin_manual/installation/index.html#installation&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#7a7a7a;&quot;&gt;Host your own server&lt;/span&gt;&lt;/a&gt;</string>
           </property>
           <property name="openExternalLinks">
            <bool>true</bool>

+ 3 - 0
src/gui/wizard/owncloudsetuppage.cpp

@@ -89,6 +89,9 @@ OwncloudSetupPage::OwncloudSetupPage(QWidget *parent)
     connect(_ui.nextButton, &QPushButton::clicked, _ui.slideShow, &SlideShow::nextSlide);
     connect(_ui.prevButton, &QPushButton::clicked, _ui.slideShow, &SlideShow::prevSlide);
 
+	_ui.nextButton->setIcon(theme->uiThemeIcon(QString("control-next.svg"), false));
+    _ui.prevButton->setIcon(theme->uiThemeIcon(QString("control-prev.svg"), false));
+
     _ui.slideShow->startShow();
 
     QPalette pal = _ui.slideShow->palette();

+ 8 - 0
src/libsync/theme.cpp

@@ -177,6 +177,14 @@ QIcon Theme::themeIcon(const QString &name, bool sysTray, bool sysTrayMenuVisibl
     return cached;
 }
 
+QIcon Theme::uiThemeIcon(const QString &iconName, bool uiHasDarkBg) const
+{
+    QString themeResBasePath = ":/client/theme/";
+    QString iconPath = themeResBasePath + (uiHasDarkBg?"white/":"black/") + iconName;
+    std::string icnPath = iconPath.toUtf8().constData();
+    return QIcon(QPixmap(iconPath));
+}
+
 QString Theme::hidpiFileName(const QString &fileName, QPaintDevice *dev)
 {
     qreal devicePixelRatio = dev ? dev->devicePixelRatio() : qApp->primaryScreen()->devicePixelRatio();

+ 8 - 0
src/libsync/theme.h

@@ -347,6 +347,14 @@ public:
      * important dependency versions.
      */
     virtual QString versionSwitchOutput() const;
+	
+	/**
+    * @brief Request suitable QIcon resource depending on the background colour of the parent widget.
+    *
+    * This should be replaced (TODO) by a real theming implementation for the client UI 
+    * (actually 2019/09/13 only systray theming).
+    */
+	virtual QIcon uiThemeIcon(const QString &iconName, bool uiHasDarkBg) const;
 
 protected:
 #ifndef TOKEN_AUTH_ONLY