Hide tab texts in Plasmoid by default to avoid problematic overflow behavior
This commit is contained in:
parent
1a71d8b534
commit
99a7bd1a01
|
@ -114,7 +114,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="passiveLabel">
|
<widget class="QLabel" name="passiveLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>States to enable passive mode</string>
|
<string>States to enable passive mode</string>
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QListView" name="passiveListView">
|
<widget class="QListView" name="passiveListView">
|
||||||
<property name="selectionMode">
|
<property name="selectionMode">
|
||||||
<enum>QAbstractItemView::NoSelection</enum>
|
<enum>QAbstractItemView::NoSelection</enum>
|
||||||
|
@ -134,6 +134,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Optional GUI elements</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QCheckBox" name="showTabTextsCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show tab texts</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -91,6 +91,7 @@ bool AppearanceOptionPage::apply()
|
||||||
{
|
{
|
||||||
KConfigGroup config = m_applet->config();
|
KConfigGroup config = m_applet->config();
|
||||||
config.writeEntry<QSize>("size", QSize(ui()->widthSpinBox->value(), ui()->heightSpinBox->value()));
|
config.writeEntry<QSize>("size", QSize(ui()->widthSpinBox->value(), ui()->heightSpinBox->value()));
|
||||||
|
config.writeEntry<bool>("showTabTexts", ui()->showTabTextsCheckBox->isChecked());
|
||||||
config.writeEntry("passiveStates", m_passiveStatusSelection.toVariantList());
|
config.writeEntry("passiveStates", m_passiveStatusSelection.toVariantList());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -102,6 +103,7 @@ void AppearanceOptionPage::reset()
|
||||||
const auto size(config.readEntry<>("size", QSize(25, 25)));
|
const auto size(config.readEntry<>("size", QSize(25, 25)));
|
||||||
ui()->widthSpinBox->setValue(size.width());
|
ui()->widthSpinBox->setValue(size.width());
|
||||||
ui()->heightSpinBox->setValue(size.height());
|
ui()->heightSpinBox->setValue(size.height());
|
||||||
|
ui()->showTabTextsCheckBox->setChecked(config.readEntry<>("showTabTexts", false));
|
||||||
m_passiveStatusSelection.applyVariantList(config.readEntry("passiveStates", QVariantList()));
|
m_passiveStatusSelection.applyVariantList(config.readEntry("passiveStates", QVariantList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ SyncthingApplet::SyncthingApplet(QObject *parent, const QVariantList &data)
|
||||||
, m_currentConnectionConfig(-1)
|
, m_currentConnectionConfig(-1)
|
||||||
, m_hasInternalErrors(false)
|
, m_hasInternalErrors(false)
|
||||||
, m_initialized(false)
|
, m_initialized(false)
|
||||||
|
, m_showTabTexts(false)
|
||||||
{
|
{
|
||||||
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
||||||
m_notifier.setService(&m_service);
|
m_notifier.setService(&m_service);
|
||||||
|
@ -451,6 +452,7 @@ void SyncthingApplet::handleSettingsChanged()
|
||||||
|
|
||||||
// apply appearance settings
|
// apply appearance settings
|
||||||
setSize(config.readEntry<QSize>("size", QSize(25, 25)));
|
setSize(config.readEntry<QSize>("size", QSize(25, 25)));
|
||||||
|
setShowingTabTexts(config.readEntry<bool>("showTabTexts", false));
|
||||||
IconManager::instance().applySettings(&settings.icons.status);
|
IconManager::instance().applySettings(&settings.icons.status);
|
||||||
|
|
||||||
// restore selected states
|
// restore selected states
|
||||||
|
|
|
@ -74,6 +74,7 @@ class SyncthingApplet : public Plasma::Applet {
|
||||||
Q_PROPERTY(bool startStopEnabled READ isStartStopEnabled NOTIFY settingsChanged)
|
Q_PROPERTY(bool startStopEnabled READ isStartStopEnabled NOTIFY settingsChanged)
|
||||||
Q_PROPERTY(bool hasInternalErrors READ hasInternalErrors NOTIFY hasInternalErrorsChanged)
|
Q_PROPERTY(bool hasInternalErrors READ hasInternalErrors NOTIFY hasInternalErrorsChanged)
|
||||||
Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY sizeChanged)
|
Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY sizeChanged)
|
||||||
|
Q_PROPERTY(bool showTabTexts READ isShowingTabTexts WRITE setShowingTabTexts NOTIFY showTabTextsChanged)
|
||||||
Q_PROPERTY(bool notificationsAvailable READ areNotificationsAvailable NOTIFY notificationsAvailableChanged)
|
Q_PROPERTY(bool notificationsAvailable READ areNotificationsAvailable NOTIFY notificationsAvailableChanged)
|
||||||
Q_PROPERTY(bool passive READ isPassive NOTIFY passiveChanged)
|
Q_PROPERTY(bool passive READ isPassive NOTIFY passiveChanged)
|
||||||
Q_PROPERTY(QList<QtUtilities::ChecklistItem> passiveStates READ passiveStates WRITE setPassiveStates)
|
Q_PROPERTY(QList<QtUtilities::ChecklistItem> passiveStates READ passiveStates WRITE setPassiveStates)
|
||||||
|
@ -114,6 +115,8 @@ public:
|
||||||
bool hasInternalErrors() const;
|
bool hasInternalErrors() const;
|
||||||
QSize size() const;
|
QSize size() const;
|
||||||
void setSize(const QSize &size);
|
void setSize(const QSize &size);
|
||||||
|
bool isShowingTabTexts() const;
|
||||||
|
void setShowingTabTexts(bool showTabTexts);
|
||||||
bool areNotificationsAvailable() const;
|
bool areNotificationsAvailable() const;
|
||||||
bool isPassive() const;
|
bool isPassive() const;
|
||||||
const QList<QtUtilities::ChecklistItem> &passiveStates() const;
|
const QList<QtUtilities::ChecklistItem> &passiveStates() const;
|
||||||
|
@ -161,6 +164,7 @@ Q_SIGNALS:
|
||||||
void currentConnectionConfigIndexChanged(int index);
|
void currentConnectionConfigIndexChanged(int index);
|
||||||
void hasInternalErrorsChanged(bool hasInternalErrors);
|
void hasInternalErrorsChanged(bool hasInternalErrors);
|
||||||
void sizeChanged(const QSize &size);
|
void sizeChanged(const QSize &size);
|
||||||
|
void showTabTextsChanged(bool isShowingTabTexts);
|
||||||
void notificationsAvailableChanged(bool notificationsAvailable);
|
void notificationsAvailableChanged(bool notificationsAvailable);
|
||||||
void passiveChanged(bool passive);
|
void passiveChanged(bool passive);
|
||||||
void faUrlChanged(const QString &faUrl);
|
void faUrlChanged(const QString &faUrl);
|
||||||
|
@ -217,6 +221,7 @@ private:
|
||||||
int m_currentConnectionConfig;
|
int m_currentConnectionConfig;
|
||||||
bool m_hasInternalErrors;
|
bool m_hasInternalErrors;
|
||||||
bool m_initialized;
|
bool m_initialized;
|
||||||
|
bool m_showTabTexts;
|
||||||
QSize m_size;
|
QSize m_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -306,6 +311,18 @@ inline void SyncthingApplet::setSize(const QSize &size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool SyncthingApplet::isShowingTabTexts() const
|
||||||
|
{
|
||||||
|
return m_showTabTexts;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SyncthingApplet::setShowingTabTexts(bool showTabTexts)
|
||||||
|
{
|
||||||
|
if (showTabTexts != m_showTabTexts) {
|
||||||
|
emit showTabTextsChanged(m_showTabTexts = showTabTexts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inline bool SyncthingApplet::isPassive() const
|
inline bool SyncthingApplet::isPassive() const
|
||||||
{
|
{
|
||||||
return status() == Plasma::Types::PassiveStatus;
|
return status() == Plasma::Types::PassiveStatus;
|
||||||
|
|
|
@ -1,11 +1,23 @@
|
||||||
import QtQuick 2.8
|
import QtQuick 2.8
|
||||||
|
import QtQuick.Templates 2.15 as T
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents3
|
import org.kde.plasma.components 3.0 as PlasmaComponents3
|
||||||
|
import org.kde.kirigami 2.5 as Kirigami
|
||||||
|
|
||||||
PlasmaComponents3.TabButton {
|
PlasmaComponents3.TabButton {
|
||||||
id: root
|
id: root
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
|
property bool showTabText: plasmoid.nativeInterface.showTabTexts
|
||||||
|
property string tooltip: ""
|
||||||
|
|
||||||
|
PlasmaComponents3.ToolTip {
|
||||||
|
id: tooltip
|
||||||
|
text: root.tooltip !== "" ? root.tooltip : (root.showTabText ? "" : root.text)
|
||||||
|
visible: text !== "" && parent instanceof T.AbstractButton && (Kirigami.Settings.tabletMode ? parent.pressed : parent.hovered)
|
||||||
|
}
|
||||||
|
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
spacing: label.visible ? units.smallSpacing : 0
|
spacing: label.visible ? units.smallSpacing : 0
|
||||||
PlasmaCore.ColorScope.inherit: true
|
PlasmaCore.ColorScope.inherit: true
|
||||||
|
@ -24,7 +36,7 @@ PlasmaComponents3.TabButton {
|
||||||
PlasmaComponents3.Label {
|
PlasmaComponents3.Label {
|
||||||
id: label
|
id: label
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
text: root.text
|
text: root.showTabText ? root.text : ""
|
||||||
color: PlasmaCore.ColorScope.textColor
|
color: PlasmaCore.ColorScope.textColor
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
Loading…
Reference in New Issue