void PathInfo::Build() { float x, y, z; // set start and a default next position m_sourceObject->GetPosition(x, y, z); setStartPosition(x, y, z); setNextPosition(x, y, z); // get nav mesh m_navMesh = m_sourceObject->GetMap()->GetNavMesh(); if(!m_navMesh) { // if there is no navmesh, just move to destination shortcut(); return; } float extents[3] = {2.0f, 4.0f, 2.0f}; // defines bounds of box for search area dtQueryFilter filter = dtQueryFilter(); // use general filter so we know if we are near navmesh // get start and end positions getStartPosition(x, y, z); float startPos[3] = {y, z, x}; getEndPosition(x, y, z); float endPos[3] = {y, z, x}; // find start and end poly dtPolyRef startPoly = m_navMesh->findNearestPoly(startPos, extents, &filter, 0); dtPolyRef endPoly = m_navMesh->findNearestPoly(endPos, extents, &filter, 0); Build(startPoly, endPoly); }
void Pgr_linear<G>::add_shortcut( G &graph, V vertex, E incoming_edge, E outgoing_edge) { pgassert(incoming_edge != outgoing_edge); auto a = graph.adjacent(vertex, incoming_edge); auto c = graph.adjacent(vertex, outgoing_edge); pgassert(a != vertex); pgassert(a != c); pgassert(vertex != c); if (graph.is_undirected()) { Identifiers<V> adjacent_vertices = graph.find_adjacent_vertices(vertex); V vertex_1 = adjacent_vertices.front(); adjacent_vertices.pop_front(); V vertex_2 = adjacent_vertices.front(); adjacent_vertices.pop_front(); E shortcut_E; CH_edge shortcut(get_next_id(), graph[vertex_1].id, graph[vertex_2].id, graph[incoming_edge].cost + graph[outgoing_edge].cost); shortcut.add_contracted_vertex(graph[vertex], vertex); shortcut.add_contracted_edge_vertices(graph[incoming_edge]); shortcut.add_contracted_edge_vertices(graph[outgoing_edge]); debug << "Adding shortcut\n"; debug << shortcut; graph.add_shortcut(shortcut); debug << "Added shortcut\n"; } else { CH_edge shortcut( get_next_id(), graph[a].id, graph[c].id, graph[incoming_edge].cost + graph[outgoing_edge].cost); shortcut.add_contracted_vertex(graph[vertex], vertex); shortcut.add_contracted_edge_vertices(graph[incoming_edge]); shortcut.add_contracted_edge_vertices(graph[outgoing_edge]); debug << "Adding shortcut\n"; debug << shortcut; graph.add_shortcut(shortcut); debug << "Added shortcut\n"; } }
bool Shortcut_trigger::handle_key(const KShortcut &shortcut_P) { if(shortcut() == shortcut_P) { windows_handler->set_action_window(0); // use active window data->execute(); return true; } return false; }
void ValueSetters::RunOnBootValueSetter(QString group, QString name, QVariant value) { bool runOnBoot = value.toBool(); #ifdef Q_WS_WIN QSettings bootUpSettings(QString("HKEY_LOCAL_MACHINE\\SOFTWARE\\") + (StaticHelpers::IsWow64() ? "Wow6432Node\\" : "") + "Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat); QString applicationFilePath = QDir::toNativeSeparators(QFileInfo(QApplication::applicationFilePath()).absoluteFilePath()); if (runOnBoot) { bootUpSettings.setValue("CuteTorrent", "\"" + applicationFilePath + "\""); } else { bootUpSettings.remove("CuteTorrent"); } #elif Q_WS_X11 if (runOnBoot) { if (!QFile::exists(StaticHelpers::CombinePathes(QDir::homePath(), ".config/autostart/CuteTorrent.desktop"))) { QFile shortcut("/usr/share/applications/CuteTorrent.desktop"); if (!shortcut.copy(StaticHelpers::CombinePathes(QDir::homePath(), ".config/autostart/CuteTorrent.desktop"))) { qCritical() << "Unable to copy /usr/share/applications/CuteTorrent.desktop to ~/.config/autostart/CuteTorrent.desktop" << shortcut.errorString(); } } } else { QFile shortcut(StaticHelpers::CombinePathes(QDir::homePath(), ".config/autostart/CuteTorrent.desktop")); if (shortcut.exists()) { if (!shortcut.remove()) { qCritical() << "failed to remove ~/.config/autostart/CuteTorrent.desktop" << shortcut.errorString(); } } } #endif }
void QQuickMenuItem::updateShortcut() { if (platformItem()) { QKeySequence sequence; QVariant var = shortcut(); if (var.type() == QVariant::Int) sequence = QKeySequence(static_cast<QKeySequence::StandardKey>(var.toInt())); else sequence = QKeySequence::fromString(var.toString(), QKeySequence::NativeText); platformItem()->setShortcut(sequence); syncWithPlatformMenu(); } emit shortcutChanged(); }
void retranslateUi() { switch (m_iState) { case 0: { setName(QApplication::translate("UIActionPool", "S&tart")); setStatusTip(QApplication::translate("UIActionPool", "Start the selected virtual machines")); setToolTip(text().remove('&').remove('.') + (shortcut().toString().isEmpty() ? "" : QString(" (%1)").arg(shortcut().toString()))); break; } case 1: { setName(QApplication::translate("UIActionPool", "S&how")); setStatusTip(QApplication::translate("UIActionPool", "Switch to the windows of the selected virtual machines")); setToolTip(text().remove('&').remove('.') + (shortcut().toString().isEmpty() ? "" : QString(" (%1)").arg(shortcut().toString()))); break; } default: break; } }
void ShortcutDialog::accept() { QKeySequence seq = shortcut(); if (!seq.isEmpty()) { if (seq[0] == Qt::Key_Escape) { reject(); return; } if (seq[0] == Qt::Key_Space || (seq[0] & Qt::KeyboardModifierMask) == 0) { // clear widget->clearKeySequence(); KDialog::accept(); return; } } KDialog::accept(); }
void KMFolder::readConfig( KConfigGroup & configGroup ) { // KConfigGroup configGroup(config, ""); if ( !configGroup.readEntry( "SystemLabel" ).isEmpty() ) mSystemLabel = configGroup.readEntry( "SystemLabel" ); mExpireMessages = configGroup.readEntry( "ExpireMessages", false ); mReadExpireAge = configGroup.readEntry( "ReadExpireAge", 3 ); mReadExpireUnits = (ExpireUnits)configGroup.readEntry( "ReadExpireUnits", (int)expireMonths ); mUnreadExpireAge = configGroup.readEntry( "UnreadExpireAge", 12 ); mUnreadExpireUnits = (ExpireUnits) configGroup.readEntry( "UnreadExpireUnits", (int)expireNever ); mExpireAction = configGroup.readEntry( "ExpireAction", "Delete") == "Move" ? ExpireMove : ExpireDelete; mExpireToFolderId = configGroup.readEntry( "ExpireToFolder" ); mUseCustomIcons = configGroup.readEntry( "UseCustomIcons", false ); mNormalIconPath = configGroup.readEntry( "NormalIconPath" ); mUnreadIconPath = configGroup.readEntry( "UnreadIconPath" ); mMailingListEnabled = configGroup.readEntry( "MailingListEnabled", false ); mMailingList.readConfig( configGroup ); mUseDefaultIdentity = configGroup.readEntry( "UseDefaultIdentity", true ); uint defaultIdentity = kmkernel->identityManager()->defaultIdentity().uoid(); mIdentity = configGroup.readEntry("Identity", defaultIdentity ); slotIdentitiesChanged(); setUserWhoField( configGroup.readEntry( "WhoField" ), false ); uint savedId = configGroup.readEntry( "Id", 0 ); // make sure that we don't overwrite a valid id if ( savedId != 0 && mId == 0 ) mId = savedId; mPutRepliesInSameFolder = configGroup.readEntry( "PutRepliesInSameFolder", false ); mHideInSelectionDialog = configGroup.readEntry( "HideInSelectionDialog", false ); setIgnoreNewMail( configGroup.readEntry( "IgnoreNewMail", false ) ); if ( mUseCustomIcons ) emit iconsChanged(); QString shortcut( configGroup.readEntry( "Shortcut" ) ); if ( !shortcut.isEmpty() ) { KShortcut sc( shortcut ); setShortcut( sc ); } }
void BtActionCollection::readSettings() { QSettings* settings = CBTConfig::getConfig(); settings->beginGroup(m_groupName); QStringList keyList = settings->childKeys(); for (int i = 0; i < keyList.size(); i++) { QString key = keyList.at(i); QVariant variant = settings->value(key); QList<QKeySequence> shortcuts; if ( variant != QVariant()) { QList<QVariant> varShortcuts = variant.toList(); for (int i = 0; i < varShortcuts.count(); i++) { QString keys = varShortcuts.at(i).toString(); QKeySequence shortcut(keys); shortcuts.append(shortcut); } } action(key)->setShortcuts(shortcuts); } settings->endGroup(); }
bool MenuCommands::SetShortcuts(int ind, QString shorts) { QStringList list = shorts.split(QChar(' ')); QString key = Get(ind,Key); int i = 0; foreach(QString s, list) { if (!s.trimmed().isEmpty()) { QKeySequence shortcut(s.trimmed()); if (shortcut.isEmpty()) return false; m_data.setValue(key + QString("_%1").arg(++i), shortcut.toString() ); } } QString shortcut = m_data.value(key + QString("_%1").arg(++i) ).toString(); if (!shortcut.isEmpty()) m_data.setValue(key + QString("_%1").arg(i), ""); return true; }
void QQuickAction::setShortcut(const QVariant &arg) { QKeySequence sequence; if (arg.type() == QVariant::Int) sequence = QKeySequence(static_cast<QKeySequence::StandardKey>(arg.toInt())); else sequence = QKeySequence::fromString(arg.toString()); if (sequence == m_shortcut) return; if (!m_shortcut.isEmpty()) QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(0, this, m_shortcut); m_shortcut = sequence; if (!m_shortcut.isEmpty()) { Qt::ShortcutContext context = Qt::WindowShortcut; QGuiApplicationPrivate::instance()->shortcutMap.addShortcut(this, m_shortcut, context, qShortcutContextMatcher); } emit shortcutChanged(shortcut()); }
const KShortcut& forward() { return shortcut( Forward ); }
const KShortcut& back() { return shortcut( Back ); }
const KShortcut& up() { return shortcut( Up ); }
const KShortcut& selectAll() { return shortcut( SelectAll ); }
const KShortcut& reload() { return shortcut( Reload ); }
const KShortcut& zoomIn() { return shortcut( ZoomIn ); }
void ShortcutButton::addShortcut(const QString &shortcutPortableText) { QKeySequence shortcut(shortcutPortableText, QKeySequence::PortableText); if ( !shortcut.isEmpty() ) addShortcut(shortcut); }
const KShortcut& rotateDown() { return shortcut( RotateDown ); }
const KShortcut& prevCompletion() { return shortcut( PrevCompletion ); }
const KShortcut& completion() { return shortcut( TextCompletion ); }
const KShortcut& help() { return shortcut( Help ); }
const KShortcut& zoomOut() { return shortcut( ZoomOut ); }
const KShortcut& showMenubar() { return shortcut( ShowMenubar ); }
const KShortcut& substringCompletion() { return shortcut( SubstringCompletion ); }
const KShortcut& whatsThis() { return shortcut( WhatsThis ); }
const KShortcut& nextCompletion() { return shortcut( NextCompletion ); }
const KShortcut& fullScreen() { return shortcut( FullScreen ); }
int QAbstractButton::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: pressed(); break; case 1: released(); break; case 2: clicked((*reinterpret_cast< bool(*)>(_a[1]))); break; case 3: clicked(); break; case 4: toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 5: setIconSize((*reinterpret_cast< const QSize(*)>(_a[1]))); break; case 6: animateClick((*reinterpret_cast< int(*)>(_a[1]))); break; case 7: animateClick(); break; case 8: click(); break; case 9: toggle(); break; case 10: setChecked((*reinterpret_cast< bool(*)>(_a[1]))); break; case 11: setOn((*reinterpret_cast< bool(*)>(_a[1]))); break; } _id -= 12; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = text(); break; case 1: *reinterpret_cast< QIcon*>(_v) = icon(); break; case 2: *reinterpret_cast< QSize*>(_v) = iconSize(); break; case 3: *reinterpret_cast< QKeySequence*>(_v) = shortcut(); break; case 4: *reinterpret_cast< bool*>(_v) = isCheckable(); break; case 5: *reinterpret_cast< bool*>(_v) = isChecked(); break; case 6: *reinterpret_cast< bool*>(_v) = autoRepeat(); break; case 7: *reinterpret_cast< bool*>(_v) = autoExclusive(); break; case 8: *reinterpret_cast< int*>(_v) = autoRepeatDelay(); break; case 9: *reinterpret_cast< int*>(_v) = autoRepeatInterval(); break; case 10: *reinterpret_cast< bool*>(_v) = isDown(); break; } _id -= 11; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setText(*reinterpret_cast< QString*>(_v)); break; case 1: setIcon(*reinterpret_cast< QIcon*>(_v)); break; case 2: setIconSize(*reinterpret_cast< QSize*>(_v)); break; case 3: setShortcut(*reinterpret_cast< QKeySequence*>(_v)); break; case 4: setCheckable(*reinterpret_cast< bool*>(_v)); break; case 5: setChecked(*reinterpret_cast< bool*>(_v)); break; case 6: setAutoRepeat(*reinterpret_cast< bool*>(_v)); break; case 7: setAutoExclusive(*reinterpret_cast< bool*>(_v)); break; case 8: setAutoRepeatDelay(*reinterpret_cast< int*>(_v)); break; case 9: setAutoRepeatInterval(*reinterpret_cast< int*>(_v)); break; case 10: setDown(*reinterpret_cast< bool*>(_v)); break; } _id -= 11; } else if (_c == QMetaObject::ResetProperty) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyDesignable) { bool *_b = reinterpret_cast<bool*>(_a[0]); switch (_id) { case 5: *_b = isCheckable(); break; } _id -= 11; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 11; } #endif // QT_NO_PROPERTIES return _id; }
const KShortcut& rotateUp() { return shortcut( RotateUp ); }