void gridUnitEnvironmentVariable() { QByteArray gridUnit = QString::number(11).toLocal8Bit(); qputenv("GRID_UNIT_PX", gridUnit); UCUnits units; QCOMPARE(units.gridUnit(), 11.0); qputenv("GRID_UNIT_PX", ""); }
void IQmolApplication::initOpenBabel() { QDir dir(QApplication::applicationDirPath()); QString path; #ifdef Q_OS_MAC // Assumed directory structure: IQmol.app/Contents/MacOS/IQmol dir.cdUp(); path = dir.absolutePath(); QApplication::addLibraryPath(path + "/Frameworks"); QApplication::addLibraryPath(path + "/PlugIns"); #endif #ifdef Q_OS_WIN32 // Assumed directory structure: IQmol/bin/IQmol dir.cdUp(); path = dir.absolutePath(); QApplication::addLibraryPath(path + "/lib"); QApplication::addLibraryPath(path + "/lib/plugins"); #endif #ifdef Q_OS_LINUX // Assumed directory structure: IQmol/IQmol // This is so that when the executable is created it can be // run from the main IQmol directory path = dir.absolutePath(); QApplication::addLibraryPath(path + "/lib"); QApplication::addLibraryPath(path + "/lib/plugins"); #endif // This is not used any more as we ship with a static // version of OpenBabel QString env(qgetenv("BABEL_LIBDIR")); if (env.isEmpty()) { env = path + "/lib/openbabel"; qputenv("BABEL_LIBDIR", env.toLatin1()); QLOG_INFO() << "Setting BABEL_LIBDIR = " << env; }else { QLOG_INFO() << "BABEL_LIBDIR already set: " << env; } env = qgetenv("BABEL_DATADIR"); if (env.isEmpty()) { #if defined(Q_OS_LINUX) // Overide the above for the deb package installation. env ="/usr/share/iqmol/openbabel"; #else env = path + "/share/openbabel"; #endif qputenv("BABEL_DATADIR", env.toLatin1()); QLOG_INFO() << "Setting BABEL_DATADIR = " << env; }else { QLOG_INFO() << "BABEL_DATADIR already set: " << env; } }
void IQmolApplication::initOpenBabel() { QDir dir(QApplication::applicationDirPath()); dir.cdUp(); QString path(dir.absolutePath()); #ifdef Q_WS_MAC // Assumed directory structure: IQmol.app/Contents/MacOS/IQmol QApplication::addLibraryPath(path + "/Frameworks"); QApplication::addLibraryPath(path + "/PlugIns"); #else // Assumed directory structure: IQmol-xx/bin/IQmol QApplication::addLibraryPath(path + "/lib"); QApplication::addLibraryPath(path + "/lib/plugins"); #endif #ifdef Q_OS_LINUX return; #endif QString env(qgetenv("BABEL_LIBDIR")); if (env.isEmpty()) { env = path + "/lib/openbabel"; qputenv("BABEL_LIBDIR", env.toAscii()); QLOG_INFO() << "Setting BABEL_LIBDIR = " << env; }else { QLOG_INFO() << "BABEL_LIBDIR already set: " << env; } env = qgetenv("BABEL_DATADIR"); if (env.isEmpty()) { env = path + "/share/openbabel"; qputenv("BABEL_DATADIR", env.toAscii()); QLOG_INFO() << "Setting BABEL_DATADIR = " << env; }else { QLOG_INFO() << "BABEL_DATADIR already set: " << env; } #ifdef Q_WS_WIN QLibrary openBabel("libopenbabel.dll"); #else QLibrary openBabel("openbabel"); #endif if (!openBabel.load()) { QString msg("Could not load library "); msg += openBabel.fileName(); QLOG_ERROR() << msg << " " << openBabel.errorString(); QLOG_ERROR() << "Library Paths:"; QLOG_ERROR() << libraryPaths(); msg += "\n\nPlease ensure the OpenBabel libraries have been installed correctly"; QMsgBox::critical(0, "IQmol", msg); QApplication::quit(); return; } }
void setCustomLocations() { m_thisDir = QFileInfo(QFINDTESTDATA("tst_qstandardpaths.cpp")).absolutePath(); qputenv("XDG_CONFIG_HOME", QFile::encodeName(m_thisDir)); QDir parent(m_thisDir); parent.cdUp(); m_globalDir = parent.path(); // gives us a trailing slash qputenv("XDG_CONFIG_DIRS", QFile::encodeName(m_globalDir)); }
void TestContactsd::envTest() { qputenv("CONTACTSD_PLUGINS_DIRS", "/usr/lib/contactsd-1.0/plugins/:/usr/lib/contactsd-1.0/plgins/"); mLoader->loadPlugins(QStringList()); QVERIFY2(mLoader->loadedPlugins().count() > 0, "failed to load plugins from evn variable"); qDebug() << mLoader->loadedPlugins(); qputenv("CONTACTSD_PLUGINS_DIRS", ""); mLoader->loadPlugins(QStringList()); }
void ProxyManager::set() { QByteArray envvar = QString("http://%1:%2").arg(this->_host, QString::number(this->_port)).toUtf8(); qputenv("http_proxy", envvar); qputenv("https_proxy", envvar); qputenv("ftp_proxy", envvar); qputenv("rsync_proxy", envvar); }
void TestContactsd::importNonPlugin() { /* This is just a coverage test */ const QString path(QDir::currentPath() + "/data/"); qputenv("CONTACTSD_PLUGINS_DIRS", path.toAscii()); mLoader->loadPlugins(QStringList()); QStringList pluginList = mLoader->loadedPlugins(); QCOMPARE(pluginList.size(), 0); qputenv("CONTACTSD_PLUGINS_DIRS", ""); }
void tst_QGetPutEnv::getSetCheck() { const char* varName = "should_not_exist"; QByteArray result = qgetenv(varName); QCOMPARE(result, QByteArray()); QVERIFY(qputenv(varName, QByteArray("supervalue"))); result = qgetenv(varName); QVERIFY(result == "supervalue"); qputenv(varName,QByteArray()); }
void setCustomLocations() { m_localConfigDir = m_localConfigTempDir.path(); m_globalConfigDir = m_globalConfigTempDir.path(); qputenv("XDG_CONFIG_HOME", QFile::encodeName(m_localConfigDir)); qputenv("XDG_CONFIG_DIRS", QFile::encodeName(m_globalConfigDir)); m_localAppDir = m_localAppTempDir.path(); m_globalAppDir = m_globalAppTempDir.path(); qputenv("XDG_DATA_HOME", QFile::encodeName(m_localAppDir)); qputenv("XDG_DATA_DIRS", QFile::encodeName(m_globalAppDir)); }
void do_common_options_before_qapp(const QOptions& options) { // it's too late if qApp is created. but why ANGLE is not? if (options.value(QString::fromLatin1("egl")).toBool() || Config::instance().isEGL()) { // only apply to current run. no config change qputenv("QT_XCB_GL_INTEGRATION", "xcb_egl"); } else { qputenv("QT_XCB_GL_INTEGRATION", "xcb_glx"); } qDebug() << "QT_XCB_GL_INTEGRATION: " << qgetenv("QT_XCB_GL_INTEGRATION"); }
int main(int argc, char *argv[]) { qputenv("GTK_IM_MODULE", QByteArray("qimsys")); qputenv("QT_IM_MODULE", QByteArray("qimsys")); QApplication app(argc, argv); MainWindow mainWindow; mainWindow.setOrientation(MainWindow::ScreenOrientationAuto); mainWindow.showExpanded(); return app.exec(); }
int main(int argc, char *argv[]) { /* Disable rwx memory. This will also ensure full PAX/Grsecurity protections. */ qputenv("QV4_FORCE_INTERPRETER", "1"); qputenv("QT_ENABLE_REGEXP_JIT", "0"); QApplication a(argc, argv); a.setApplicationVersion(QLatin1String("1.1.2")); a.setOrganizationName(QStringLiteral("Ricochet")); #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) a.setWindowIcon(QIcon(QStringLiteral(":/icons/ricochet.svg"))); #endif QScopedPointer<SettingsFile> settings(new SettingsFile); SettingsObject::setDefaultFile(settings.data()); QString error; QLockFile *lock = 0; if (!initSettings(settings.data(), &lock, error)) { QMessageBox::critical(0, qApp->translate("Main", "Ricochet Error"), error); return 1; } QScopedPointer<QLockFile> lockFile(lock); initTranslation(); /* Initialize OpenSSL's allocator */ CRYPTO_malloc_init(); /* Seed the OpenSSL RNG */ if (!SecureRNG::seed()) qFatal("Failed to initialize RNG"); qsrand(SecureRNG::randomInt(UINT_MAX)); /* Tor control manager */ Tor::TorManager *torManager = Tor::TorManager::instance(); torManager->setDataDirectory(QFileInfo(settings->filePath()).path() + QStringLiteral("/tor/")); torControl = torManager->control(); torManager->start(); /* Identities */ identityManager = new IdentityManager; QScopedPointer<IdentityManager> scopedIdentityManager(identityManager); /* Window */ QScopedPointer<MainWindow> w(new MainWindow); if (!w->showUI()) return 1; return a.exec(); }
void SessionManager::setupEnvironment() { // Set paths only if we are installed onto a non standard location QString path; if (qEnvironmentVariableIsSet("PATH")) { path = QStringLiteral("%1:%2").arg(INSTALL_BINDIR).arg(QString(qgetenv("PATH"))); qputenv("PATH", path.toUtf8()); } if (qEnvironmentVariableIsSet("QT_PLUGIN_PATH")) { path = QStringLiteral("%1:%2").arg(INSTALL_PLUGINDIR).arg(QString(qgetenv("QT_PLUGIN_PATH"))); qputenv("QT_PLUGIN_PATH", path.toUtf8()); } if (qEnvironmentVariableIsSet("QML2_IMPORT_PATH")) { path = QStringLiteral("%1:%2").arg(INSTALL_QMLDIR).arg(QString(qgetenv("QML2_IMPORT_PATH"))); qputenv("QML2_IMPORT_PATH", path.toUtf8()); } if (qEnvironmentVariableIsSet("XDG_DATA_DIRS")) { path = QStringLiteral("%1:%2").arg(INSTALL_DATADIR).arg(QString(qgetenv("XDG_DATA_DIRS"))); qputenv("XDG_DATA_DIRS", path.toUtf8()); } if (qEnvironmentVariableIsSet("XDG_CONFIG_DIRS")) { path = QStringLiteral("%1:%2:/etc/xdg").arg(INSTALL_CONFIGDIR).arg(QString(qgetenv("XDG_CONFIG_DIRS"))); qputenv("XDG_CONFIG_DIRS", path.toUtf8()); } if (qEnvironmentVariableIsSet("XCURSOR_PATH")) { path = QStringLiteral("%1:%2").arg(INSTALL_DATADIR "/icons").arg(QString(qgetenv("XCURSOR_PATH"))); qputenv("XCURSOR_PATH", path.toUtf8()); } // Set XDG environment variables if (qEnvironmentVariableIsEmpty("XDG_DATA_HOME")) { QString path = QStringLiteral("%1/.local/share").arg(QString(qgetenv("HOME"))); qputenv("XDG_DATA_HOME", path.toUtf8()); } if (qEnvironmentVariableIsEmpty("XDG_CONFIG_HOME")) { QString path = QStringLiteral("%1/.config").arg(QString(qgetenv("HOME"))); qputenv("XDG_CONFIG_HOME", path.toUtf8()); } // Set platform integration qputenv("SAL_USE_VCLPLUGIN", QByteArray("kde")); // qputenv("QT_PLATFORM_PLUGIN", QByteArray("Material")); // qputenv("QT_QPA_PLATFORMTHEME", QByteArray("Material")); // qputenv("QT_QUICK_CONTROLS_STYLE", QByteArray("Material")); // qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", QByteArray("1")); // qputenv("XDG_CURRENT_DESKTOP", QByteArray("U2T")); // qputenv("XCURSOR_THEME", QByteArray("Adwaita")); // qputenv("XCURSOR_SIZE", QByteArray("16")); }
void CompositorLauncher::setupEnvironment() { // Make clients run on Wayland if (m_hardware == BroadcomHardware) { qputenv("QT_QPA_PLATFORM", QByteArray("wayland-brcm")); qputenv("QT_WAYLAND_HARDWARE_INTEGRATION", QByteArray("brcm-egl")); qputenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION", QByteArray("brcm-egl")); } else { qputenv("QT_QPA_PLATFORM", QByteArray("wayland")); } qputenv("GDK_BACKEND", QByteArray("wayland")); qunsetenv("WAYLAND_DISPLAY"); }
int main(int argc, char *argv[]) { #if defined(Q_WS_X11) QApplication::setGraphicsSystem("raster"); #elif defined (Q_WS_WIN) qputenv("QML_ENABLE_TEXT_IMAGE_CACHE", "true"); #endif #if defined(Q_WS_S60) QApplication app(argc, argv); #else // Check for single running instance QtSingleApplication app(argc, argv); if (app.isRunning()) { app.sendMessage("FOREGROUND"); return 0; } #endif DuktoWindow viewer; #ifndef Q_WS_S60 app.setActivationWindow(&viewer, true); #endif GuiBehind gb(&viewer); viewer.showExpanded(); app.installEventFilter(&gb); return app.exec(); }
void initPython() { //init python qputenv("PYTHONIOENCODING", "utf-8"); Py_Initialize(); if (!Py_IsInitialized()) { qDebug("Cannot initialize python."); exit(-1); } //init module geturl_obj = new GetUrl(qApp); #if PY_MAJOR_VERSION >= 3 apiModule = PyModule_Create(&moonplayerModule); PyObject *modules = PySys_GetObject("modules"); PyDict_SetItemString(modules, "moonplayer", apiModule); #else apiModule = Py_InitModule("moonplayer", methods); #endif PyModule_AddStringConstant(apiModule, "final_url", ""); Py_IncRef(exc_GetUrlError); PyModule_AddObject(apiModule, "GetUrlError", exc_GetUrlError); // plugins' dir PyRun_SimpleString("import sys"); PyRun_SimpleString(QString("sys.path.insert(0, '%1/plugins')").arg(getAppPath()).toUtf8().constData()); PyRun_SimpleString(QString("sys.path.append('%1/plugins')").arg(getUserPath()).toUtf8().constData()); }
int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); SignalHandler signalHandler; Q_UNUSED(signalHandler) if (QCoreApplication::arguments().length() < 2) qFatal("Specify superuser user-id."); bool ok; auto headadminId = QCoreApplication::arguments()[1].toLongLong(&ok); if (!ok) qFatal("Specify superuser user-id."); app.setApplicationName("Telegram-Bot"); app.setApplicationVersion(Bot::version()); //qputenv("QT_LOGGING_RULES", "tg.*=false"); qputenv("QT_LOGGING_RULES", "tg.*=false\nbot.*.debug=false"); //qputenv("DEBUG", "true"); Database database; Bot bot(&database, headadminId); bot.installModule(new Board); bot.installModule(new Help); bot.installModule(new Subscribe); bot.installModule(new ConfigModule); bot.installModule(new GroupModule); bot.init(); return app.exec(); }
int main(int argc, char** argv) { // FIXME: We must add support for the threaded rendering as it is the default. qputenv("QML_NO_THREADED_RENDERER", QByteArray("1")); MiniBrowserApplication app(argc, argv); if (app.isRobotized()) { BrowserWindow* window = new BrowserWindow(&app.m_windowOptions); UrlLoader loader(window, app.urls().at(0), app.robotTimeout(), app.robotExtraTime()); loader.loadNext(); window->show(); return app.exec(); } QStringList urls = app.urls(); if (urls.isEmpty()) { QString defaultIndexFile = QString("%1/%2").arg(QDir::homePath()).arg(QLatin1String("index.html")); if (QFile(defaultIndexFile).exists()) urls.append(QString("file://") + defaultIndexFile); else urls.append("http://www.google.com"); } BrowserWindow* window = new BrowserWindow(&app.m_windowOptions); window->load(urls.at(0)); for (int i = 1; i < urls.size(); ++i) window->newWindow(urls.at(i)); app.exec(); return 0; }
void SettingsWidget::applyProxy() { Settings &QMPSettings = QMPlay2Core.getSettings(); if (!QMPSettings.getBool("Proxy/Use")) { qunsetenv("http_proxy"); } else { const QString proxyHostName = QMPSettings.getString("Proxy/Host"); const quint16 proxyPort = QMPSettings.getInt("Proxy/Port"); QString proxyUser, proxyPassword; if (QMPSettings.getBool("Proxy/Login")) { proxyUser = QMPSettings.getString("Proxy/User"); proxyPassword = QByteArray::fromBase64(QMPSettings.getByteArray("Proxy/Password")); } /* Proxy env for FFmpeg */ QString proxyEnv = QString("http://" + proxyHostName + ':' + QString::number(proxyPort)); if (!proxyUser.isEmpty()) { QString auth = proxyUser; if (!proxyPassword.isEmpty()) auth += ':' + proxyPassword; auth += '@'; proxyEnv.insert(7, auth); } qputenv("http_proxy", proxyEnv.toLocal8Bit()); } }
int main(int argc, char **argv) { QQuickWindow::setDefaultAlphaBuffer(true); QApplication app(argc, argv); app.setApplicationVersion(version); app.setOrganizationDomain(QStringLiteral("audoban")); app.setApplicationName(QStringLiteral("CandilDock")); //! set pattern for debug messages //! [%{type}] [%{function}:%{line}] - %{message} [%{backtrace}] qSetMessagePattern(QStringLiteral( CIGREEN "[%{type} " CGREEN "%{time h:mm:ss.zzzz}" CIGREEN "]" CNORMAL #ifndef QT_NO_DEBUG CIRED " [" CCYAN "%{function}" CIRED ":" CCYAN "%{line}" CIRED "]" #endif CICYAN " - " CNORMAL "%{message}" CIRED "%{if-fatal}\n%{backtrace depth=" DEPTH " separator=\"\n\"}%{endif}" "%{if-warning}\n%{backtrace depth=" DEPTH " separator=\"\n\"}%{endif}" "%{if-critical}\n%{backtrace depth=" DEPTH " separator=\"\n\"}%{endif}" CNORMAL)); qputenv("QT_QUICK_CONTROLS_1_STYLE", "Desktop"); Candil::DockCorona corona; return app.exec(); }
int main(int argc, char ** argv) { //the whole point of this is to interact with X, if we are in any other session, force trying to connect to X //if the QPA can't load xcb, this app is useless anyway. qputenv("QT_QPA_PLATFORM", "xcb"); QGuiApplication app(argc, argv); if (app.platformName() != QLatin1String("xcb")) { qFatal("xembed-sni-proxy is only useful XCB. Aborting"); } auto disableSessionManagement = [](QSessionManager &sm) { sm.setRestartHint(QSessionManager::RestartNever); }; QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement); QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement); app.setDesktopSettingsAware(false); app.setQuitOnLastWindowClosed(false); qDBusRegisterMetaType<KDbusImageStruct>(); qDBusRegisterMetaType<KDbusImageVector>(); qDBusRegisterMetaType<KDbusToolTipStruct>(); Xcb::atoms = new Xcb::Atoms(); FdoSelectionManager manager; auto rc = app.exec(); delete Xcb::atoms; return rc; }
static const char *setHighDpiEnvironmentVariable() { const char *envVarName = 0; static const char ENV_VAR_QT_DEVICE_PIXEL_RATIO[] = "QT_DEVICE_PIXEL_RATIO"; #ifdef Q_OS_WIN bool isWindows = true; #else bool isWindows = false; #endif #if (QT_VERSION < QT_VERSION_CHECK(5, 6, 0)) if (isWindows && !qEnvironmentVariableIsSet(ENV_VAR_QT_DEVICE_PIXEL_RATIO)) { envVarName = ENV_VAR_QT_DEVICE_PIXEL_RATIO; qputenv(envVarName, "auto"); } #else if (isWindows && !qEnvironmentVariableIsSet(ENV_VAR_QT_DEVICE_PIXEL_RATIO) // legacy in 5.6, but still functional && !qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR") && !qEnvironmentVariableIsSet("QT_SCALE_FACTOR") && !qEnvironmentVariableIsSet("QT_SCREEN_SCALE_FACTORS")) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); } #endif // < Qt 5.6 return envVarName; }
Application::Application(int& argc, char** argv) : QApplication(argc, argv), m_window(0) { setApplicationName("FocusWriter"); setApplicationVersion("1.3.3"); setOrganizationDomain("gottcode.org"); setOrganizationName("GottCode"); { QIcon fallback(":/hicolor/256x256/apps/focuswriter.png"); fallback.addFile(":/hicolor/128x128/apps/focuswriter.png"); fallback.addFile(":/hicolor/64x64/apps/focuswriter.png"); fallback.addFile(":/hicolor/48x48/apps/focuswriter.png"); fallback.addFile(":/hicolor/32x32/apps/focuswriter.png"); fallback.addFile(":/hicolor/24x24/apps/focuswriter.png"); fallback.addFile(":/hicolor/22x22/apps/focuswriter.png"); fallback.addFile(":/hicolor/16x16/apps/focuswriter.png"); setWindowIcon(QIcon::fromTheme("focuswriter", fallback)); } #ifndef Q_WS_MAC setAttribute(Qt::AA_DontUseNativeMenuBar); setAttribute(Qt::AA_DontShowIconsInMenus, !QSettings().value("Window/MenuIcons", false).toBool()); #else setAttribute(Qt::AA_DontShowIconsInMenus, true); new RTF::Converter; #endif qputenv("UNICODEMAP_JP", "cp932"); m_files = arguments().mid(1); processEvents(); }
PHIParent::PHIParent( QObject *parent ) : QObject( parent ), _app( 0 ), _internalApp( false ) { qDebug( "PHIParent::PHIParent()" ); if ( !qApp ) { // not set in apache module so instantiate QApplication here QStringList argList; #ifdef Q_OS_UNIX QSettings s( QStringLiteral( "/etc/phi/phis.conf" ), QSettings::IniFormat ); #elif defined Q_OS_WIN QSettings s( QStringLiteral( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Phisketeer\\phis" ), QSettings::NativeFormat ); #endif QString bindir=s.value( QStringLiteral( "BinDir" ), QString() ).toString(); QString plugindir=s.value( QStringLiteral( "PluginsPath" ), QString() ).toString(); if ( bindir.isEmpty() ) { QByteArray arr=qgetenv( "QT_PLUGIN_PATH" ); if ( !arr.isEmpty() ) { QDir dir( QString::fromLocal8Bit( arr ) ); dir.cdUp(); bindir=dir.absolutePath()+QStringLiteral( "/bin" ); } else { #ifdef Q_OS_UNIX bindir=QStringLiteral( "/opt/phi/bin" ); // fallback #elif defined Q_OS_WIN bindir=QStringLiteral( "C:\\Program Files (x86)\\Phisketeer\\bin" ); //fallback #endif } } if ( !plugindir.isEmpty() ) { qputenv( "QT_PLUGIN_PATH", plugindir.toLocal8Bit() ); } argList << bindir+QDir::separator()+QStringLiteral( "mod_phi" ); #ifdef Q_OS_UNIX argList << QStringLiteral( "-platform" ) << QStringLiteral( "minimal" ); #endif int argc=argList.size(); QVector<char *> argv( argc ); QList<QByteArray> argvData; for ( int i=0; i<argc; ++i ) argvData.append( argList.at(i).toLocal8Bit() ); for ( int i=0; i<argc; ++i ) argv[i]=argvData[i].data(); //_app=new QApplication( argc, argv.data(), false ); _app=new QGuiApplication( argc, argv.data() ); _app->setApplicationName( QStringLiteral( "mod_phi" ) ); _app->setApplicationVersion( PHIS::libVersion() ); PHI::setupApplication( _app ); _internalApp=true; } else { _app=qApp; _internalApp=false; } PHIError::instance( this ); //PHISPageCache::instance( this ); PHISItemCache::instance( this ); _loadedModules=PHISModuleFactory::instance( this )->loadedModules(); _moduleLoadErrors=PHISModuleFactory::instance( this )->loadErrors(); //_licenses.insert( "localhost", new PHILicense() ); //_validLicenses.insert( "localhost", true ); _invalidateTouch=QDateTime::currentDateTime(); }
void CryptographyPGPTest::initTestCase() { LibMailboxSync::initTestCase(); if (!qputenv("GNUPGHOME", "keys")) { QFAIL("Unable to set GNUPGHOME environment variable"); } }
KalziumGLWidget::KalziumGLWidget(QWidget *parent) : Avogadro::GLWidget(parent), m_lastEngine1(0), m_lastEngine2(0) { // work around a bug in OpenBabel: the chemical data files parsing // is dependent on the LC_NUMERIC locale. m_lc_numeric = QByteArray(setlocale(LC_NUMERIC, 0)); setlocale(LC_NUMERIC, "C"); // Prevent What's this from intercepting right mouse clicks setContextMenuPolicy(Qt::PreventContextMenu); // Load the tools and set navigate as the default // first set the Avogadro plugin directory, // avoiding overwriting an already set envvar static bool s_pluginDirSet = false; if (!s_pluginDirSet) { if (qgetenv("AVOGADRO_PLUGINS").isEmpty()) { qputenv("AVOGADRO_PLUGINS", AVOGADRO_PLUGIN_DIR); } s_pluginDirSet = true; } Avogadro::PluginManager *manager = Avogadro::PluginManager::instance(); manager->loadFactories(); Avogadro::ToolGroup* tools = new Avogadro::ToolGroup(this); tools->append(manager->tools(this)); tools->setActiveTool("Navigate"); setToolGroup(tools); // Set the default engine to be active loadDefaultEngines(); // Set the default quality level to high setQuality(2); setMolecule(new Avogadro::Molecule(this)); update(); }
int main(int argc, char* argv[]) { QT_REQUIRE_VERSION(argc, argv, "5.6.0"); #ifndef Q_OS_WIN qInstallMessageHandler(&msgHandler); #endif #if defined(Q_OS_LINUX) || defined(__GLIBC__) || defined(__FreeBSD__) signal(SIGSEGV, qupzilla_signal_handler); #endif // Hack to fix QT_STYLE_OVERRIDE with QProxyStyle const QByteArray style = qgetenv("QT_STYLE_OVERRIDE"); if (!style.isEmpty()) { char** args = (char**) malloc(sizeof(char*) * (argc + 1)); for (int i = 0; i < argc; ++i) args[i] = argv[i]; QString stylecmd = QL1S("-style=") + style; args[argc++] = qstrdup(stylecmd.toUtf8().constData()); argv = args; } qputenv("QTWEBENGINE_REMOTE_DEBUGGING", WEBINSPECTOR_PORT); MainApplication app(argc, argv); if (app.isClosing()) return 0; app.setStyle(new ProxyStyle); return app.exec(); }
int ui_main(int argc, char **argv) { #ifdef Q_OS_WIN // Enables automatic high-DPI scaling // https://github.com/equalsraf/neovim-qt/issues/391 // // The other way to do this is to set Qt::AA_EnableHighDpiScaling // but it does not seem to work on Windows. // // @equalsraf: For now I'm setting this in windows only, there open // issues in upstream Qt that suggests this may have unexpected effects // in other systems (QTBUG-65061, QTBUG-65102), also QTBUG-63580 offers // contradictory information with what we have experienced. qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1"); #endif NeovimQt::App app(argc, argv); QCommandLineParser parser; NeovimQt::App::processCliOptions(parser, app.arguments()); int timeout = parser.value("timeout").toInt(); auto c = app.createConnector(parser); c->setRequestTimeout(timeout); app.showUi(c, parser); return app.exec(); }
Application::Application(int& argc, char** argv) : QtSingleApplication("org.gottcode.FocusWriter", argc, argv), m_window(0) { setApplicationName("FocusWriter"); setApplicationVersion(VERSIONSTR); setApplicationDisplayName(Window::tr("FocusWriter")); setOrganizationDomain("gottcode.org"); setOrganizationName("GottCode"); #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) setWindowIcon(QIcon::fromTheme("focuswriter", QIcon(":/focuswriter.png"))); #endif setAttribute(Qt::AA_UseHighDpiPixmaps, true); #ifndef Q_OS_MAC setAttribute(Qt::AA_DontUseNativeMenuBar); #else setAttribute(Qt::AA_DontShowIconsInMenus, true); #endif #ifdef RTFCLIPBOARD new RTF::Clipboard; #endif qputenv("UNICODEMAP_JP", "cp932"); m_files = arguments().mid(1); processEvents(); }
void execute(const QCommandLineParser *parser) { auto isSet = [parser, this] (LineCmd cmd) { return parser->isSet(options.value(cmd, dummy)); }; auto value = [parser, this] (LineCmd cmd) { return parser->value(options.value(cmd, dummy)); }; auto values = [parser, this] (LineCmd cmd) { return parser->values(options.value(cmd, dummy)); }; if (isSet(LineCmd::LogLevel)) Log::setMaximumLevel(value(LineCmd::LogLevel)); if (isSet(LineCmd::OpenGLDebug) || qgetenv("CMPLAYER_GL_DEBUG").toInt()) gldebug = true; if (main) { if (isSet(LineCmd::Wake)) main->wake(); Mrl mrl; if (isSet(LineCmd::Open)) mrl = Mrl(value(LineCmd::Open)); if (!parser->positionalArguments().isEmpty()) mrl = Mrl(parser->positionalArguments().first()); if (!mrl.isEmpty()) main->openFromFileManager(mrl); const auto args = values(LineCmd::Action); if (!args.isEmpty()) RootMenu::execute(args[0], args.value(1)); } if (isSet(LineCmd::Debug)) { if (Log::maximumLevel() < Log::Debug) Log::setMaximumLevel(Log::Debug); gldebug = true; qputenv("CMPLAYER_MPV_VERBOSE", "v"); } }