LegacySystemTray::LegacySystemTray(QWidget *parent) : SystemTray(parent), _blinkState(false), _lastMessageId(0) { #ifndef HAVE_KDE _trayIcon = new QSystemTrayIcon(associatedWidget()); #else _trayIcon = new KSystemTrayIcon(associatedWidget()); // We don't want to trigger a minimize if a highlight is pending, so we brutally remove the internal connection for that disconnect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), _trayIcon, SLOT(activateOrHide(QSystemTrayIcon::ActivationReason))); #endif #ifndef Q_WS_MAC connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(on_activated(QSystemTrayIcon::ActivationReason))); #endif connect(_trayIcon, SIGNAL(messageClicked()), SLOT(on_messageClicked())); _blinkTimer.setInterval(500); _blinkTimer.setSingleShot(false); connect(&_blinkTimer, SIGNAL(timeout()), SLOT(on_blinkTimeout())); connect(this, SIGNAL(toolTipChanged(QString,QString)), SLOT(syncLegacyIcon())); }
InRowComboBox::InRowComboBox(QWidget *parent, int ri) : QComboBox(parent) { rowIndex = ri; connect(this, SIGNAL(activated(QString)), this, SLOT(on_activated(QString))); connect(this, SIGNAL(activated(int)), this, SLOT(on_activated(int))); }
BranchSelectionComboBox::BranchSelectionComboBox(QWidget *parent) // ---------------------------------------------------------------------------- // Create a branch selection combo box // ---------------------------------------------------------------------------- : QComboBox(parent), repo(NULL), filter(BSF_AllBranches) { connect(this, SIGNAL(activated(QString)), this, SLOT(on_activated(QString))); setEnabled(false); }
bool CommitSelectionComboBox::populate() // ---------------------------------------------------------------------------- // Read branches from repository, fill the combo box // ---------------------------------------------------------------------------- { if (!repo || branch.isEmpty()) return false; int i = 0; clear(); prevSelected = -1; if (mode & CSM_HeadEntry) { Repository::Commit head = Repository::HeadCommit; addItem(head.toString()); setItemData(i++, QVariant::fromValue(head)); } QList<Repository::Commit> commits = repo->history(branch); // Commit list is in chronological order, we want latest first for (int n = commits.size() - 1; n >= 0; n--) { Repository::Commit commit = commits[n]; QString txt; if (mode & CSM_CommitId) { txt += commit.id; } if (mode & CSM_CommitMsg) { if (!txt.isEmpty()) txt += " "; txt += commit.msg; } if (!txt.isEmpty()) { addItem(txt); setItemData(i++, QVariant::fromValue(commit)); } } on_activated(currentIndex()); return true; }
CasperAppWindow::CasperAppWindow(QWidget *parent) : QMainWindow(parent), ctx(new PrivateAppContext) { ctx->mWindowPtr->setupUi(this); setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint); ctx->mWindowPtr->toolBar->setFloatable(false); ctx->mWindowPtr->toolBar->setMovable(false); ctx->mWindowPtr->toolBar->setContextMenuPolicy(Qt::NoContextMenu); ctx->mWindowPtr->toolBar->setContextMenuPolicy(Qt::PreventContextMenu); ctx->mWindowPtr->toolBar->addAction( QIcon(":/casper/artwork/casper_ui_toolbar_settings.svg"), "Settings"); #ifdef Q_OS_WIN setMinimumSize(211, 250); setMaximumSize(211, 250); setWindowTitle("Casper DNS"); setWindowFlags(Qt::Window | Qt::WindowCloseButtonHint); #endif ctx->mServiceListPtr = Casper::ServiceList::Get(); ctx->mServiceListPtr->Init(); connect(ctx->mServiceListPtr, &Casper::ServiceList::service_added, this, [this]() {}); UpdateServiceList(); ctx->mWindowPtr->m_service_list->setCurrentText( Casper::ServiceList::Get()->GetActiveService().getName()); connect(ctx->mWindowPtr->m_service_btn, &UIButton::toggled, this, [this](bool checked) { if (checked) { UpdateSystemDNS(); } else { ctx->mWindowPtr->m_service_btn->setButtonActionState( UIButton::kButtonActionInactive); Casper::Client::Get()->RollbackDNS(); // ctx->mWindowPtr->dns_status->setText("DNS DISABLED"); // statusBar()->showMessage(tr("OFF")); } }); connect(ctx->mWindowPtr->m_service_list, SIGNAL(activated(QString)), this, SLOT(on_activated(QString))); connect(ctx->mWindowPtr->m_service_list, SIGNAL(highlighted(QString)), this, SLOT(on_highligted(QString))); connect(Casper::ServiceList::Get(), &Casper::ServiceList::service_added, this, [this](const QString &name) { UpdateServiceList(); }); connect(Casper::ServiceList::Get(), &Casper::ServiceList::service_removed, this, [this](const QString &name) { for (int i = 0; i < Casper::ServiceList::Get()->GetCurrentServiceList().count(); i++) { if (ctx->mWindowPtr->m_service_list->itemText(i) == name) { ctx->mWindowPtr->m_service_list->removeItem(i); break; } } }); connect(ctx->mWindowPtr->toolBar, &QToolBar::actionTriggered, this, [this](QAction *action) { if (!action) return; ConfigureDialog *dialog = new ConfigureDialog(this); dialog->show(); }); }
void ClientAdaptor::activated() { emit on_activated(mPath); }