mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix: 修复声音列表显示问题
界面元素边距调整 Log: 修复声音列表显示问题 Bug: https://pms.uniontech.com/zentao/bug-view-81680.html Change-Id: Ie530864da00a221f52329581ee0b5ea1f66f2f7f
This commit is contained in:
parent
fbbc4c3aac
commit
eccb402486
@ -32,13 +32,9 @@ DWIDGET_USE_NAMESPACE
|
|||||||
DockPopupWindow::DockPopupWindow(QWidget *parent)
|
DockPopupWindow::DockPopupWindow(QWidget *parent)
|
||||||
: DArrowRectangle(ArrowBottom, parent),
|
: DArrowRectangle(ArrowBottom, parent),
|
||||||
m_model(false),
|
m_model(false),
|
||||||
m_acceptDelayTimer(new QTimer(this)),
|
|
||||||
m_regionInter(new DRegionMonitor(this))
|
m_regionInter(new DRegionMonitor(this))
|
||||||
{
|
{
|
||||||
setMargin(0);
|
setMargin(0);
|
||||||
m_acceptDelayTimer->setSingleShot(true);
|
|
||||||
m_acceptDelayTimer->setInterval(100);
|
|
||||||
|
|
||||||
m_wmHelper = DWindowManagerHelper::instance();
|
m_wmHelper = DWindowManagerHelper::instance();
|
||||||
|
|
||||||
compositeChanged();
|
compositeChanged();
|
||||||
@ -46,7 +42,6 @@ DockPopupWindow::DockPopupWindow(QWidget *parent)
|
|||||||
setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint | Qt::WindowDoesNotAcceptFocus);
|
setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint | Qt::WindowDoesNotAcceptFocus);
|
||||||
setAttribute(Qt::WA_InputMethodEnabled, false);
|
setAttribute(Qt::WA_InputMethodEnabled, false);
|
||||||
|
|
||||||
connect(m_acceptDelayTimer, &QTimer::timeout, this, &DockPopupWindow::accept);
|
|
||||||
connect(m_wmHelper, &DWindowManagerHelper::hasCompositeChanged, this, &DockPopupWindow::compositeChanged);
|
connect(m_wmHelper, &DWindowManagerHelper::hasCompositeChanged, this, &DockPopupWindow::compositeChanged);
|
||||||
connect(m_regionInter, &DRegionMonitor::buttonPress, this, &DockPopupWindow::onGlobMouseRelease);
|
connect(m_regionInter, &DRegionMonitor::buttonPress, this, &DockPopupWindow::onGlobMouseRelease);
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,6 @@ private:
|
|||||||
bool m_model;
|
bool m_model;
|
||||||
QPoint m_lastPoint;
|
QPoint m_lastPoint;
|
||||||
|
|
||||||
QTimer *m_acceptDelayTimer;
|
|
||||||
|
|
||||||
DRegionMonitor *m_regionInter;
|
DRegionMonitor *m_regionInter;
|
||||||
DWindowManagerHelper *m_wmHelper;
|
DWindowManagerHelper *m_wmHelper;
|
||||||
};
|
};
|
||||||
|
@ -34,11 +34,6 @@ HorizontalSeperator::HorizontalSeperator(QWidget *parent)
|
|||||||
{
|
{
|
||||||
setFixedHeight(2);
|
setFixedHeight(2);
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
|
|
||||||
QPalette palette = this->palette();
|
|
||||||
palette.setColor(QPalette::Light, QColor(0, 0, 0, 0.1 * 255));
|
|
||||||
palette.setColor(QPalette::Dark, QColor(255, 255, 255, 0.1 * 255));
|
|
||||||
this->setPalette(palette);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HorizontalSeperator::paintEvent(QPaintEvent *e)
|
void HorizontalSeperator::paintEvent(QPaintEvent *e)
|
||||||
@ -46,8 +41,7 @@ void HorizontalSeperator::paintEvent(QPaintEvent *e)
|
|||||||
Q_UNUSED(e)
|
Q_UNUSED(e)
|
||||||
|
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType)
|
QColor c = palette().color(QPalette::BrightText);
|
||||||
painter.fillRect(rect(), palette().color(QPalette::Light));
|
c.setAlpha(int(0.1 * 255));
|
||||||
else
|
painter.fillRect(rect(), c);
|
||||||
painter.fillRect(rect(), palette().color(QPalette::Dark));
|
|
||||||
}
|
}
|
||||||
|
@ -1,215 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
|
||||||
*
|
|
||||||
* Author: sbw <sbw@sbw.so>
|
|
||||||
*
|
|
||||||
* Maintainer: sbw <sbw@sbw.so>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sinkinputwidget.h"
|
|
||||||
#include "../frame/util/imageutil.h"
|
|
||||||
#include "../widgets/tipswidget.h"
|
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QIcon>
|
|
||||||
#include <QApplication>
|
|
||||||
|
|
||||||
#include <DHiDPIHelper>
|
|
||||||
#include <DGuiApplicationHelper>
|
|
||||||
#include <DApplication>
|
|
||||||
#include <DLabel>
|
|
||||||
|
|
||||||
#define ICON_SIZE 24
|
|
||||||
#define APP_TITLE_SIZE 110
|
|
||||||
|
|
||||||
DGUI_USE_NAMESPACE
|
|
||||||
using namespace Dock;
|
|
||||||
|
|
||||||
const QPixmap getIconFromTheme(const QString &name, const QSize &size, const qreal ratio)
|
|
||||||
{
|
|
||||||
QPixmap ret = QIcon::fromTheme(name, QIcon::fromTheme("application-x-desktop")).pixmap(size * ratio);
|
|
||||||
ret.setDevicePixelRatio(ratio);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
SinkInputWidget::SinkInputWidget(const QString &inputPath, QWidget *parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
, m_inputInter(new DBusSinkInput("com.deepin.daemon.Audio",inputPath, QDBusConnection::sessionBus(), this))
|
|
||||||
, m_appBtn(new DIconButton(this))
|
|
||||||
, m_volumeIconMin(new QLabel(this))
|
|
||||||
, m_volumeIconMax(new QLabel(this))
|
|
||||||
, m_volumeSlider(new VolumeSlider(this))
|
|
||||||
, m_volumeLabel(new TipsWidget(this))
|
|
||||||
{
|
|
||||||
const QString iconName = m_inputInter->icon();
|
|
||||||
m_appBtn->setAccessibleName("app-" + iconName + "-icon");
|
|
||||||
m_appBtn->setIcon(getIconFromTheme(iconName, QSize(ICON_SIZE, ICON_SIZE), devicePixelRatioF()));
|
|
||||||
m_appBtn->setIconSize(QSize(ICON_SIZE, ICON_SIZE));
|
|
||||||
m_appBtn->setFlat(true);
|
|
||||||
|
|
||||||
DLabel *titleLabel = new DLabel;
|
|
||||||
titleLabel->setForegroundRole(DPalette::TextTitle);
|
|
||||||
titleLabel->setText(titleLabel->fontMetrics().elidedText(m_inputInter->name(), Qt::TextElideMode::ElideRight, APP_TITLE_SIZE));
|
|
||||||
|
|
||||||
m_volumeIconMin->setAccessibleName("volume-button");
|
|
||||||
m_volumeIconMin->setFixedSize(ICON_SIZE, ICON_SIZE);
|
|
||||||
m_volumeIconMax->setFixedSize(ICON_SIZE, ICON_SIZE);
|
|
||||||
|
|
||||||
m_volumeSlider->setAccessibleName("app-" + iconName + "-slider");
|
|
||||||
m_volumeSlider->setMinimum(0);
|
|
||||||
m_volumeSlider->setMaximum(1000);
|
|
||||||
|
|
||||||
// 应用图标+名称
|
|
||||||
QHBoxLayout *appLayout = new QHBoxLayout();
|
|
||||||
appLayout->setAlignment(Qt::AlignLeft);
|
|
||||||
appLayout->addWidget(m_appBtn);
|
|
||||||
appLayout->addSpacing(10);
|
|
||||||
appLayout->addWidget(titleLabel);
|
|
||||||
appLayout->addStretch();
|
|
||||||
appLayout->addWidget(m_volumeLabel, 0, Qt::AlignRight);
|
|
||||||
appLayout->setSpacing(0);
|
|
||||||
appLayout->setMargin(0);
|
|
||||||
|
|
||||||
// 音量图标+slider
|
|
||||||
QHBoxLayout *volumeCtrlLayout = new QHBoxLayout;
|
|
||||||
volumeCtrlLayout->addSpacing(2);
|
|
||||||
volumeCtrlLayout->addWidget(m_volumeIconMin);
|
|
||||||
volumeCtrlLayout->addSpacing(10);
|
|
||||||
volumeCtrlLayout->addWidget(m_volumeSlider);
|
|
||||||
volumeCtrlLayout->addSpacing(10);
|
|
||||||
volumeCtrlLayout->addWidget(m_volumeIconMax);
|
|
||||||
volumeCtrlLayout->setSpacing(0);
|
|
||||||
volumeCtrlLayout->setMargin(0);
|
|
||||||
|
|
||||||
QVBoxLayout *centralLayout = new QVBoxLayout;
|
|
||||||
centralLayout->addLayout(appLayout);
|
|
||||||
centralLayout->addSpacing(6);
|
|
||||||
centralLayout->addLayout(volumeCtrlLayout);
|
|
||||||
centralLayout->setSpacing(2);
|
|
||||||
centralLayout->setMargin(0);
|
|
||||||
|
|
||||||
connect(m_volumeSlider, &VolumeSlider::valueChanged, this, &SinkInputWidget::setVolume);
|
|
||||||
connect(m_volumeSlider, &VolumeSlider::valueChanged, this, &SinkInputWidget::onVolumeChanged);
|
|
||||||
connect(m_inputInter, &DBusSinkInput::MuteChanged, this, &SinkInputWidget::setMuteIcon);
|
|
||||||
connect(m_inputInter, &DBusSinkInput::VolumeChanged, this, [ = ] {
|
|
||||||
m_volumeSlider->setValue(m_inputInter->volume() * 1000);
|
|
||||||
QString str = QString::number(int(m_inputInter->volume() * 100)) + '%';
|
|
||||||
m_volumeLabel->setText(str);
|
|
||||||
refreshIcon();
|
|
||||||
});
|
|
||||||
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &SinkInputWidget::refreshIcon);
|
|
||||||
connect(qApp, &DApplication::iconThemeChanged, this, &SinkInputWidget::refreshIcon);
|
|
||||||
|
|
||||||
setLayout(centralLayout);
|
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
||||||
setFixedHeight(60);
|
|
||||||
m_volumeIconMin->installEventFilter(this);
|
|
||||||
|
|
||||||
setMuteIcon();
|
|
||||||
refreshIcon();
|
|
||||||
onVolumeChanged();
|
|
||||||
|
|
||||||
emit m_inputInter->VolumeChanged(m_inputInter->volume());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SinkInputWidget::setVolume(const int value)
|
|
||||||
{
|
|
||||||
m_inputInter->SetVolumeQueued(double(value) / 1000.0, false);
|
|
||||||
refreshIcon();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SinkInputWidget::setMute()
|
|
||||||
{
|
|
||||||
m_inputInter->SetMuteQueued(!m_inputInter->mute());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SinkInputWidget::setMuteIcon()
|
|
||||||
{
|
|
||||||
if (m_inputInter->mute()) {
|
|
||||||
const auto ratio = devicePixelRatioF();
|
|
||||||
QString iconString = "audio-volume-muted-symbolic";
|
|
||||||
if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) {
|
|
||||||
iconString.append("-dark");
|
|
||||||
}
|
|
||||||
QPixmap muteIcon = QIcon::fromTheme(iconString).pixmap(ICON_SIZE * ratio, ICON_SIZE * ratio);
|
|
||||||
muteIcon.setDevicePixelRatio(ratio);
|
|
||||||
QPixmap appIconSource(getIconFromTheme(m_inputInter->icon(), QSize(ICON_SIZE, ICON_SIZE), devicePixelRatioF()));
|
|
||||||
|
|
||||||
QPixmap temp(appIconSource.size());
|
|
||||||
temp.fill(Qt::transparent);
|
|
||||||
temp.setDevicePixelRatio(ratio);
|
|
||||||
QPainter p1(&temp);
|
|
||||||
p1.drawPixmap(0, 0, appIconSource);
|
|
||||||
p1.setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
|
||||||
p1.fillRect(temp.rect(), QColor(0, 0, 0, 40));
|
|
||||||
p1.end();
|
|
||||||
appIconSource = temp;
|
|
||||||
|
|
||||||
QPainter p(&appIconSource);
|
|
||||||
p.drawPixmap(0, 0, muteIcon);
|
|
||||||
|
|
||||||
appIconSource.setDevicePixelRatio(ratio);
|
|
||||||
m_volumeIconMin->setPixmap(appIconSource);
|
|
||||||
} else {
|
|
||||||
m_volumeIconMin->setPixmap(getIconFromTheme(m_inputInter->icon(), QSize(ICON_SIZE, ICON_SIZE), devicePixelRatioF()));
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshIcon();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SinkInputWidget::onPlaySoundEffect()
|
|
||||||
{
|
|
||||||
// set the mute property to false to play sound effects.
|
|
||||||
m_inputInter->SetMuteQueued(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SinkInputWidget::refreshIcon()
|
|
||||||
{
|
|
||||||
if (!m_inputInter)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QString iconLeft = QString(m_inputInter->mute() ? "audio-volume-muted-symbolic" : "audio-volume-low-symbolic");
|
|
||||||
QString iconRight = QString("audio-volume-high-symbolic");
|
|
||||||
|
|
||||||
if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) {
|
|
||||||
iconLeft.append("-dark");
|
|
||||||
iconRight.append("-dark");
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto ratio = devicePixelRatioF();
|
|
||||||
QPixmap ret = ImageUtil::loadSvg(iconRight, ":/", ICON_SIZE, ratio);
|
|
||||||
m_volumeIconMax->setPixmap(ret);
|
|
||||||
|
|
||||||
ret = ImageUtil::loadSvg(iconLeft, ":/", ICON_SIZE, ratio);
|
|
||||||
m_volumeIconMin->setPixmap(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SinkInputWidget::eventFilter(QObject *watcher, QEvent *event)
|
|
||||||
{
|
|
||||||
if (watcher == m_volumeIconMin) {
|
|
||||||
if (event->type() == QEvent::MouseButtonPress) {
|
|
||||||
setMute();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SinkInputWidget:: onVolumeChanged()
|
|
||||||
{
|
|
||||||
QString str = QString::number(int(m_inputInter->volume() * 100)) + '%';
|
|
||||||
m_volumeLabel->setText(str);
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
|
||||||
*
|
|
||||||
* Author: sbw <sbw@sbw.so>
|
|
||||||
*
|
|
||||||
* Maintainer: sbw <sbw@sbw.so>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SINKINPUTWIDGET_H
|
|
||||||
#define SINKINPUTWIDGET_H
|
|
||||||
|
|
||||||
#include "componments/volumeslider.h"
|
|
||||||
#include <com_deepin_daemon_audio_sinkinput.h>
|
|
||||||
|
|
||||||
#include <QFrame>
|
|
||||||
#include <QPainter>
|
|
||||||
|
|
||||||
#include <DIconButton>
|
|
||||||
|
|
||||||
DWIDGET_USE_NAMESPACE
|
|
||||||
using DBusSinkInput = com::deepin::daemon::audio::SinkInput;
|
|
||||||
namespace Dock {
|
|
||||||
class TipsWidget;
|
|
||||||
}
|
|
||||||
class QLabel;
|
|
||||||
class SinkInputWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit SinkInputWidget(const QString &inputPath, QWidget *parent = nullptr);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void setVolume(const int value);
|
|
||||||
void setMute();
|
|
||||||
void setMuteIcon();
|
|
||||||
void onPlaySoundEffect();
|
|
||||||
void onVolumeChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void refreshIcon();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject* watcher, QEvent *event) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
DBusSinkInput *m_inputInter;
|
|
||||||
|
|
||||||
DIconButton *m_appBtn;
|
|
||||||
QLabel *m_volumeIconMin;
|
|
||||||
QLabel *m_volumeIconMax;
|
|
||||||
VolumeSlider *m_volumeSlider;
|
|
||||||
Dock::TipsWidget *m_volumeLabel;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // SINKINPUTWIDGET_H
|
|
@ -4,12 +4,10 @@
|
|||||||
|
|
||||||
#include "sounditem.h"
|
#include "sounditem.h"
|
||||||
#include "soundapplet.h"
|
#include "soundapplet.h"
|
||||||
#include "sinkinputwidget.h"
|
|
||||||
#include "./componments/volumeslider.h"
|
#include "./componments/volumeslider.h"
|
||||||
|
|
||||||
SET_BUTTON_ACCESSIBLE(SoundItem, "plugin-sounditem")
|
SET_BUTTON_ACCESSIBLE(SoundItem, "plugin-sounditem")
|
||||||
SET_FORM_ACCESSIBLE(SoundApplet, "soundapplet")
|
SET_FORM_ACCESSIBLE(SoundApplet, "soundapplet")
|
||||||
SET_FORM_ACCESSIBLE(SinkInputWidget, "sinkinputwidget")
|
|
||||||
SET_SLIDER_ACCESSIBLE(VolumeSlider, "volumeslider")
|
SET_SLIDER_ACCESSIBLE(VolumeSlider, "volumeslider")
|
||||||
|
|
||||||
QAccessibleInterface *soundAccessibleFactory(const QString &classname, QObject *object)
|
QAccessibleInterface *soundAccessibleFactory(const QString &classname, QObject *object)
|
||||||
@ -18,7 +16,6 @@ QAccessibleInterface *soundAccessibleFactory(const QString &classname, QObject *
|
|||||||
|
|
||||||
USE_ACCESSIBLE(classname, SoundItem);
|
USE_ACCESSIBLE(classname, SoundItem);
|
||||||
USE_ACCESSIBLE(classname, SoundApplet);
|
USE_ACCESSIBLE(classname, SoundApplet);
|
||||||
USE_ACCESSIBLE(classname, SinkInputWidget);
|
|
||||||
USE_ACCESSIBLE(classname, VolumeSlider);
|
USE_ACCESSIBLE(classname, VolumeSlider);
|
||||||
|
|
||||||
return interface;
|
return interface;
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "soundapplet.h"
|
#include "soundapplet.h"
|
||||||
#include "sinkinputwidget.h"
|
|
||||||
#include "util/horizontalseperator.h"
|
#include "util/horizontalseperator.h"
|
||||||
#include "../widgets/tipswidget.h"
|
#include "../widgets/tipswidget.h"
|
||||||
#include "../frame/util/imageutil.h"
|
#include "../frame/util/imageutil.h"
|
||||||
@ -43,7 +42,8 @@
|
|||||||
#define ITEM_HEIGHT 24
|
#define ITEM_HEIGHT 24
|
||||||
#define ITEM_SPACING 5
|
#define ITEM_SPACING 5
|
||||||
#define DEVICE_SPACING 10
|
#define DEVICE_SPACING 10
|
||||||
#define SLIDER_HIGHT 32
|
#define SLIDER_HIGHT 70
|
||||||
|
#define TITLE_HEIGHT 46
|
||||||
#define GSETTING_SOUND_OUTPUT_SLIDER "soundOutputSlider"
|
#define GSETTING_SOUND_OUTPUT_SLIDER "soundOutputSlider"
|
||||||
|
|
||||||
DWIDGET_USE_NAMESPACE
|
DWIDGET_USE_NAMESPACE
|
||||||
@ -111,13 +111,13 @@ void Port::setCardId(const uint &cardId)
|
|||||||
SoundApplet::SoundApplet(QWidget *parent)
|
SoundApplet::SoundApplet(QWidget *parent)
|
||||||
: QScrollArea(parent)
|
: QScrollArea(parent)
|
||||||
, m_centralWidget(new QWidget(this))
|
, m_centralWidget(new QWidget(this))
|
||||||
, m_volumeBtn(new DIconButton(this))
|
, m_volumeIconMin(new DIconButton(this))
|
||||||
, m_volumeIconMax(new QLabel(this))
|
, m_volumeIconMax(new QLabel(this))
|
||||||
, m_volumeSlider(new VolumeSlider(this))
|
, m_volumeSlider(new VolumeSlider(this))
|
||||||
, m_soundShow(new TipsWidget(this))
|
, m_soundShow(new QLabel(this))
|
||||||
|
, m_deviceLabel(new QLabel(this))
|
||||||
, m_seperator(new HorizontalSeperator(this))
|
, m_seperator(new HorizontalSeperator(this))
|
||||||
, m_secondSeperator(new HorizontalSeperator(this))
|
, m_secondSeperator(new HorizontalSeperator(this))
|
||||||
, m_deviceLabel(nullptr)
|
|
||||||
, m_audioInter(new DBusAudio("com.deepin.daemon.Audio", "/com/deepin/daemon/Audio", QDBusConnection::sessionBus(), this))
|
, m_audioInter(new DBusAudio("com.deepin.daemon.Audio", "/com/deepin/daemon/Audio", QDBusConnection::sessionBus(), this))
|
||||||
, m_defSinkInter(nullptr)
|
, m_defSinkInter(nullptr)
|
||||||
, m_listView(new DListView(this))
|
, m_listView(new DListView(this))
|
||||||
@ -130,45 +130,45 @@ SoundApplet::SoundApplet(QWidget *parent)
|
|||||||
initUi();
|
initUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
///**
|
||||||
* @brief SoundApplet::setControlBackground 设置音频界面控件背景颜色
|
// * @brief SoundApplet::setControlBackground 设置音频界面控件背景颜色
|
||||||
*/
|
// */
|
||||||
void SoundApplet::setControlBackground()
|
//void SoundApplet::setControlBackground()
|
||||||
{
|
//{
|
||||||
QPalette soundAppletBackgroud;
|
// QPalette soundAppletBackgroud;
|
||||||
QPalette listViewBackgroud = m_listView->palette();
|
// QPalette listViewBackgroud = m_listView->palette();
|
||||||
if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType)
|
// if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType)
|
||||||
soundAppletBackgroud.setColor(QPalette::Background, QColor(255, 255, 255, 0.03 * 255));
|
// soundAppletBackgroud.setColor(QPalette::Background, QColor(255, 255, 255, 0.03 * 255));
|
||||||
else
|
// else
|
||||||
soundAppletBackgroud.setColor(QPalette::Background, QColor(0, 0, 0, 0.03 * 255));
|
// soundAppletBackgroud.setColor(QPalette::Background, QColor(0, 0, 0, 0.03 * 255));
|
||||||
|
|
||||||
this->setAutoFillBackground(true);
|
// this->setAutoFillBackground(true);
|
||||||
this->setPalette(soundAppletBackgroud);
|
// this->setPalette(soundAppletBackgroud);
|
||||||
listViewBackgroud.setColor(QPalette::Base, Qt::transparent);
|
// listViewBackgroud.setColor(QPalette::Base, Qt::transparent);
|
||||||
m_listView->setAutoFillBackground(true);
|
// m_listView->setAutoFillBackground(true);
|
||||||
m_listView->setPalette(listViewBackgroud);
|
// m_listView->setPalette(listViewBackgroud);
|
||||||
}
|
//}
|
||||||
|
|
||||||
/**
|
///**
|
||||||
* @brief SoundApplet::setItemHoverColor 通过代理方式根据当前主题设置音频列表文字颜色和item选中颜色
|
// * @brief SoundApplet::setItemHoverColor 通过代理方式根据当前主题设置音频列表文字颜色和item选中颜色
|
||||||
*/
|
// */
|
||||||
void SoundApplet::setItemHoverColor()
|
//void SoundApplet::setItemHoverColor()
|
||||||
{
|
//{
|
||||||
QPalette hoverBackgroud = m_listView->palette();
|
// QPalette hoverBackgroud = m_listView->palette();
|
||||||
if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) {
|
// if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) {
|
||||||
hoverBackgroud.setColor(QPalette::Normal, QPalette::Highlight, QColor(0, 0, 0, 30));
|
// hoverBackgroud.setColor(QPalette::Normal, QPalette::Highlight, QColor(0, 0, 0, 30));
|
||||||
hoverBackgroud.setColor(QPalette::Normal, QPalette::HighlightedText, QColor(0, 0, 0, 255));
|
// hoverBackgroud.setColor(QPalette::Normal, QPalette::HighlightedText, QColor(0, 0, 0, 255));
|
||||||
} else {
|
// } else {
|
||||||
hoverBackgroud.setColor(QPalette::Normal, QPalette::Highlight, QColor(255, 255, 255, 30));
|
// hoverBackgroud.setColor(QPalette::Normal, QPalette::Highlight, QColor(255, 255, 255, 30));
|
||||||
hoverBackgroud.setColor(QPalette::Normal, QPalette::HighlightedText, QColor(255, 255, 255, 255));
|
// hoverBackgroud.setColor(QPalette::Normal, QPalette::HighlightedText, QColor(255, 255, 255, 255));
|
||||||
}
|
// }
|
||||||
m_listView->setPalette(hoverBackgroud);
|
// m_listView->setPalette(hoverBackgroud);
|
||||||
m_listView->setItemDelegate(m_itemDelegate);
|
// m_listView->setItemDelegate(m_itemDelegate);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void SoundApplet::initUi()
|
void SoundApplet::initUi()
|
||||||
{
|
{
|
||||||
setControlBackground();
|
// setControlBackground();
|
||||||
m_listView->setEditTriggers(DListView::NoEditTriggers);
|
m_listView->setEditTriggers(DListView::NoEditTriggers);
|
||||||
m_listView->setSelectionMode(QAbstractItemView::NoSelection);
|
m_listView->setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
m_listView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
m_listView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
@ -176,77 +176,62 @@ void SoundApplet::initUi()
|
|||||||
m_listView->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
m_listView->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
||||||
m_listView->setFixedHeight(0);
|
m_listView->setFixedHeight(0);
|
||||||
m_listView->setItemSpacing(1);
|
m_listView->setItemSpacing(1);
|
||||||
|
m_listView->setModel(m_model);
|
||||||
|
|
||||||
m_centralWidget->setAccessibleName("volumn-centralwidget");
|
m_centralWidget->setAccessibleName("volumn-centralwidget");
|
||||||
m_volumeBtn->setAccessibleName("volume-button");
|
m_volumeIconMin->setAccessibleName("volume-button");
|
||||||
m_volumeIconMax->setAccessibleName("volume-iconmax");
|
m_volumeIconMax->setAccessibleName("volume-iconmax");
|
||||||
m_volumeSlider->setAccessibleName("volume-slider");
|
m_volumeSlider->setAccessibleName("volume-slider");
|
||||||
m_soundShow->setAccessibleName("volume-soundtips");
|
m_soundShow->setAccessibleName("volume-soundtips");
|
||||||
this->horizontalScrollBar()->setAccessibleName("volume-horizontalscrollbar");
|
horizontalScrollBar()->setAccessibleName("volume-horizontalscrollbar");
|
||||||
this->verticalScrollBar()->setAccessibleName("volume-verticalscrollbar");
|
verticalScrollBar()->setAccessibleName("volume-verticalscrollbar");
|
||||||
|
|
||||||
|
m_volumeIconMin->setFixedSize(ICON_SIZE, ICON_SIZE);
|
||||||
|
m_volumeIconMin->setIconSize(QSize(ICON_SIZE, ICON_SIZE));
|
||||||
|
m_volumeIconMin->setFlat(true);
|
||||||
m_volumeIconMax->setFixedSize(ICON_SIZE, ICON_SIZE);
|
m_volumeIconMax->setFixedSize(ICON_SIZE, ICON_SIZE);
|
||||||
|
|
||||||
m_soundShow->setText(QString("%1%").arg(0));
|
m_soundShow->setText(QString("%1%").arg(0));
|
||||||
|
m_soundShow->setFixedHeight(TITLE_HEIGHT);
|
||||||
|
m_soundShow->setForegroundRole(QPalette::BrightText);
|
||||||
|
DFontSizeManager::instance()->bind(m_soundShow, DFontSizeManager::T4, QFont::Medium);
|
||||||
|
|
||||||
m_deviceLabel = new TipsWidget(this);
|
|
||||||
m_deviceLabel->setText(tr("Device"));
|
m_deviceLabel->setText(tr("Device"));
|
||||||
|
m_deviceLabel->setFixedHeight(TITLE_HEIGHT);
|
||||||
|
m_deviceLabel->setForegroundRole(QPalette::BrightText);
|
||||||
DFontSizeManager::instance()->bind(m_deviceLabel, DFontSizeManager::T4, QFont::Medium);
|
DFontSizeManager::instance()->bind(m_deviceLabel, DFontSizeManager::T4, QFont::Medium);
|
||||||
|
|
||||||
QHBoxLayout *deviceLayout = new QHBoxLayout;
|
|
||||||
deviceLayout->addSpacing(2);
|
|
||||||
deviceLayout->addWidget(m_deviceLabel, 0, Qt::AlignLeft);
|
|
||||||
deviceLayout->addWidget(m_soundShow, 0, Qt::AlignRight);
|
|
||||||
deviceLayout->setSpacing(0);
|
|
||||||
deviceLayout->setMargin(0);
|
|
||||||
|
|
||||||
QVBoxLayout *deviceLineLayout = new QVBoxLayout;
|
|
||||||
deviceLineLayout->addLayout(deviceLayout);
|
|
||||||
deviceLineLayout->addWidget(m_seperator);
|
|
||||||
deviceLineLayout->setMargin(0);
|
|
||||||
deviceLineLayout->setSpacing(DEVICE_SPACING);
|
|
||||||
|
|
||||||
QHBoxLayout *volumeCtrlLayout = new QHBoxLayout;
|
|
||||||
volumeCtrlLayout->addSpacing(8);
|
|
||||||
volumeCtrlLayout->addWidget(m_volumeBtn);
|
|
||||||
volumeCtrlLayout->addSpacing(10);
|
|
||||||
volumeCtrlLayout->addWidget(m_volumeSlider);
|
|
||||||
volumeCtrlLayout->addSpacing(10);
|
|
||||||
volumeCtrlLayout->addWidget(m_volumeIconMax);
|
|
||||||
volumeCtrlLayout->addSpacing(8);
|
|
||||||
volumeCtrlLayout->setSpacing(0);
|
|
||||||
volumeCtrlLayout->setMargin(0);
|
|
||||||
|
|
||||||
//音频界面添加第二个分割线
|
|
||||||
QVBoxLayout *volumeLineLayout = new QVBoxLayout;
|
|
||||||
volumeLineLayout->addLayout(volumeCtrlLayout);
|
|
||||||
volumeLineLayout->addWidget(m_secondSeperator);
|
|
||||||
volumeLineLayout->setMargin(0);
|
|
||||||
|
|
||||||
m_volumeBtn->setFixedSize(ICON_SIZE, ICON_SIZE);
|
|
||||||
m_volumeBtn->setIconSize(QSize(ICON_SIZE, ICON_SIZE));
|
|
||||||
m_volumeBtn->setFlat(true);
|
|
||||||
|
|
||||||
m_volumeSlider->setFixedHeight(SLIDER_HIGHT);
|
m_volumeSlider->setFixedHeight(SLIDER_HIGHT);
|
||||||
m_volumeSlider->setMinimum(0);
|
m_volumeSlider->setMinimum(0);
|
||||||
m_volumeSlider->setMaximum(m_audioInter->maxUIVolume() * 100.0f);
|
m_volumeSlider->setMaximum(m_audioInter->maxUIVolume() * 100.0f);
|
||||||
updateVolumeSliderStatus(Utils::SettingValue("com.deepin.dde.dock.module.sound", QByteArray(), "Enabled").toString());
|
|
||||||
connect(m_gsettings, &QGSettings::changed, [ = ] (const QString &key) {
|
// 标题部分
|
||||||
if (key == GSETTING_SOUND_OUTPUT_SLIDER) {
|
QHBoxLayout *deviceLayout = new QHBoxLayout;
|
||||||
updateVolumeSliderStatus(m_gsettings->get(GSETTING_SOUND_OUTPUT_SLIDER).toString());
|
deviceLayout->setSpacing(0);
|
||||||
}
|
deviceLayout->setContentsMargins(20, 0, 10, 0);
|
||||||
});
|
deviceLayout->addWidget(m_deviceLabel, 0, Qt::AlignLeft);
|
||||||
|
deviceLayout->addWidget(m_soundShow, 0, Qt::AlignRight);
|
||||||
|
|
||||||
|
// 音量滑动条
|
||||||
|
QHBoxLayout *volumeCtrlLayout = new QHBoxLayout;
|
||||||
|
volumeCtrlLayout->setSpacing(0);
|
||||||
|
volumeCtrlLayout->setContentsMargins(12, 0, 12, 0);
|
||||||
|
volumeCtrlLayout->addWidget(m_volumeIconMin);
|
||||||
|
volumeCtrlLayout->addWidget(m_volumeSlider);
|
||||||
|
volumeCtrlLayout->addWidget(m_volumeIconMax);
|
||||||
|
|
||||||
m_centralLayout = new QVBoxLayout(this);
|
m_centralLayout = new QVBoxLayout(this);
|
||||||
m_centralLayout->setMargin(0);
|
m_centralLayout->setMargin(0);
|
||||||
m_centralLayout->setSpacing(0);
|
m_centralLayout->setSpacing(0);
|
||||||
m_centralLayout->addLayout(deviceLineLayout);
|
m_centralLayout->addLayout(deviceLayout);
|
||||||
m_centralLayout->addLayout(volumeLineLayout);
|
m_centralLayout->addWidget(m_seperator);
|
||||||
m_centralLayout->setContentsMargins(8, 8, 8, 0);
|
m_centralLayout->addLayout(volumeCtrlLayout);
|
||||||
|
// 需要判断是否有声音端口
|
||||||
|
m_centralLayout->addWidget(m_secondSeperator);
|
||||||
|
m_secondSeperator->setVisible(m_model->rowCount() > 0);
|
||||||
|
|
||||||
m_listView->setModel(m_model);
|
// setItemHoverColor();
|
||||||
setItemHoverColor();
|
m_centralLayout->setContentsMargins(0, 0, 0, 10);
|
||||||
m_centralLayout->setMargin(0);
|
|
||||||
m_centralLayout->setSpacing(0);
|
m_centralLayout->setSpacing(0);
|
||||||
m_centralLayout->addWidget(m_listView);
|
m_centralLayout->addWidget(m_listView);
|
||||||
m_centralWidget->setLayout(m_centralLayout);
|
m_centralWidget->setLayout(m_centralLayout);
|
||||||
@ -261,10 +246,17 @@ void SoundApplet::initUi()
|
|||||||
m_centralWidget->setAutoFillBackground(false);
|
m_centralWidget->setAutoFillBackground(false);
|
||||||
viewport()->setAutoFillBackground(false);
|
viewport()->setAutoFillBackground(false);
|
||||||
|
|
||||||
|
updateVolumeSliderStatus(Utils::SettingValue("com.deepin.dde.dock.module.sound", QByteArray(), "Enabled").toString());
|
||||||
|
connect(m_gsettings, &QGSettings::changed, [ = ] (const QString &key) {
|
||||||
|
if (key == GSETTING_SOUND_OUTPUT_SLIDER) {
|
||||||
|
updateVolumeSliderStatus(m_gsettings->get(GSETTING_SOUND_OUTPUT_SLIDER).toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connect(m_volumeIconMin, &DIconButton::clicked, this, [ = ] {
|
||||||
|
m_defSinkInter->SetMuteQueued(!m_defSinkInter->mute());
|
||||||
|
});
|
||||||
connect(qApp, &QGuiApplication::fontChanged, this, &SoundApplet::updateListHeight);
|
connect(qApp, &QGuiApplication::fontChanged, this, &SoundApplet::updateListHeight);
|
||||||
connect(m_volumeBtn, &DIconButton::clicked, this, &SoundApplet::toggleMute);
|
|
||||||
connect(m_volumeSlider, &VolumeSlider::valueChanged, this, &SoundApplet::volumeSliderValueChanged);
|
connect(m_volumeSlider, &VolumeSlider::valueChanged, this, &SoundApplet::volumeSliderValueChanged);
|
||||||
connect(m_volumeSlider, &VolumeSlider::requestPlaySoundEffect, this, &SoundApplet::onPlaySoundEffect);
|
|
||||||
connect(m_audioInter, &DBusAudio::DefaultSinkChanged, this, static_cast<void (SoundApplet::*)()>(&SoundApplet::defaultSinkChanged));
|
connect(m_audioInter, &DBusAudio::DefaultSinkChanged, this, static_cast<void (SoundApplet::*)()>(&SoundApplet::defaultSinkChanged));
|
||||||
connect(m_audioInter, &DBusAudio::IncreaseVolumeChanged, this, &SoundApplet::increaseVolumeChanged);
|
connect(m_audioInter, &DBusAudio::IncreaseVolumeChanged, this, &SoundApplet::increaseVolumeChanged);
|
||||||
connect(m_audioInter, &DBusAudio::PortEnabledChanged, [this](uint cardId, QString portId) {
|
connect(m_audioInter, &DBusAudio::PortEnabledChanged, [this](uint cardId, QString portId) {
|
||||||
@ -352,25 +344,6 @@ void SoundApplet::volumeSliderValueChanged()
|
|||||||
m_defSinkInter->SetMuteQueued(false);
|
m_defSinkInter->SetMuteQueued(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundApplet::sinkInputsChanged()
|
|
||||||
{
|
|
||||||
m_centralWidget->setVisible(false);
|
|
||||||
QVBoxLayout *appLayout = m_centralLayout;
|
|
||||||
while (QLayoutItem *item = appLayout->takeAt(4)) {
|
|
||||||
delete item->widget();
|
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto input : m_audioInter->sinkInputs()) {
|
|
||||||
appLayout->addWidget(new HorizontalSeperator(this));
|
|
||||||
|
|
||||||
SinkInputWidget *si = new SinkInputWidget(input.path());
|
|
||||||
appLayout->addWidget(si);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_centralWidget->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SoundApplet::cardsChanged(const QString &cards)
|
void SoundApplet::cardsChanged(const QString &cards)
|
||||||
{
|
{
|
||||||
QMap<uint, QStringList> tmpCardIds;
|
QMap<uint, QStringList> tmpCardIds;
|
||||||
@ -434,15 +407,6 @@ void SoundApplet::cardsChanged(const QString &cards)
|
|||||||
removeLastDevice();
|
removeLastDevice();
|
||||||
updateListHeight();
|
updateListHeight();
|
||||||
}
|
}
|
||||||
void SoundApplet::toggleMute()
|
|
||||||
{
|
|
||||||
m_defSinkInter->SetMuteQueued(!m_defSinkInter->mute());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SoundApplet::onPlaySoundEffect()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void SoundApplet::increaseVolumeChanged()
|
void SoundApplet::increaseVolumeChanged()
|
||||||
{
|
{
|
||||||
@ -478,20 +442,20 @@ void SoundApplet::refreshIcon()
|
|||||||
color = Qt::white;
|
color = Qt::white;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
setControlBackground();
|
// setControlBackground();
|
||||||
//主题改变时,同步修改item颜色
|
//主题改变时,同步修改item颜色
|
||||||
for (int i = 0; i < m_model->rowCount(); i++) {
|
for (int i = 0; i < m_model->rowCount(); i++) {
|
||||||
auto item = m_model->item(i);
|
auto item = m_model->item(i);
|
||||||
item->setForeground(color);
|
item->setForeground(color);
|
||||||
item->setBackground(Qt::transparent);
|
item->setBackground(Qt::transparent);
|
||||||
}
|
}
|
||||||
setItemHoverColor();
|
// setItemHoverColor();
|
||||||
const auto ratio = devicePixelRatioF();
|
const auto ratio = devicePixelRatioF();
|
||||||
QPixmap ret = ImageUtil::loadSvg(iconRight, ":/", ICON_SIZE, ratio);
|
QPixmap ret = ImageUtil::loadSvg(iconRight, ":/", ICON_SIZE, ratio);
|
||||||
m_volumeIconMax->setPixmap(ret);
|
m_volumeIconMax->setPixmap(ret);
|
||||||
|
|
||||||
ret = ImageUtil::loadSvg(iconLeft, ":/", ICON_SIZE, ratio);
|
ret = ImageUtil::loadSvg(iconLeft, ":/", ICON_SIZE, ratio);
|
||||||
m_volumeBtn->setIcon(ret);
|
m_volumeIconMin->setIcon(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -563,6 +527,8 @@ void SoundApplet::addPort(const Port *port)
|
|||||||
}
|
}
|
||||||
m_model->appendRow(pi);
|
m_model->appendRow(pi);
|
||||||
m_model->sort(0);
|
m_model->sort(0);
|
||||||
|
m_secondSeperator->setVisible(m_model->rowCount() > 0);
|
||||||
|
updateListHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundApplet::removePort(const QString &portId, const uint &cardId)
|
void SoundApplet::removePort(const QString &portId, const uint &cardId)
|
||||||
@ -581,6 +547,8 @@ void SoundApplet::removePort(const QString &portId, const uint &cardId)
|
|||||||
};
|
};
|
||||||
|
|
||||||
rmFunc(m_model);
|
rmFunc(m_model);
|
||||||
|
m_secondSeperator->setVisible(m_model->rowCount() > 0);
|
||||||
|
updateListHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -619,7 +587,7 @@ void SoundApplet::enableDevice(bool flag)
|
|||||||
} else if ("Enabled" == status) {
|
} else if ("Enabled" == status) {
|
||||||
m_volumeSlider->setEnabled(flag);
|
m_volumeSlider->setEnabled(flag);
|
||||||
}
|
}
|
||||||
m_volumeBtn->setEnabled(flag);
|
m_volumeIconMin->setEnabled(flag);
|
||||||
m_soundShow->setEnabled(flag);
|
m_soundShow->setEnabled(flag);
|
||||||
m_volumeIconMax->setEnabled(flag);
|
m_volumeIconMax->setEnabled(flag);
|
||||||
m_deviceLabel->setEnabled(flag);
|
m_deviceLabel->setEnabled(flag);
|
||||||
@ -674,12 +642,12 @@ void SoundApplet::updateVolumeSliderStatus(const QString &status)
|
|||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
m_volumeSlider->setEnabled(flag);
|
m_volumeSlider->setEnabled(flag);
|
||||||
m_volumeBtn->setEnabled(flag);
|
m_volumeIconMin->setEnabled(flag);
|
||||||
m_volumeIconMax->setEnabled(flag);
|
m_volumeIconMax->setEnabled(flag);
|
||||||
|
|
||||||
flag = "Hiden" != status;
|
flag = "Hiden" != status;
|
||||||
m_volumeSlider->setVisible(flag);
|
m_volumeSlider->setVisible(flag);
|
||||||
m_volumeBtn->setVisible(flag);
|
m_volumeIconMin->setVisible(flag);
|
||||||
m_volumeIconMax->setVisible(flag);
|
m_volumeIconMax->setVisible(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -694,6 +662,7 @@ void SoundApplet::updateListHeight()
|
|||||||
{
|
{
|
||||||
//设备数多于10个时显示滚动条,固定高度
|
//设备数多于10个时显示滚动条,固定高度
|
||||||
int count = m_model->rowCount();
|
int count = m_model->rowCount();
|
||||||
|
|
||||||
if (m_model->rowCount() > 10) {
|
if (m_model->rowCount() > 10) {
|
||||||
count = 10;
|
count = 10;
|
||||||
m_listView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
m_listView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
|
@ -110,8 +110,8 @@ public:
|
|||||||
Port *findPort(const QString &portId, const uint &cardId) const;
|
Port *findPort(const QString &portId, const uint &cardId) const;
|
||||||
void setUnchecked(DStandardItem *pi);
|
void setUnchecked(DStandardItem *pi);
|
||||||
void initUi();
|
void initUi();
|
||||||
void setItemHoverColor();
|
// void setItemHoverColor();
|
||||||
void setControlBackground();
|
// void setControlBackground();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void volumeChanged(const int value) const;
|
void volumeChanged(const int value) const;
|
||||||
@ -121,9 +121,6 @@ private slots:
|
|||||||
void defaultSinkChanged();
|
void defaultSinkChanged();
|
||||||
void onVolumeChanged(double volume);
|
void onVolumeChanged(double volume);
|
||||||
void volumeSliderValueChanged();
|
void volumeSliderValueChanged();
|
||||||
void sinkInputsChanged();
|
|
||||||
void toggleMute();
|
|
||||||
void onPlaySoundEffect();
|
|
||||||
void increaseVolumeChanged();
|
void increaseVolumeChanged();
|
||||||
void cardsChanged(const QString &cards);
|
void cardsChanged(const QString &cards);
|
||||||
void removePort(const QString &portId, const uint &cardId);
|
void removePort(const QString &portId, const uint &cardId);
|
||||||
@ -144,14 +141,14 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *m_centralWidget;
|
QWidget *m_centralWidget;
|
||||||
DIconButton *m_volumeBtn;
|
DIconButton *m_volumeIconMin;
|
||||||
QLabel *m_volumeIconMax;
|
QLabel *m_volumeIconMax;
|
||||||
VolumeSlider *m_volumeSlider;
|
VolumeSlider *m_volumeSlider;
|
||||||
Dock::TipsWidget *m_soundShow;
|
QLabel *m_soundShow;
|
||||||
|
QLabel *m_deviceLabel;
|
||||||
QVBoxLayout *m_centralLayout;
|
QVBoxLayout *m_centralLayout;
|
||||||
HorizontalSeperator *m_seperator;
|
HorizontalSeperator *m_seperator;
|
||||||
HorizontalSeperator *m_secondSeperator;
|
HorizontalSeperator *m_secondSeperator;
|
||||||
Dock::TipsWidget *m_deviceLabel;
|
|
||||||
|
|
||||||
DBusAudio *m_audioInter;
|
DBusAudio *m_audioInter;
|
||||||
DBusSink *m_defSinkInter;
|
DBusSink *m_defSinkInter;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user