| 17 | #include <iostream> |
| 18 | |
| 19 | ActiveWindowControlWidget::ActiveWindowControlWidget(QWidget *parent) |
| 20 | : QWidget(parent) |
| 21 | , m_appInter(new DBusDock("com.deepin.dde.daemon.Dock", "/com/deepin/dde/daemon/Dock", QDBusConnection::sessionBus(), this)) |
| 22 | , mouseClicked(false) |
| 23 | , m_currentIndex(-1) |
| 24 | , m_currentMenu(nullptr) |
| 25 | , m_moreMenu(new QMenu()) |
| 26 | , organizeFlag(false) |
| 27 | , m_launcherInter(new LauncherInter("com.deepin.dde.Launcher", "/com/deepin/dde/Launcher", QDBusConnection::sessionBus(), this)) |
| 28 | { |
| 29 | m_launcherInter->setSync(true, false); |
| 30 | |
| 31 | QPalette palette1 = this->palette(); |
| 32 | palette1.setColor(QPalette::Background, Qt::transparent); |
| 33 | this->setPalette(palette1); |
| 34 | |
| 35 | this->m_layout = new QHBoxLayout(this); |
| 36 | this->m_layout->setSpacing(16); |
| 37 | this->m_layout->setContentsMargins(20, 0, 0, 0); |
| 38 | this->setLayout(this->m_layout); |
| 39 | |
| 40 | this->m_iconLabel = new QLabel(this); |
| 41 | this->m_iconLabel->setFixedSize(18, 18); |
| 42 | this->m_iconLabel->setScaledContents(true); |
| 43 | this->m_layout->addWidget(this->m_iconLabel); |
| 44 | |
| 45 | int buttonSize = 22; |
| 46 | this->m_buttonWidget = new QOperationWidget(true, this); |
| 47 | this->m_layout->addWidget(this->m_buttonWidget); |
| 48 | |
| 49 | this->m_appNameLabel = new QLabel(this); |
| 50 | this->m_appNameLabel->setFixedHeight(22); |
| 51 | this->m_layout->addWidget(this->m_appNameLabel); |
| 52 | |
| 53 | this->m_menuWidget = new QWidget(this); |
| 54 | this->installEventFilter(this); |
| 55 | |
| 56 | this->m_moreLabel = new QClickableLabel(this->m_menuWidget); |
| 57 | this->m_moreLabel->setText(tr(" ▸ ")); |
| 58 | this->m_moreLabel->setAlignment(Qt::AlignCenter); |
| 59 | connect(this->m_moreLabel, &QClickableLabel::clicked, this, &ActiveWindowControlWidget::menuLabelClicked); |
| 60 | this->m_moreLabel->hide(); |
| 61 | |
| 62 | this->m_layout->addWidget(this->m_menuWidget); |
| 63 | this->m_menuLayout = new QHBoxLayout(this->m_menuWidget); |
| 64 | this->m_menuLayout->setContentsMargins(0, 0, 0, 0); |
| 65 | this->m_menuLayout->setSpacing(2); |
| 66 | this->m_appMenuModel = new AppMenuModel(this); |
| 67 | connect(this->m_appMenuModel, &AppMenuModel::modelNeedsUpdate, this, &ActiveWindowControlWidget::updateMenu); |
| 68 | |
| 69 | this->m_winTitleLabel = new QLabel(this); |
| 70 | this->m_winTitleLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); |
| 71 | this->m_winTitleLabel->setContentsMargins(0, 4, 0, 4); |
| 72 | this->m_layout->addWidget(this->m_winTitleLabel); |
| 73 | |
| 74 | this->m_layout->addStretch(); |
| 75 | |
| 76 | this->setButtonsVisible(false); |
nothing calls this directly
no test coverage detected