QMultiMap<int, IOptionsDialogWidget *> RosterItemExchange::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; if (ANodeId == OPN_ROSTERVIEW) { widgets.insertMulti(OHO_ROSTER_MANAGEMENT,FOptionsManager->newOptionsDialogHeader(tr("Contacts list management"),AParent)); widgets.insertMulti(OWO_ROSTER_EXCHANGEAUTO,FOptionsManager->newOptionsDialogWidget(Options::node(OPV_ROSTER_EXCHANGE_AUTOAPPROVEENABLED),tr("Allow gateways and group services manage your contacts list"),AParent)); } return widgets; }
QMultiMap<int, IOptionsDialogWidget *> ShortcutManager::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; if (ANodeId == OPN_SHORTCUTS) { widgets.insertMulti(OHO_SHORTCUTS, FOptionsManager->newOptionsDialogHeader(tr("Shortcuts"),AParent)); widgets.insertMulti(OWO_SHORTCUTS, new ShortcutOptionsWidget(AParent)); } return widgets; }
QMultiMap<int, IOptionsWidget *> MessageWidgets::optionsWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsWidget *> widgets; if (FOptionsManager && ANodeId == OPN_MESSAGES) { widgets.insertMulti(OWO_MESSAGES, FOptionsManager->optionsHeaderWidget(QString::null,tr("Select the method of sending messages"),AParent)); widgets.insertMulti(OWO_MESSAGES, new MessengerOptions(AParent)); } return widgets; }
QMultiMap<int, IOptionsDialogWidget *> DataStreamsManger::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; if (FOptionsManager && ANodeId==OPN_DATATRANSFER) { int index = 0; foreach(IDataStreamMethod *method, FMethods) { widgets.insertMulti(OHO_DATATRANSFER_METHODNAME + index, FOptionsManager->newOptionsDialogHeader(tr("Transfer method %1").arg(method->methodName()),AParent)); widgets.insertMulti(OWO_DATATRANSFER_METHODSETTINGS + index, method->methodSettingsWidget(settingsProfileNode(QUuid(),method->methodNS()),AParent)); index += 10; }
QMultiMap<int, IOptionsWidget *> MainWindowPlugin::optionsWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsWidget *> widgets; if (FOptionsManager && ANodeId == OPN_ROSTER) { widgets.insertMulti(OWO_ROSTER_MAINWINDOW_STAYONTOP, FOptionsManager->optionsNodeWidget(Options::node(OPV_MAINWINDOW_STAYONTOP),tr("Stay on top of other windows"),AParent)); #ifdef Q_OS_WIN if (QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7) widgets.insertMulti(OWO_ROSTER_MAINWINDOW_MINIMIZETOTRAY, FOptionsManager->optionsNodeWidget(Options::node(OPV_MAINWINDOW_MINIMIZETOTRAY_W7),tr("Show application icon in tray"),AParent)); #endif } return widgets; }
void Annotations::updateDataHolder(const Jid &AStreamJid, const QList<Jid> &AContactJids) { IRosterIndex *sroot = FRostersModel!=NULL ? FRostersModel->streamRoot(AStreamJid) : NULL; if (sroot && !AContactJids.isEmpty()) { QMultiMap<int,QVariant> findData; foreach(const Jid &contactJid, AContactJids) findData.insertMulti(RDR_PREP_BARE_JID,contactJid.pBare()); findData.insertMulti(RDR_STREAM_JID,AStreamJid.pFull()); foreach (IRosterIndex *index, sroot->findChilds(findData,true)) emit rosterDataChanged(index,RDR_ANNOTATIONS); }
QMultiMap<int, IOptionsDialogWidget *> UserTuneHandler::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; if (FOptionsManager && ANodeId == OPN_USERTUNE) { #ifdef READ_WRITE_TUNE widgets.insertMulti(OWO_USERTUNE, new UserTuneOptions(AParent)); #else widgets.insertMulti(OWO_USERTUNE, FOptionsManager->optionsNodeWidget(Options::node(OPV_USERTUNE_SHOW_ROSTER_LABEL),tr("Show music icon in roster"),AParent)); widgets.insertMulti(OWO_USERTUNE, FOptionsManager->optionsNodeWidget(Options::node(OPV_USERTUNE_TAG_FORMAT),tr("Tag format:"),AParent)); #endif } return widgets; }
QMultiMap<int, IOptionsDialogWidget *> ConnectionManager::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; QStringList nodeTree = ANodeId.split(".",QString::SkipEmptyParts); if (nodeTree.count()==3 && nodeTree.at(0)==OPN_ACCOUNTS && nodeTree.at(2)=="Parameters") { widgets.insertMulti(OHO_ACCOUNTS_PARAMS_CONNECTION,FOptionsManager->newOptionsDialogHeader(tr("Connection"),AParent)); widgets.insertMulti(OWO_ACCOUNTS_PARAMS_CONNECTION, new ConnectionOptionsWidget(this,Options::node(OPV_ACCOUNT_ITEM,nodeTree.at(1)),AParent)); } else if (ANodeId == OPN_ACCOUNTS) { widgets.insertMulti(OWO_ACCOUNTS_DEFAULTPROXY, proxySettingsWidget(Options::node(OPV_PROXY_DEFAULT),AParent)); } return widgets; }
void parseHits(QXmlStreamReader & in, Task & task, const QString subtask) { QMultiMap<int, Task::Hit> sortedHits; while(!in.atEnd()) { QXmlStreamReader::TokenType token = in.readNext(); if (token == QXmlStreamReader::StartElement) { QString elementName = in.name().toString(); if (0) { } else if (elementName.compare("h", Qt::CaseInsensitive) == 0){ Task::Hit hit; QXmlStreamAttributes attrs = in.attributes(); hit.timestamp = QDateTime::fromString(attrs.value("t").toString(), DATETIMEFORMAT); hit.duration = attrs.value("d").toString().toUInt(); sortedHits.insertMulti(hit.timestamp.toTime_t(), hit); } } else if (token == QXmlStreamReader::EndElement && in.name().toString().compare("hits", Qt::CaseInsensitive) == 0) { break; } } // remove duplicates QMultiMap<int, Task::Hit>::iterator itr = sortedHits.begin(); Task::Hit prev; while(itr != sortedHits.end()) { if (itr.value() == prev) itr = sortedHits.erase(itr); else { prev = itr.value(); itr++; } } task.hits[subtask] = sortedHits.values(); }
QMultiMap<uint,uint> *SDBCache::loadMap(QString id, QString db,QMultiMap<uint,uint> **origin){ QMutexLocker locker(this->_mutex); // if(this->_mapCache.contains(db + "/" + id)){ // Log::add(tr("Loading from memory cache: %1").arg(db + "/" + id),Log::Debug); // return this->_mapCache.object(db + "/" + id); // } if(this->isKeyCached(this->_mapCacheHash,db + "/" + id)){ //Log::add(tr("Loading from memory cache: %1").arg(db + "/" + id),Log::Debug); return this->cacheObject(this->_mapCacheHash,&this->_mapCacheHistory,&this->_mapCacheMax,db + "/" + id).v; } //Log::add(tr("Loading from cache file: %1").arg(db + "/" + id),Log::Debug); QMultiMap<uint,uint> *map = new QMultiMap<uint,uint>(); QString data = this->load(id,db,0,true); QStringList sl = data.split(","); if(sl.length()%2 == 0){ for(int i = 0; i < sl.length();i+=2){ map->insertMulti(QVariant(sl.at(i)).toUInt(),QVariant(sl.at(i+1)).toUInt()); } } // QMultiMap<uint,uint> *cpy = new QMultiMap<uint,uint>(*map); // this->_mapCache.insert(db + "/" + id, map, 1); SDBCache::MapCacheNode n; n.v = map; n.p = origin; this->addCacheEntry(&this->_mapCacheHistory,this->_mapCacheHash,db + "/" + id, n, &this->_mapCacheMax); return map; }
QMultiMap<int, IOptionsDialogWidget *> MapSourceGoogle::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; if (ANodeId == OPN_MAP_GOOGLE ) widgets.insertMulti(OWO_MAPSOURCE, new SettingsGoogle(AParent)); return widgets; }
long YawDetector::operator()(QString image){ auto pair1 = position(image); size_t eyes1Size = size(pair1); long position1 = pair1.first + pair1.second; QMultiMap<long, QString> scores; auto images = positions.keys(); foreach(QString image, images){ auto pair2 = positions.value(image); long score = 0; if(eyes1Size != size(pair2)){ score = ONE_MILLION; } else { long position2 = pair2.first + pair2.second; if(eyes1Size == 0){ score = 0; } else if(eyes1Size == 1){ if((pair1.first == 0 && pair2.first == 0) || (pair1.second == 0 && pair2.second == 0)){ score = (position1 - position2); } else { score = ONE_MILLION; } } else { score = (position1 - position2); } } scores.insertMulti(std::abs(score), image); }
QMultiMap<int, IOptionsDialogWidget *> MapSourceYandex::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; if (ANodeId == OPN_MAP_YANDEX ) widgets.insertMulti(OWO_MAPSOURCE, new OptionsYandex(AParent)); return widgets; }
void ChatSearchFromController::rebuildRows() { auto ms = getms(); auto wasEmpty = !delegate()->peerListFullRowsCount(); auto now = unixtime(); QMultiMap<int32, UserData*> ordered; if (_chat->noParticipantInfo()) { AuthSession::Current().api().requestFullPeer(_chat); } else if (!_chat->participants.isEmpty()) { for (auto i = _chat->participants.cbegin(), e = _chat->participants.cend(); i != e; ++i) { auto user = i.key(); ordered.insertMulti(App::onlineForSort(user, now), user); } } for_const (auto user, _chat->lastAuthors) { if (user->isInaccessible()) continue; appendRow(user); if (!ordered.isEmpty()) { ordered.remove(App::onlineForSort(user, now), user); } } if (!ordered.isEmpty()) { for (auto i = ordered.cend(), b = ordered.cbegin(); i != b;) { appendRow(*(--i)); } } checkForEmptyRows(); delegate()->peerListRefreshRows(); }
QMultiMap<int, IOptionsDialogWidget *> TuneListenerFile::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; if (ANodeId == OPN_PEP) widgets.insertMulti(OWO_PEP_USERTUNE_FILE, new TuneListenerFileOptions(AParent)); return widgets; }
QMultiMap<int, IOptionsWidget *> OptionsManager::optionsWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsWidget *> widgets; if (ANodeId == OPN_COMMON) { #ifndef Q_WS_MAC widgets.insertMulti(OWO_COMMON, optionsHeaderWidget(QString::null, tr("Common settings"), AParent)); #endif #ifdef Q_WS_WIN widgets.insertMulti(OWO_COMMON_AUTOSTART, optionsNodeWidget(Options::node(OPV_MISC_AUTOSTART), tr("Launch application on system start up"), AParent)); #endif #if defined(Q_WS_X11) || defined(DEBUG_ENABLED) if (CustomBorderStorage::isBordersAvail()) widgets.insertMulti(OWO_COMMON_BORDERSENABLE, optionsNodeWidget(Options::node(OPV_MISC_CUSTOMBORDERSENABLED), tr("Enable windows customization (restart required)"), AParent)); #endif #ifndef Q_WS_MAC widgets.insertMulti(OWO_COMMON_SINC, optionsHeaderWidget(QString::null, tr("Backing store your chat history and preferences"), AParent)); #endif widgets.insertMulti(OWO_COMMON_SINC_OPTIONS, optionsNodeWidget(Options::node(OPV_MISC_OPTIONS_SAVE_ON_SERVER), tr("Sync preferences on my several computers"), AParent)); widgets.insertMulti(OWO_COMMON_LOCALE, optionsHeaderWidget(QString::null, tr("Interface language"), AParent)); widgets.insertMulti(OWO_COMMON_LOCALE_SELECT, new LocaleOptionsWidget(AParent)); } return widgets; }
QMultiMap<int, IOptionsDialogWidget *> ClientInfo::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; if (FOptionsManager && ANodeId == OPN_COMMON) { widgets.insertMulti(OWO_COMMON_SENDCLIENTINFO, FOptionsManager->newOptionsDialogWidget(Options::node(OPV_COMMON_SHAREOSVERSION),tr("Share information about your OS version"),AParent)); } return widgets; }
void Statistics::incrementRankingEntry(QString ranking, QString key){ if(!this->_rankings.contains(ranking)){ this->_rankings.insert(ranking, new QMultiMap<quint64, QString>()); this->_rankingsCounter.insert(ranking,0); } //"Reinigen"? if(this->_rankingsCounter[ranking] > 1000){ for(int i = 0; i < 900;++i){ QMultiMap<quint64, QString>::const_iterator beg = this->_rankings.value(ranking)->begin(); this->_rankings.value(ranking)->remove(beg.key(), beg.value()); } this->_rankingsCounter[ranking] = 100; //Durchgehen und den Wert auf 25% senken QMultiMap<quint64, QString>::const_iterator i = this->_rankings.value(ranking)->begin(); QMultiMap<quint64, QString>::const_iterator end = this->_rankings.value(ranking)->end(); QMultiMap<quint64, QString> *tmpMap = new QMultiMap<quint64, QString>(); while(i != end){ tmpMap->insertMulti(i.key()*0.25, i.value()); i++; } //Alte Map löschen delete this->_rankings.value(ranking); //Neue einsetzen this->_rankings[ranking] = tmpMap; } //Werte durchgehen QMultiMap<quint64, QString>::const_iterator it = this->_rankings.value(ranking)->begin(); QMultiMap<quint64, QString>::const_iterator end = this->_rankings.value(ranking)->end(); while(it != end){ //Schlüssel gefunden? if(it.value() == key){ //Wert zwischenspeichern uint val = it.key(); //Alten Wert entfernen this->_rankings.value(ranking)->remove(it.key(), it.value()); //Neu einschreiben this->_rankings.value(ranking)->insertMulti(val+1, key); return; } it++; } //Counter erhöhen this->_rankingsCounter[ranking]++; //Einfügen this->_rankings.value(ranking)->insertMulti(1, key); }
QMultiMap<int, QString> getBackwardKeys() { QMultiMap<int, QString> result; for (QHash<QString, int>::const_iterator it = _keys.begin(); it != _keys.end(); ++it) { result.insertMulti(it.value(), it.key()); } return result; }
QMultiMap<QString, ProjectConverter> ToolPluginManager::projectConverters() const { QMultiMap<QString, ProjectConverter> result; for (ToolPluginInterface * const toolPlugin : mPlugins) { for (ProjectConverter const &converter : toolPlugin->projectConverters()) { result.insertMulti(converter.editor(), converter); } } return result; }
const QList<QPainterPath> TextItems::generateZones(const int Width, const int ToleranceR, const int ToleranceY, const int Columns) const { // Assumes that items are already in column, y, x order! // Phase #1: Generate the zones QList<QPainterPath> zones; foreach (const TextItem &item, items) { if (zones.isEmpty()) { // First word becomes first zone QPainterPath zone; zone.addRect(item.rect); zones << zone; } else { // Add to an existing zone within tolerance or a new one const QRectF tolerantRect = item.rect.adjusted(-ToleranceR, -ToleranceR, ToleranceR, ToleranceR); bool found = false; for (int i = 0; i < zones.count(); ++i) { QPainterPath zone = zones.at(i); if (zone.intersects(tolerantRect)) { zone.addRect(item.rect); zones[i] = zone; found = true; break; } } if (!found) { QPainterPath zone; zone.addRect(item.rect); zones << zone; } } } // Phase #2: Order the zones by (column, y, x) const int Span = Width / Columns; QMultiMap<Key, QPainterPath> zonesForColumn; foreach (const QPainterPath &zone, zones) { const QRect &rect = zone.boundingRect().toRect(); const int Column = ((Columns == 1) ? 0 : (rect.width() > Span) ? Columns : rect.right() / Span); const int y = normalizedY(static_cast<int>(rect.y()), ToleranceY); zonesForColumn.insertMulti(Key(Column, y, rect.x()), zone); } return zonesForColumn.values(); }
bool XmppUriQueries::parseXmppUri(const QUrl &AUrl, Jid &AContactJid, QString &AAction, QMultiMap<QString, QString> &AParams) const { if (AUrl.isValid() && AUrl.scheme()==XMPP_URI_SCHEME) { QUrl url = QUrl::fromEncoded(AUrl.toEncoded().replace(';','&'), QUrl::StrictMode); QList< QPair<QString, QString> > keyValues = url.queryItems(); if (!keyValues.isEmpty()) { AContactJid = url.path(); AAction = keyValues.takeAt(0).first; if (AContactJid.isValid() && !AAction.isEmpty()) { for (int i=0; i<keyValues.count(); i++) AParams.insertMulti(keyValues.at(i).first, keyValues.at(i).second); return true; } } } return false; }
bool XmppUriQueries::openXmppUri(const Jid &AStreamJid, const QUrl &AUrl) const { if (AUrl.isValid() && AUrl.scheme()=="xmpp") { QUrl url = QUrl::fromEncoded(AUrl.toEncoded().replace(';','&'), QUrl::StrictMode); Jid contactJid = url.path(); QList< QPair<QString, QString> > keyValues = url.queryItems(); if (keyValues.count() > 0) { QString action = keyValues.takeAt(0).first; if (contactJid.isValid() && !action.isEmpty()) { QMultiMap<QString, QString> params; for (int i=0; i<keyValues.count(); i++) params.insertMulti(keyValues.at(i).first, keyValues.at(i).second); LOG_STRM_INFO(AStreamJid,QString("Opening XMPP URI, url=%1").arg(AUrl.toString())); foreach (IXmppUriHandler *handler, FHandlers) { if (handler->xmppUriOpen(AStreamJid, contactJid, action, params)) return true; } }
QMultiMap<int, IOptionsDialogWidget *> AccountManager::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; if (ANodeId.startsWith(OPN_ACCOUNTS)) { QStringList nodeTree = ANodeId.split(".",QString::SkipEmptyParts); if (ANodeId == OPN_ACCOUNTS) { widgets.insertMulti(OHO_ACCOUNTS_ACCOUNTS, FOptionsManager->newOptionsDialogHeader(tr("Accounts"),AParent)); // *** <<< eyeCU <<< *** int flags = 0; if (Options::node(OPV_COMMON_ADVANCED).value().toBool()) flags|=AccountsOptionsWidget::Advanced; if (!FWizardAccount) flags|=AccountsOptionsWidget::NoWizrd; AccountsOptionsWidget *widget = new AccountsOptionsWidget(this, flags, AParent); widgets.insertMulti(OWO_ACCOUNTS_ACCOUNTS, widget); connect(widget, SIGNAL(addAccountLinkActivated(const QString &)), SLOT(onAddAccountLinkActivated(const QString &))); connect(this, SIGNAL(showAccountSettings(QUuid)), widget, SLOT(onSettingsButtonClicked(QUuid))); // *** >>> eyeCU >>> *** widgets.insertMulti(OHO_ACCOUNTS_COMMON, FOptionsManager->newOptionsDialogHeader(tr("Common account settings"),AParent)); QComboBox *resourceCombox = newResourceComboBox(QUuid(),AParent); widgets.insertMulti(OWO_ACCOUNTS_DEFAULTRESOURCE,FOptionsManager->newOptionsDialogWidget(Options::node(OPV_ACCOUNT_DEFAULTRESOURCE),tr("Default resource:"),resourceCombox,AParent)); } else if (nodeTree.count()==3 && nodeTree.at(0)==OPN_ACCOUNTS && nodeTree.at(2)=="Parameters") { OptionsNode options = Options::node(OPV_ACCOUNT_ITEM,nodeTree.at(1)); widgets.insertMulti(OHO_ACCOUNTS_PARAMS_ACCOUNT,FOptionsManager->newOptionsDialogHeader(tr("Account"),AParent)); widgets.insertMulti(OWO_ACCOUNTS_PARAMS_NAME,FOptionsManager->newOptionsDialogWidget(options.node("name"),tr("Name:"),AParent)); // *** <<< eyeCU <<< *** if (!FWizardAccount || Options::node(OPV_COMMON_ADVANCED).value().toBool()) widgets.insertMulti(OWO_ACCOUNTS_PARAMS_STREAM_JID,FOptionsManager->newOptionsDialogWidget(options.node("streamJid"),tr("Jabber ID:"),AParent)); // *** >>> eyeCU >>> *** widgets.insertMulti(OWO_ACCOUNTS_PARAMS_PASSWORD,FOptionsManager->newOptionsDialogWidget(options.node("password"),tr("Password:"******"resource"),tr("Resource:"),resourceCombox,AParent)); } else if (nodeTree.count()==3 && nodeTree.at(0)==OPN_ACCOUNTS && nodeTree.at(2)=="Additional") { OptionsNode options = Options::node(OPV_ACCOUNT_ITEM,nodeTree.at(1)); widgets.insertMulti(OHO_ACCOUNTS_ADDITIONAL_SETTINGS, FOptionsManager->newOptionsDialogHeader(tr("Additional settings"),AParent)); widgets.insertMulti(OWO_ACCOUNTS_ADDITIONAL_REQUIRESECURE,FOptionsManager->newOptionsDialogWidget(options.node("require-encryption"),tr("Require secure connection to server"),AParent)); } } return widgets; }
void OutputPaneManager::init() { ActionManager *am = Core::ICore::instance()->actionManager(); ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); const Context globalcontext(Core::Constants::C_GLOBAL); // Window->Output Panes ActionContainer *mpanes = am->createMenu(Constants::M_WINDOW_PANES); mwindow->addMenu(mpanes, Constants::G_WINDOW_PANES); mpanes->menu()->setTitle(tr("Output &Panes")); mpanes->appendGroup("Coreplugin.OutputPane.ActionsGroup"); mpanes->appendGroup("Coreplugin.OutputPane.PanesGroup"); Core::Command *cmd; cmd = am->registerAction(m_clearAction, "Coreplugin.OutputPane.clear", globalcontext); m_clearButton->setDefaultAction(cmd->action()); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); cmd = am->registerAction(m_prevAction, "Coreplugin.OutputPane.previtem", globalcontext); cmd->setDefaultKeySequence(QKeySequence("Shift+F6")); m_prevToolButton->setDefaultAction(cmd->action()); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); cmd = am->registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem", globalcontext); m_nextToolButton->setDefaultAction(cmd->action()); cmd->setDefaultKeySequence(QKeySequence("F6")); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); cmd = am->registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalcontext); #ifdef Q_WS_MAC cmd->setDefaultKeySequence(QKeySequence("Ctrl+9")); #else cmd->setDefaultKeySequence(QKeySequence("Alt+9")); #endif cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateIcon); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); connect(m_minMaxAction, SIGNAL(triggered()), this, SLOT(slotMinMax())); m_minMaxButton->setDefaultAction(cmd->action()); QAction *sep = new QAction(this); sep->setSeparator(true); cmd = am->registerAction(sep, "Coreplugin.OutputPane.Sep", globalcontext); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); QList<IOutputPane*> panes = ExtensionSystem::PluginManager::instance() ->getObjects<IOutputPane>(); QMultiMap<int, IOutputPane*> sorted; foreach (IOutputPane* outPane, panes) sorted.insertMulti(outPane->priorityInStatusBar(), outPane); QMultiMap<int, IOutputPane*>::const_iterator it, begin; begin = sorted.constBegin(); it = sorted.constEnd(); int shortcutNumber = 1; while (it != begin) { --it; IOutputPane* outPane = it.value(); const int idx = m_outputWidgetPane->addWidget(outPane->outputWidget(this)); m_pageMap.insert(idx, outPane); connect(outPane, SIGNAL(showPage(bool,bool)), this, SLOT(showPage(bool,bool))); connect(outPane, SIGNAL(hidePage()), this, SLOT(slotHide())); connect(outPane, SIGNAL(togglePage(bool)), this, SLOT(togglePage(bool))); connect(outPane, SIGNAL(navigateStateUpdate()), this, SLOT(updateNavigateState())); QWidget *toolButtonsContainer = new QWidget(m_opToolBarWidgets); QHBoxLayout *toolButtonsLayout = new QHBoxLayout; toolButtonsLayout->setMargin(0); toolButtonsLayout->setSpacing(0); foreach (QWidget *toolButton, outPane->toolBarWidgets()) toolButtonsLayout->addWidget(toolButton); toolButtonsLayout->addStretch(5); toolButtonsContainer->setLayout(toolButtonsLayout); m_opToolBarWidgets->addWidget(toolButtonsContainer); QString actionId = QString("QtCreator.Pane.%1").arg(outPane->displayName().simplified()); actionId.remove(QLatin1Char(' ')); QAction *action = new QAction(outPane->displayName(), this); Command *cmd = am->registerAction(action, Id(actionId), Context(Constants::C_GLOBAL)); mpanes->addAction(cmd, "Coreplugin.OutputPane.PanesGroup"); m_actions.insert(cmd->action(), idx); if (outPane->priorityInStatusBar() != -1) { cmd->setDefaultKeySequence(QKeySequence(paneShortCut(shortcutNumber))); QToolButton *button = new OutputPaneToggleButton(shortcutNumber, outPane->displayName(), cmd->action()); ++shortcutNumber; m_buttonsWidget->layout()->addWidget(button); connect(button, SIGNAL(clicked()), this, SLOT(buttonTriggered())); m_buttons.insert(idx, button); } // Now add the entry to the combobox, since the first item we add sets the currentIndex, thus we need to be set up for that m_widgetComboBox->addItem(outPane->displayName(), idx); connect(cmd->action(), SIGNAL(triggered()), this, SLOT(shortcutTriggered())); } changePage(); }
NotifyKindOptionsWidget::NotifyKindOptionsWidget(INotifications *ANotifications, QWidget *AParent) : QWidget(AParent) { FNotifications = ANotifications; tbwNotifies = new QTableWidget(this); tbwNotifies->setWordWrap(true); tbwNotifies->verticalHeader()->setVisible(false); tbwNotifies->horizontalHeader()->setHighlightSections(false); tbwNotifies->setSelectionMode(QTableWidget::NoSelection); connect(tbwNotifies,SIGNAL(itemChanged(QTableWidgetItem *)),SIGNAL(modified())); tbwNotifies->setColumnCount(NTC__COUNT); tbwNotifies->setHorizontalHeaderLabels(QStringList() << tr("Event") << "" << "" << "" << "" ); tbwNotifies->horizontalHeader()->SETRESIZEMODE(NTC_TYPE,QHeaderView::Stretch); tbwNotifies->horizontalHeader()->SETRESIZEMODE(NTC_SOUND,QHeaderView::ResizeToContents); tbwNotifies->horizontalHeaderItem(NTC_SOUND)->setToolTip(tr("Play sound at the notification")); tbwNotifies->horizontalHeaderItem(NTC_SOUND)->setIcon(IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->getIcon(MNI_NOTIFICATIONS_SOUNDPLAY)); tbwNotifies->horizontalHeader()->SETRESIZEMODE(NTC_POPUP,QHeaderView::ResizeToContents); tbwNotifies->horizontalHeaderItem(NTC_POPUP)->setToolTip(tr("Display a notification in popup window")); tbwNotifies->horizontalHeaderItem(NTC_POPUP)->setIcon(IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->getIcon(MNI_NOTIFICATIONS_PUPUPWINDOW)); tbwNotifies->horizontalHeader()->SETRESIZEMODE(NTC_MINIMIZED,QHeaderView::ResizeToContents); tbwNotifies->horizontalHeaderItem(NTC_MINIMIZED)->setToolTip(tr("Show the corresponding window minimized in the taskbar")); tbwNotifies->horizontalHeaderItem(NTC_MINIMIZED)->setIcon(IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->getIcon(MNI_NOTIFICATIONS_SHOWMINIMIZED)); tbwNotifies->horizontalHeader()->SETRESIZEMODE(NTC_TRAY,QHeaderView::ResizeToContents); tbwNotifies->horizontalHeaderItem(NTC_TRAY)->setToolTip(tr("Display a notification icon in the system tray")); tbwNotifies->horizontalHeaderItem(NTC_TRAY)->setIcon(IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->getIcon(MNI_NOTIFICATIONS_TRAYICON)); QVBoxLayout *vblLayout = new QVBoxLayout(this); vblLayout->addWidget(tbwNotifies); vblLayout->setMargin(0); QMultiMap<int, NotificationType> orderedTypes; ushort visibleKinds = INotification::PopupWindow|INotification::TrayNotify|INotification::SoundPlay|INotification::ShowMinimized; foreach(const QString &typeId, FNotifications->notificationTypes()) { NotificationType notifyType = FNotifications->notificationType(typeId); if (!notifyType.title.isEmpty() && (notifyType.kindMask & visibleKinds)>0) { notifyType.typeId = typeId; orderedTypes.insertMulti(notifyType.order,notifyType); } } for (QMultiMap<int, NotificationType>::const_iterator it=orderedTypes.constBegin(); it!=orderedTypes.constEnd(); ++it) { int row = tbwNotifies->rowCount(); tbwNotifies->setRowCount(row+1); QTableWidgetItem *type = new QTableWidgetItem(it->icon,it->title); type->setData(NTR_TYPE, it->typeId); type->setFlags(Qt::ItemIsEnabled); tbwNotifies->setItem(row,NTC_TYPE,type); QTableWidgetItem *sound = new QTableWidgetItem(); sound->setData(NTR_KIND, INotification::SoundPlay); if (it->kindMask & INotification::SoundPlay) sound->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); else sound->setFlags(Qt::ItemIsUserCheckable); sound->setCheckState(Qt::Unchecked); tbwNotifies->setItem(row,NTC_SOUND,sound); QTableWidgetItem *popup = new QTableWidgetItem(); popup->setData(NTR_KIND, INotification::PopupWindow); if (it->kindMask & INotification::PopupWindow) popup->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); else popup->setFlags(Qt::ItemIsUserCheckable); popup->setCheckState(Qt::Unchecked); tbwNotifies->setItem(row,NTC_POPUP,popup); QTableWidgetItem *minimized = new QTableWidgetItem(); minimized->setData(NTR_KIND, INotification::ShowMinimized); if (it->kindMask & INotification::ShowMinimized) minimized->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); else minimized->setFlags(Qt::ItemIsUserCheckable); minimized->setCheckState(Qt::Unchecked); tbwNotifies->setItem(row,NTC_MINIMIZED,minimized); tbwNotifies->verticalHeader()->SETRESIZEMODE(row,QHeaderView::ResizeToContents); QTableWidgetItem *tray = new QTableWidgetItem(); tray->setData(NTR_KIND, INotification::TrayNotify); if (it->kindMask & INotification::TrayNotify) tray->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); else tray->setFlags(Qt::ItemIsUserCheckable); tray->setCheckState(Qt::Unchecked); tbwNotifies->setItem(row,NTC_TRAY,tray); tbwNotifies->verticalHeader()->SETRESIZEMODE(row,QHeaderView::ResizeToContents); } reset(); }
QMultiMap<int, IOptionsDialogWidget *> StatusIcons::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; if (FOptionsManager!=NULL && ANodeId==OPN_APPEARANCE) { QComboBox *cmbStatusIcons = new QComboBox(AParent); cmbStatusIcons->setItemDelegate(new IconsetDelegate(cmbStatusIcons)); int index = 0; for (QMap<QString, IconStorage *>::const_iterator it=FStorages.constBegin(); it!=FStorages.constEnd(); ++it) { QString name = it.value()->storageProperty(FILE_STORAGE_NAME,it.key()); cmbStatusIcons->addItem(it.value()->getIcon(SIK_ONLINE),name,it.key()); cmbStatusIcons->setItemData(index,it.value()->storage(),IconsetDelegate::IDR_STORAGE); cmbStatusIcons->setItemData(index,it.value()->subStorage(),IconsetDelegate::IDR_SUBSTORAGE); cmbStatusIcons->setItemData(index,true,IconsetDelegate::IDR_HIDE_STORAGE_NAME); index++; } cmbStatusIcons->model()->sort(0); widgets.insertMulti(OHO_APPEARANCE_ROSTER, FOptionsManager->newOptionsDialogHeader(tr("Contacts list"),AParent)); widgets.insertMulti(OWO_APPEARANCE_STATUSICONS, FOptionsManager->newOptionsDialogWidget(Options::node(OPV_STATUSICONS_DEFAULT),tr("Status icons:"),cmbStatusIcons,AParent)); } return widgets; }