int wmain(int argc, wchar_t *argv[]) { PCWSTR cmd; if (argc == 1) { printUsage(); return 0; } cmd = argv[1]; if (_wcsicmp(cmd, L"start") == 0) { return startVBoxSrv(); } else if (_wcsicmp(cmd, L"addconn") == 0) { if (argc < 4) { printUsage(); return 0; } return addConn(argv[2], argv[3]); } else if (_wcsicmp(cmd, L"getlist") == 0) { return getList(); } else if (_wcsicmp(cmd, L"getgloballist") == 0) { return getGlobalList(); } else if (_wcsicmp(cmd, L"autolink") == 0) { return autoStart(FALSE); } else if (_wcsicmp(cmd, L"autoassign") == 0) { return autoStart(TRUE); } else { printUsage(); return 0; } }
void RouterKeygen::startUpRunToggle(bool state) { runOnStartUp = state; settings->setValue(RUN_ON_START_UP, runOnStartUp); #ifdef Q_OS_UNIX QString newFile = "/home/" + QString(getenv("USER")) + "/.config/autostart/routerkeygen.desktop"; qDebug() << newFile; if (runOnStartUp) { QFile autoStart(":/routerkeygen.desktop"); if (!autoStart.copy(newFile)) qDebug() << "Error while copying file"; QFile::setPermissions(newFile, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::WriteUser | QFile::ReadGroup | QFile::ReadGroup | QFile::ReadOther); } else { if (QFile::exists(newFile)) if (!QFile::remove(newFile)) qDebug() << "Error while removing file"; } #endif #ifdef Q_OS_WIN QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",QSettings::NativeFormat); if (runOnStartUp) { settings.setValue("RouterKeygen", QCoreApplication::applicationFilePath().replace('/','\\')+ " -h"); } else { settings.remove("RouterKeygen"); } #endif }
void GlassWidget::configData() { bool autostart=autoStart(); gw_config_dialog->exec(&autostart); setAutoStart(autostart); emit configurationChanged(this); }
void TouchpadConfig::accept() { for (const TouchpadDevice& device : devices) { device.saveSettings(settings); } LXQt::AutostartEntry autoStart("lxqt-config-touchpad-autostart.desktop"); XdgDesktopFile desktopFile(XdgDesktopFile::ApplicationType, "lxqt-config-touchpad-autostart", "lxqt-config-input --load-touchpad"); desktopFile.setValue("OnlyShowIn", "LXQt"); desktopFile.setValue("Comment", "Autostart touchpad settings for lxqt-config-input"); autoStart.setFile(desktopFile); autoStart.commit(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { int x=(QApplication::desktop()->width() - this->width())/2; int y=(QApplication::desktop()->height() - this->height())/2; int readSet=readSetting(); ui->setupUi(this); this->move (x,y); ui->txtbInfo->document()->setMaximumBlockCount(MaxLine); ui->btStart->setShortcut(Qt::Key_A); ui->btOpen->setShortcut(Qt::Key_O); ui->btQuit->setShortcut(Qt::Key_S); ui->lbInfo->setText(welcome); autoStart(); autoHideWin(); }
int PropertiesManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 3) qt_static_metacall(this, _c, _id, _a); _id -= 3; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = intermittentPeriod(); break; case 1: *reinterpret_cast< bool*>(_v) = autoStart(); break; case 2: *reinterpret_cast< bool*>(_v) = awake(); break; } _id -= 3; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setIntermittentPeriod(*reinterpret_cast< int*>(_v)); break; case 1: setAutoStart(*reinterpret_cast< bool*>(_v)); break; case 2: setAwake(*reinterpret_cast< bool*>(_v)); break; } _id -= 3; } else if (_c == QMetaObject::ResetProperty) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 3; } #endif // QT_NO_PROPERTIES return _id; }
ServiceJob *Service::startOperationCall(const KConfigGroup &description, QObject *parent) { // TODO: nested groups? ServiceJob *job = 0; const QString op = description.isValid() ? description.name() : QString(); RemoteService *rs = qobject_cast<RemoteService *>(this); if (!op.isEmpty() && rs && !rs->isReady()) { // if we have an operation, but a non-ready remote service, just let it through kDebug() << "Remote service is not ready; queueing operation"; QMap<QString, QVariant> params; job = createJob(op, params); RemoteServiceJob *rsj = qobject_cast<RemoteServiceJob *>(job); if (rsj) { rsj->setDelayedDescription(description); } } else if (!d->config) { kDebug() << "No valid operations scheme has been registered"; } else if (!op.isEmpty() && d->config->hasGroup(op)) { if (d->disabledOperations.contains(op)) { kDebug() << "Operation" << op << "is disabled"; } else { QMap<QString, QVariant> params = parametersFromDescription(description); job = createJob(op, params); } } else { kDebug() << op << "is not a valid group; valid groups are:" << d->config->groupList(); } if (!job) { job = new NullServiceJob(destination(), op, this); } job->setParent(parent ? parent : this); connect(job, SIGNAL(finished(KJob*)), this, SLOT(jobFinished(KJob*))); QTimer::singleShot(0, job, SLOT(autoStart())); return job; }
static LRESULT CALLBACK mainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: // save data if (saveMainWindow(hwnd, true)) { // quit PostQuitMessage(0); } return 0; case IDOK: case IDC_MAIN_TEST: { // note if testing const bool testing = (LOWORD(wParam) == IDC_MAIN_TEST); // save data if (saveMainWindow(hwnd, false)) { // launch child app DWORD threadID; HANDLE thread = launchApp(hwnd, testing, &threadID); if (thread == NULL) { return 0; } // handle child program if (testing) { // wait for process to stop, allowing the user to kill it waitForChild(hwnd, thread, threadID); // clean up CloseHandle(thread); } else { // don't need thread handle CloseHandle(thread); // notify of success askOkay(hwnd, getString(IDS_STARTED_TITLE), getString(IDS_STARTED)); // quit PostQuitMessage(0); } } return 0; } case IDC_MAIN_AUTOSTART: { CString cmdLine; if (saveMainWindow(hwnd, false, &cmdLine)) { // run dialog CAutoStart autoStart(hwnd, !isClientChecked(hwnd), cmdLine); autoStart.doModal(); } return 0; } case IDC_MAIN_CLIENT_RADIO: case IDC_MAIN_SERVER_RADIO: enableMainWindowControls(hwnd); return 0; case IDC_MAIN_SCREENS: s_screensLinks->doModal(); break; case IDC_MAIN_OPTIONS: s_globalOptions->doModal(); break; case IDC_MAIN_ADVANCED: s_advancedOptions->doModal(isClientChecked(hwnd)); break; } default: break; } return DefDlgProc(hwnd, message, wParam, lParam); }
int ONVIF::AudioEncoderConfiguration::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 13) qt_static_metacall(this, _c, _id, _a); _id -= 13; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 13) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 13; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = token(); break; case 1: *reinterpret_cast< QString*>(_v) = name(); break; case 2: *reinterpret_cast< int*>(_v) = useCount(); break; case 3: *reinterpret_cast< QString*>(_v) = encoding(); break; case 4: *reinterpret_cast< int*>(_v) = bitrate(); break; case 5: *reinterpret_cast< int*>(_v) = sampleRate(); break; case 6: *reinterpret_cast< QString*>(_v) = type(); break; case 7: *reinterpret_cast< QString*>(_v) = ipv4Address(); break; case 8: *reinterpret_cast< QString*>(_v) = ipv6Address(); break; case 9: *reinterpret_cast< int*>(_v) = port(); break; case 10: *reinterpret_cast< int*>(_v) = ttl(); break; case 11: *reinterpret_cast< bool*>(_v) = autoStart(); break; case 12: *reinterpret_cast< QString*>(_v) = sessionTimeout(); break; } _id -= 13; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setToken(*reinterpret_cast< QString*>(_v)); break; case 1: setName(*reinterpret_cast< QString*>(_v)); break; case 2: setUseCount(*reinterpret_cast< int*>(_v)); break; case 3: setEncoding(*reinterpret_cast< QString*>(_v)); break; case 4: setBitrate(*reinterpret_cast< int*>(_v)); break; case 5: setSampleRate(*reinterpret_cast< int*>(_v)); break; case 6: setType(*reinterpret_cast< QString*>(_v)); break; case 7: setIpv4Address(*reinterpret_cast< QString*>(_v)); break; case 8: setIpv6Address(*reinterpret_cast< QString*>(_v)); break; case 9: setPort(*reinterpret_cast< int*>(_v)); break; case 10: setTtl(*reinterpret_cast< int*>(_v)); break; case 11: setAutoStart(*reinterpret_cast< bool*>(_v)); break; case 12: setSessionTimeout(*reinterpret_cast< QString*>(_v)); break; } _id -= 13; } else if (_c == QMetaObject::ResetProperty) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 13; } else if (_c == QMetaObject::RegisterPropertyMetaType) { if (_id < 13) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 13; } #endif // QT_NO_PROPERTIES return _id; }
int ONVIF::VideoEncoderConfiguration::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 19) qt_static_metacall(this, _c, _id, _a); _id -= 19; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 19) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 19; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = token(); break; case 1: *reinterpret_cast< QString*>(_v) = name(); break; case 2: *reinterpret_cast< int*>(_v) = useCount(); break; case 3: *reinterpret_cast< QString*>(_v) = encoding(); break; case 4: *reinterpret_cast< int*>(_v) = width(); break; case 5: *reinterpret_cast< int*>(_v) = height(); break; case 6: *reinterpret_cast< int*>(_v) = quality(); break; case 7: *reinterpret_cast< int*>(_v) = frameRateLimit(); break; case 8: *reinterpret_cast< int*>(_v) = encodingInterval(); break; case 9: *reinterpret_cast< int*>(_v) = bitrateLimit(); break; case 10: *reinterpret_cast< int*>(_v) = govLength(); break; case 11: *reinterpret_cast< QString*>(_v) = h264Profile(); break; case 12: *reinterpret_cast< QString*>(_v) = type(); break; case 13: *reinterpret_cast< QString*>(_v) = ipv4Address(); break; case 14: *reinterpret_cast< QString*>(_v) = ipv6Address(); break; case 15: *reinterpret_cast< int*>(_v) = port(); break; case 16: *reinterpret_cast< int*>(_v) = ttl(); break; case 17: *reinterpret_cast< bool*>(_v) = autoStart(); break; case 18: *reinterpret_cast< QString*>(_v) = sessionTimeout(); break; default: break; } _id -= 19; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setToken(*reinterpret_cast< QString*>(_v)); break; case 1: setName(*reinterpret_cast< QString*>(_v)); break; case 2: setUseCount(*reinterpret_cast< int*>(_v)); break; case 3: setEncoding(*reinterpret_cast< QString*>(_v)); break; case 4: setWidth(*reinterpret_cast< int*>(_v)); break; case 5: setHeight(*reinterpret_cast< int*>(_v)); break; case 6: setQuality(*reinterpret_cast< int*>(_v)); break; case 7: setFrameRateLimit(*reinterpret_cast< int*>(_v)); break; case 8: setEncodingInterval(*reinterpret_cast< int*>(_v)); break; case 9: setBitrateLimit(*reinterpret_cast< int*>(_v)); break; case 10: setGovLength(*reinterpret_cast< int*>(_v)); break; case 11: setH264Profile(*reinterpret_cast< QString*>(_v)); break; case 12: setType(*reinterpret_cast< QString*>(_v)); break; case 13: setIpv4Address(*reinterpret_cast< QString*>(_v)); break; case 14: setIpv6Address(*reinterpret_cast< QString*>(_v)); break; case 15: setPort(*reinterpret_cast< int*>(_v)); break; case 16: setTtl(*reinterpret_cast< int*>(_v)); break; case 17: setAutoStart(*reinterpret_cast< bool*>(_v)); break; case 18: setSessionTimeout(*reinterpret_cast< QString*>(_v)); break; default: break; } _id -= 19; } else if (_c == QMetaObject::ResetProperty) { _id -= 19; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 19; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 19; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 19; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 19; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 19; } else if (_c == QMetaObject::RegisterPropertyMetaType) { if (_id < 19) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 19; } #endif // QT_NO_PROPERTIES return _id; }
static LRESULT CALLBACK mainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: // test for unsaved data if (ARG->m_config != ARG->m_oldConfig) { if (!askVerify(hwnd, getString(IDS_UNSAVED_DATA_REALLY_QUIT))) { return 0; } } // quit PostQuitMessage(0); return 0; case IDOK: case IDC_MAIN_TEST: { // note if testing const bool testing = (LOWORD(wParam) == IDC_MAIN_TEST); // save data if (ARG->m_config != ARG->m_oldConfig) { if (!saveConfig(ARG->m_config, false)) { showError(hwnd, CStringUtil::format( getString(IDS_SAVE_FAILED).c_str(), getErrorString(GetLastError()).c_str())); return 0; } ARG->m_oldConfig = ARG->m_config; enableSaveControls(hwnd); } // launch child app DWORD threadID; HANDLE thread = launchApp(hwnd, testing, &threadID); if (thread == NULL) { return 0; } // handle child program if (testing) { // wait for process to stop, allowing the user to kill it waitForChild(hwnd, thread, threadID); // clean up CloseHandle(thread); } else { // don't need thread handle CloseHandle(thread); // notify of success askOkay(hwnd, getString(IDS_STARTED_TITLE), getString(IDS_STARTED)); // quit PostQuitMessage(0); } return 0; } case IDC_MAIN_AUTOSTART: { // construct command line CString cmdLine = getCommandLine(hwnd, false); if (!cmdLine.empty()) { // run dialog CAutoStart autoStart(hwnd, isClientChecked(hwnd) ? NULL : &ARG->m_config, cmdLine); autoStart.doModal(); if (autoStart.wasUserConfigSaved()) { ARG->m_oldConfig = ARG->m_config; enableSaveControls(hwnd); } } return 0; } case IDC_MAIN_SAVE: if (!saveConfig(ARG->m_config, false)) { showError(hwnd, CStringUtil::format( getString(IDS_SAVE_FAILED).c_str(), getErrorString(GetLastError()).c_str())); } else { ARG->m_oldConfig = ARG->m_config; enableSaveControls(hwnd); } return 0; case IDC_MAIN_CLIENT_RADIO: case IDC_MAIN_SERVER_RADIO: enableMainWindowControls(hwnd); return 0; case IDC_MAIN_SERVER_ADD_BUTTON: addScreen(hwnd); return 0; case IDC_MAIN_SERVER_EDIT_BUTTON: editScreen(hwnd); return 0; case IDC_MAIN_SERVER_REMOVE_BUTTON: removeScreen(hwnd); return 0; case IDC_MAIN_SERVER_SCREENS_LIST: if (HIWORD(wParam) == LBN_SELCHANGE) { enableScreensControls(hwnd); updateNeighbors(hwnd); } else if (HIWORD(wParam) == LBN_DBLCLK) { editScreen(hwnd); return 0; } break; case IDC_MAIN_SERVER_LEFT_COMBO: if (HIWORD(wParam) == CBN_SELENDOK) { changeNeighbor(hwnd, (HWND)lParam, kLeft); return 0; } break; case IDC_MAIN_SERVER_RIGHT_COMBO: if (HIWORD(wParam) == CBN_SELENDOK) { changeNeighbor(hwnd, (HWND)lParam, kRight); return 0; } break; case IDC_MAIN_SERVER_TOP_COMBO: if (HIWORD(wParam) == CBN_SELENDOK) { changeNeighbor(hwnd, (HWND)lParam, kTop); return 0; } break; case IDC_MAIN_SERVER_BOTTOM_COMBO: if (HIWORD(wParam) == CBN_SELENDOK) { changeNeighbor(hwnd, (HWND)lParam, kBottom); return 0; } break; case IDC_MAIN_OPTIONS: s_globalOptions->doModal(); enableSaveControls(hwnd); break; case IDC_MAIN_ADVANCED: s_advancedOptions->doModal(isClientChecked(hwnd)); enableSaveControls(hwnd); break; } default: break; } return DefDlgProc(hwnd, message, wParam, lParam); }
static LRESULT CALLBACK mainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_ACTIVATE: if (LOWORD(wParam) != WA_INACTIVE) { // activated // see if the configuration changed if (isConfigNewer(s_configTime, s_userConfig)) { CString message2 = getString(IDS_CONFIG_CHANGED); if (askVerify(hwnd, message2)) { time_t configTime; bool userConfig; CConfig newConfig; if (loadConfig(newConfig, configTime, userConfig) && userConfig == s_userConfig) { ARG->m_config = newConfig; s_lastConfig = ARG->m_config; } else { message2 = getString(IDS_LOAD_FAILED); showError(hwnd, message2); s_lastConfig = CConfig(); } } } } else { // deactivated; write configuration if (!isShowingDialog()) { saveMainWindow(hwnd, SAVE_QUIET); } } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: // save data if (saveMainWindow(hwnd, SAVE_QUITING)) { // quit PostQuitMessage(0); } return 0; case IDOK: case IDC_MAIN_TEST: { // note if testing const bool testing = (LOWORD(wParam) == IDC_MAIN_TEST); // save data if (saveMainWindow(hwnd, SAVE_NORMAL)) { // launch child app DWORD threadID; HANDLE thread; if (!launchApp(hwnd, testing, &thread, &threadID)) { return 0; } // handle child program if (testing) { // wait for process to stop, allowing the user to kill it waitForChild(hwnd, thread, threadID); // clean up CloseHandle(thread); } else { // don't need thread handle if (thread != NULL) { CloseHandle(thread); } // notify of success: now disabled - it's silly to notify a success //askOkay(hwnd, getString(IDS_STARTED_TITLE), getString(IDS_STARTED)); // quit PostQuitMessage(0); } } return 0; } case IDC_MAIN_AUTOSTART: { CString cmdLine; if (saveMainWindow(hwnd, SAVE_NORMAL, &cmdLine)) { // run dialog CAutoStart autoStart(hwnd, !isClientChecked(hwnd), cmdLine); autoStart.doModal(); } return 0; } case IDC_MAIN_CLIENT_RADIO: case IDC_MAIN_SERVER_RADIO: enableMainWindowControls(hwnd); return 0; case IDC_MAIN_SCREENS: s_screensLinks->doModal(); break; case IDC_MAIN_OPTIONS: s_globalOptions->doModal(); break; case IDC_MAIN_ADVANCED: s_advancedOptions->doModal(isClientChecked(hwnd)); break; case IDC_MAIN_HOTKEYS: s_hotkeyOptions->doModal(); break; case IDC_MAIN_INFO: s_info->doModal(); break; } default: break; } return DefDlgProc(hwnd, message, wParam, lParam); }