SystemTray::SystemTray(QWidget* parent) : QObject(parent) , _associatedWidget(parent) { Q_ASSERT(parent); NotificationSettings{}.initAndNotify("Systray/ChangeColor", this, &SystemTray::enableChangeColorChanged, true); NotificationSettings{}.initAndNotify("Systray/Animate", this, &SystemTray::enableBlinkChanged, false); UiStyleSettings{}.initAndNotify("Icons/InvertTray", this, &SystemTray::invertTrayIconChanged, false); ActionCollection* coll = QtUi::actionCollection("General"); _minimizeRestoreAction = new Action(tr("&Minimize"), this, this, &SystemTray::minimizeRestore); _trayMenu = new QMenu(associatedWidget()); _trayMenu->setTitle("Quassel IRC"); _trayMenu->setAttribute(Qt::WA_Hover); _trayMenu->addAction(coll->action("ConnectCore")); _trayMenu->addAction(coll->action("DisconnectCore")); _trayMenu->addAction(coll->action("CoreInfo")); _trayMenu->addSeparator(); _trayMenu->addAction(_minimizeRestoreAction); _trayMenu->addAction(coll->action("Quit")); connect(_trayMenu, &QMenu::aboutToShow, this, &SystemTray::trayMenuAboutToShow); connect(QtUi::instance(), &QtUi::iconThemeRefreshed, this, &SystemTray::iconsChanged); _blinkTimer.setInterval(1000); _blinkTimer.setSingleShot(false); connect(&_blinkTimer, &QTimer::timeout, this, &SystemTray::onBlinkTimeout); }
void SystemTray::init() { ActionCollection *coll = QtUi::actionCollection("General"); _minimizeRestoreAction = new Action(tr("&Minimize"), this, this, SLOT(minimizeRestore())); #ifdef HAVE_KDE KMenu *kmenu; _trayMenu = kmenu = new KMenu(); kmenu->addTitle(_activeIcon, "Quassel IRC"); #else _trayMenu = new QMenu(associatedWidget()); #endif _trayMenu->setTitle("Quassel IRC"); #ifndef HAVE_KDE _trayMenu->setAttribute(Qt::WA_Hover); #endif _trayMenu->addAction(coll->action("ConnectCore")); _trayMenu->addAction(coll->action("DisconnectCore")); _trayMenu->addAction(coll->action("CoreInfo")); _trayMenu->addSeparator(); _trayMenu->addAction(_minimizeRestoreAction); _trayMenu->addAction(coll->action("Quit")); connect(_trayMenu, SIGNAL(aboutToShow()), SLOT(trayMenuAboutToShow())); NotificationSettings notificationSettings; notificationSettings.initAndNotify("Systray/Animate", this, SLOT(enableAnimationChanged(QVariant)), true); }
void BufferWidget::addActionsToMenu(QMenu *menu, const QPointF &pos) { Q_UNUSED(pos); ActionCollection *coll = QtUi::actionCollection(); menu->addSeparator(); menu->addAction(coll->action("ZoomInChatView")); menu->addAction(coll->action("ZoomOutChatView")); menu->addAction(coll->action("ZoomOriginalChatView")); }
ChatViewSearchBar::ChatViewSearchBar(QWidget *parent) : QWidget(parent) { ui.setupUi(this); ui.hideButton->setIcon(QIcon::fromTheme("dialog-close")); ui.searchUpButton->setIcon(QIcon::fromTheme("go-up")); ui.searchDownButton->setIcon(QIcon::fromTheme("go-down")); _searchDelayTimer.setSingleShot(true); layout()->setContentsMargins(0, 0, 0, 0); hide(); ActionCollection *coll = QtUi::actionCollection("General"); QAction *toggleSearchBar = coll->action("ToggleSearchBar"); connect(toggleSearchBar, SIGNAL(toggled(bool)), SLOT(setVisible(bool))); Action *hideSearchBar = coll->add<Action>("HideSearchBar", toggleSearchBar, SLOT(setChecked(bool))); hideSearchBar->setShortcutConfigurable(false); hideSearchBar->setShortcut(Qt::Key_Escape); connect(ui.hideButton, SIGNAL(clicked()), toggleSearchBar, SLOT(toggle())); connect(ui.searchEditLine, SIGNAL(textChanged(const QString &)), this, SLOT(delaySearch())); connect(&_searchDelayTimer, SIGNAL(timeout()), this, SLOT(search())); }
void MainWin::setupMenus() { ActionCollection *coll = QtUi::actionCollection("General"); _fileMenu = menuBar()->addMenu(tr("&File")); static const QStringList coreActions = QStringList() << "ConnectCore" << "DisconnectCore" << "CoreInfo"; QAction *coreAction; foreach(QString actionName, coreActions) { coreAction = coll->action(actionName); _fileMenu->addAction(coreAction); flagRemoteCoreOnly(coreAction); }
bool TagTransactionManager::undo() { kDebug() << "Undoing " << m_undoList.count() << " changes.\n"; forget(); // Scrap our old changes (although the list should be empty // anyways. bool result = processChangeList(true); m_undoList.clear(); action("edit_undo")->setEnabled(false); return result; }
TagTransactionAtom::TagTransactionAtom() : m_item(0), m_tag(0) { action("edit_undo")->setEnabled(false); }
bool TagTransactionManager::processChangeList(bool undo) { TagAlterationList::ConstIterator it, end; QStringList errorItems; it = undo ? m_undoList.constBegin() : m_list.constBegin(); end = undo ? m_undoList.constEnd() : m_list.constEnd(); emit signalAboutToModifyTags(); for(; it != end; ++it) { PlaylistItem *item = (*it).item(); Tag *tag = (*it).tag(); QFileInfo newFile(tag->fileName()); if(item->file().fileInfo().fileName() != newFile.fileName()) { if(!renameFile(item->file().fileInfo(), newFile)) { errorItems.append(item->text(1) + QString(" - ") + item->text(0)); continue; } } if(tag->save()) { if(!undo) m_undoList.append(TagTransactionAtom(item, duplicateTag(item->file().tag()))); item->file().setFile(tag->fileName()); item->refreshFromDisk(); item->repaint(); item->playlist()->dataChanged(); item->playlist()->update(); } else { Tag *errorTag = item->file().tag(); QString str = errorTag->artist() + " - " + errorTag->title(); if(errorTag->artist().isEmpty()) str = errorTag->title(); errorItems.append(str); } kapp->processEvents(); } undo ? m_undoList.clear() : m_list.clear(); if(!undo && !m_undoList.isEmpty()) action("edit_undo")->setEnabled(true); else action("edit_undo")->setEnabled(false); if(!errorItems.isEmpty()) KMessageBox::errorList(static_cast<QWidget *>(parent()), i18n("The following files were unable to be changed."), errorItems, i18n("Error")); emit signalDoneModifyingTags(); return errorItems.isEmpty(); }