void MToolCellular::show() { connect(m_radio, SIGNAL(modeChanged(int)), SLOT(onModeChanged(int))); onModeChanged(m_radio->mode()); }
void ColorInspector::initUI() { mCurrentColor = editor()->color()->frontColor(); QSettings settings(PENCIL2D, PENCIL2D); isRgbColors = settings.value("isRgb").toBool(); if (isRgbColors) { ui->rgbButton->setChecked(true); } else { ui->hsvButton->setChecked(true); } onModeChanged(); QPalette p1 = ui->colorWrapper->palette(), p2 = ui->color->palette(); p1.setBrush(QPalette::Background, QBrush(QImage(":/background/checkerboard.png"))); p2.setColor(QPalette::Background, mCurrentColor); ui->colorWrapper->setPalette(p1); ui->color->setPalette(p2); if (isRgbColors) { ui->red_slider->init(ColorSlider::ColorType::RED, mCurrentColor, 0.0, 255.0); ui->green_slider->init(ColorSlider::ColorType::GREEN, mCurrentColor, 0.0, 255.0); ui->blue_slider->init(ColorSlider::ColorType::BLUE, mCurrentColor, 0.0, 255.0); ui->alpha_slider->init(ColorSlider::ColorType::ALPHA, mCurrentColor, 0.0, 255.0); } else { ui->red_slider->init(ColorSlider::ColorType::HUE, mCurrentColor, 0.0, 359.0); ui->green_slider->init(ColorSlider::ColorType::SAT, mCurrentColor, 0.0, 255.0); ui->blue_slider->init(ColorSlider::ColorType::VAL, mCurrentColor, 0.0, 255.0); ui->alpha_slider->init(ColorSlider::ColorType::ALPHA, mCurrentColor, 0.0, 255.0); } auto spinBoxChanged = static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged); connect(ui->RedspinBox, spinBoxChanged, this, &ColorInspector::onColorChanged); connect(ui->GreenspinBox, spinBoxChanged, this, &ColorInspector::onColorChanged); connect(ui->BluespinBox, spinBoxChanged, this, &ColorInspector::onColorChanged); connect(ui->AlphaspinBox, spinBoxChanged, this, &ColorInspector::onColorChanged); connect(ui->rgbButton, &QPushButton::clicked, this, &ColorInspector::onModeChanged); connect(ui->hsvButton, &QPushButton::clicked, this, &ColorInspector::onModeChanged); connect(ui->red_slider, &ColorSlider::valueChanged, this, &ColorInspector::onSliderChanged); connect(ui->green_slider, &ColorSlider::valueChanged, this, &ColorInspector::onSliderChanged); connect(ui->blue_slider, &ColorSlider::valueChanged, this, &ColorInspector::onSliderChanged); connect(ui->alpha_slider, &ColorSlider::valueChanged, this, &ColorInspector::onSliderChanged); connect(editor(), &Editor::objectLoaded, this, &ColorInspector::updateUI); }
MToolCellular::MToolCellular(QGraphicsItem *parent): MWidget(parent), m_radio(new Cellular::RadioAccess(this)), poskey(new GConfItem("/apps/system-ui-extensions/tools/cellular/index")), statuskey(new GConfItem("/apps/system-ui-extensions/tools/cellular/working")) { setMaximumSize(64,64); setMinimumSize(64,64); icon_2g = QImage("/usr/share/themes/blanco/meegotouch/icons/icon-extensions-cellular-2g.png"); icon_3g = QImage("/usr/share/themes/blanco/meegotouch/icons/icon-extensions-cellular-3g.png"); icon_dual = QImage("/usr/share/themes/blanco/meegotouch/icons/icon-extensions-cellular-dual.png"); m_toggleicon = new MImageWidget(&icon_2g, this); m_toggleicon->setAspectRatioMode(Qt::KeepAspectRatio); m_toggleicon->setMaximumSize(64,64); m_toggleicon->setMinimumSize(64,64); MFeedback* feedback1 = new MFeedback("priority2_static_press", this); connect(this, SIGNAL(pressed()), feedback1, SLOT(play())); MFeedback* feedback2 = new MFeedback("priority2_static_release", this); connect(this, SIGNAL(released()), feedback2, SLOT(play())); // connect(m_radio, // SIGNAL(modeChanged(int)), // SLOT(onModeChanged(int))); onModeChanged(m_radio->mode()); connect(poskey, SIGNAL(valueChanged()), SLOT(onIndexChanged())); connect(statuskey, SIGNAL(valueChanged()), SLOT(onStatusChanged())); index = poskey->value().toInt(); status = statuskey->value().toBool(); }
MpdClientDialog::MpdClientDialog(QWidget *parent) : QDialog(parent, Qt::FramelessWindowHint) , vbox_(this) , titlebar_widget_(this) , titlebar_layout_(&titlebar_widget_) , titlebar_icon_(0) , titlebar_label_(0) , close_button_("", 0) , title_layout_(0) , title_icon_(0) , title_label_(0) , artist_layout_(0) , artist_icon_(0) , artist_label_(0) , hor_separator_(this) , button_widget_(this) , button_layout_(&button_widget_) , prev_button_("", 0) , play_button_("", 0) , stop_button_("", 0) , next_button_("", 0) , mode_button_("", 0) { QIcon icon; QSize icon_size; setModal(true); setAutoFillBackground(true); setBackgroundRole(QPalette::Base); titlebar_icon_.setPixmap(QPixmap(":/images/music_player_small.png")); QFont titlebar_font(titlebar_label_.font()); titlebar_font.setPointSize(25); titlebar_label_.setFont(titlebar_font); titlebar_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter); titlebar_label_.setIndent(10); titlebar_label_.setText(QCoreApplication::tr("Music Player")); icon = loadIcon(":/images/close.png", icon_size); close_button_.setStyleSheet(PAGE_BUTTON_STYLE); close_button_.setIconSize(icon_size); close_button_.setIcon(icon); close_button_.setFocusPolicy(Qt::NoFocus); titlebar_layout_.setSpacing(2); titlebar_layout_.setContentsMargins(5, 0, 5, 0); titlebar_layout_.addWidget(&titlebar_icon_, 10); titlebar_layout_.addWidget(&titlebar_label_, 300); titlebar_layout_.addWidget(&close_button_); titlebar_widget_.setAutoFillBackground(true); titlebar_widget_.setBackgroundRole(QPalette::Dark); titlebar_widget_.setContentsMargins(0, 0, 0, 0); titlebar_widget_.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); title_icon_.setPixmap(QPixmap(":/images/title.png")); QFont title_font(title_label_.font()); title_font.setPointSize(28); title_label_.setFont(title_font); title_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter); title_label_.setContentsMargins(10, 0, 5, 0); title_label_.setMaximumWidth(400); title_layout_.setSpacing(2); title_layout_.setContentsMargins(5, 5, 5, 0); title_layout_.addWidget(&title_icon_, 10); title_layout_.addWidget(&title_label_, 200); artist_icon_.setPixmap(QPixmap(":/images/artist.png")); QFont artist_font(artist_label_.font()); artist_font.setPointSize(20); artist_label_.setFont(artist_font); artist_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter); artist_label_.setContentsMargins(10, 0, 5, 0); artist_label_.setMaximumWidth(400); artist_layout_.setSpacing(2); artist_layout_.setContentsMargins(5, 0, 5, 0); artist_layout_.addWidget(&artist_icon_, 10); artist_layout_.addWidget(&artist_label_, 200); album_icon_.setPixmap(QPixmap(":/images/album.png")); QFont album_font(album_label_.font()); album_font.setPointSize(20); album_label_.setFont(album_font); album_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter); album_label_.setContentsMargins(10, 0, 5, 0); album_label_.setMaximumWidth(400); album_layout_.setSpacing(2); album_layout_.setContentsMargins(5, 0, 5, 5); album_layout_.addWidget(&album_icon_, 10); album_layout_.addWidget(&album_label_, 200); progress_bar_.setMinimum(0); progress_bar_.setMaximum(0); progress_bar_.setContentsMargins(2, 1, 2, 1); QFont progress_font(progress_label_.font()); progress_font.setPointSize(12); progress_font.setBold(true); progress_label_.setFont(progress_font); progress_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter); progress_label_.setIndent(10); progress_layout_.setSpacing(2); progress_layout_.setContentsMargins(5, 0, 5, 5); progress_layout_.addWidget(&progress_bar_); progress_layout_.addWidget(&progress_label_); hor_separator_.setFixedHeight(1); hor_separator_.setFocusPolicy(Qt::NoFocus); hor_separator_.setFrameShape(QFrame::HLine); hor_separator_.setAutoFillBackground(true); hor_separator_.setBackgroundRole(QPalette::Light); icon = loadIcon(":/images/play_prev.png", icon_size); prev_button_.setStyleSheet(PAGE_BUTTON_STYLE); prev_button_.setIconSize(icon_size); prev_button_.setIcon(icon); prev_button_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); prev_button_.setFocusPolicy(Qt::TabFocus); play_button_.setStyleSheet(PAGE_BUTTON_STYLE); play_button_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); play_button_.setFocusPolicy(Qt::TabFocus); stop_button_.setStyleSheet(PAGE_BUTTON_STYLE); stop_button_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); stop_button_.setFocusPolicy(Qt::TabFocus); icon = loadIcon(":/images/play_next.png", icon_size); next_button_.setStyleSheet(PAGE_BUTTON_STYLE); next_button_.setIconSize(icon_size); next_button_.setIcon(icon); next_button_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); next_button_.setFocusPolicy(Qt::TabFocus); mode_button_.setStyleSheet(PAGE_BUTTON_STYLE); mode_button_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mode_button_.setFocusPolicy(Qt::TabFocus); button_layout_.setSpacing(2); button_layout_.setContentsMargins(5, 5, 5, 5); button_layout_.addStretch(); button_layout_.addWidget(&prev_button_); button_layout_.addWidget(&play_button_); button_layout_.addWidget(&stop_button_); button_layout_.addWidget(&next_button_); button_layout_.addWidget(&mode_button_); button_layout_.addStretch(); button_widget_.setContentsMargins(0, 0, 0, 0); button_widget_.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); vbox_.setSpacing(0); vbox_.setContentsMargins(0, 0, 0, 0); vbox_.addWidget(&titlebar_widget_); vbox_.addLayout(&title_layout_); vbox_.addLayout(&artist_layout_); vbox_.addLayout(&album_layout_); vbox_.addLayout(&progress_layout_); vbox_.addWidget(&hor_separator_); vbox_.addWidget(&button_widget_); connect(&close_button_, SIGNAL(clicked()), this, SLOT(done())); connect(&prev_button_, SIGNAL(clicked()), this, SLOT(onPrevClicked())); connect(&play_button_, SIGNAL(clicked()), this, SLOT(onPlayClicked())); connect(&stop_button_, SIGNAL(clicked()), this, SLOT(onStopClicked())); connect(&next_button_, SIGNAL(clicked()), this, SLOT(onNextClicked())); connect(&mode_button_, SIGNAL(clicked()), this, SLOT(onModeClicked())); timer_ = new QTimer(this); timer_->setSingleShot(false); timer_->setInterval(2 * 1000); QMpdClient &mpdClient = QMpdClient::instance(); connect(&mpdClient, SIGNAL(stateChanged(QMpdStatus::State)), this, SLOT(onStateChanged(QMpdStatus::State))); connect(&mpdClient, SIGNAL(modeChanged(QMpdStatus::Mode)), this, SLOT(onModeChanged(QMpdStatus::Mode))); connect(&mpdClient, SIGNAL(songChanged(const QMpdSong &)), this, SLOT(onSongChanged(const QMpdSong &))); connect(&mpdClient, SIGNAL(elapsedSecondsAtStatusChange(int)), this, SLOT(onElapsedSecondsAtStatusChange(int))); connect(timer_, SIGNAL(timeout()), this, SLOT(onTimeout())); onStateChanged(mpdClient.status().state()); onModeChanged(mpdClient.status().mode()); onSongChanged(mpdClient.song()); onElapsedSecondsAtStatusChange(mpdClient.status().elapsedSeconds()); show(); sys::SysStatus::instance().setSystemBusy(false); onyx::screen::instance().flush(this, onyx::screen::ScreenProxy::GC, false); }
StatusNotifierItem::StatusNotifierItem(QWidget *parent) : StatusNotifierItemParent(parent) #if QT_VERSION >= 0x050000 , _iconThemeDir{QDir::tempPath() + QLatin1String{"/quassel-sni-XXXXXX"}} #endif { static bool registered = []() -> bool { qDBusRegisterMetaType<DBusImageStruct>(); qDBusRegisterMetaType<DBusImageVector>(); qDBusRegisterMetaType<DBusToolTipStruct>(); return true; }(); Q_UNUSED(registered) setMode(Mode::StatusNotifier); connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(onVisibilityChanged(bool))); connect(this, SIGNAL(modeChanged(Mode)), this, SLOT(onModeChanged(Mode))); connect(this, SIGNAL(stateChanged(State)), this, SLOT(onStateChanged(State))); trayMenu()->installEventFilter(this); // Create a temporary directory that holds copies of the tray icons. That way, visualizers can find our icons. // For Qt4 the relevant icons are installed in hicolor already, so nothing to be done. #if QT_VERSION >= 0x050000 if (_iconThemeDir.isValid()) { _iconThemePath = _iconThemeDir.path(); } else { qWarning() << "Could not create temporary directory for themed tray icons!"; } #endif connect(this, SIGNAL(iconsChanged()), this, SLOT(refreshIcons())); refreshIcons(); // Our own SNI service _statusNotifierItemDBus = new StatusNotifierItemDBus(this); connect(this, SIGNAL(currentIconNameChanged()), _statusNotifierItemDBus, SIGNAL(NewIcon())); connect(this, SIGNAL(currentIconNameChanged()), _statusNotifierItemDBus, SIGNAL(NewAttentionIcon())); connect(this, SIGNAL(toolTipChanged(QString, QString)), _statusNotifierItemDBus, SIGNAL(NewToolTip())); // Service watcher to keep track of the StatusNotifierWatcher service QDBusServiceWatcher *watcher = new QDBusServiceWatcher(kSniWatcherService, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); connect(watcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), SLOT(serviceChange(QString, QString, QString))); // Client instance for StatusNotifierWatcher _statusNotifierWatcher = new org::kde::StatusNotifierWatcher(kSniWatcherService, kSniWatcherPath, QDBusConnection::sessionBus(), this); connect(_statusNotifierWatcher, SIGNAL(StatusNotifierHostRegistered()), SLOT(checkForRegisteredHosts())); connect(_statusNotifierWatcher, SIGNAL(StatusNotifierHostUnregistered()), SLOT(checkForRegisteredHosts())); // Client instance for notifications _notificationsClient = new org::freedesktop::Notifications(kXdgNotificationsService, kXdgNotificationsPath, QDBusConnection::sessionBus(), this); connect(_notificationsClient, SIGNAL(NotificationClosed(uint, uint)), SLOT(notificationClosed(uint, uint))); connect(_notificationsClient, SIGNAL(ActionInvoked(uint, QString)), SLOT(notificationInvoked(uint, QString))); if (_notificationsClient->isValid()) { QStringList desktopCapabilities = _notificationsClient->GetCapabilities(); _notificationsClientSupportsMarkup = desktopCapabilities.contains("body-markup"); _notificationsClientSupportsActions = desktopCapabilities.contains("actions"); } #ifdef HAVE_DBUSMENU new QuasselDBusMenuExporter(menuObjectPath(), trayMenu(), _statusNotifierItemDBus->dbusConnection()); // will be added as menu child #endif }