コード例 #1
0
void LauncherApp::ReadyToRun()
{
	// Since we will essentially run the GUI...
	set_thread_priority(Thread(), B_DISPLAY_PRIORITY);

    BWebPage::InitializeOnce();
    BWebPage::SetCacheModel(B_WEBKIT_CACHE_MODEL_WEB_BROWSER);

	BFile settingsFile;
	BRect windowFrameFromSettings = m_lastWindowFrame;
	if (openSettingsFile(settingsFile, B_READ_ONLY)) {
		BMessage settingsArchive;
		settingsArchive.Unflatten(&settingsFile);
		settingsArchive.FindRect("window frame", &windowFrameFromSettings);
	}
	m_lastWindowFrame = windowFrameFromSettings;

	m_initialized = true;

	if (m_launchRefsMessage) {
		RefsReceived(m_launchRefsMessage);
		delete m_launchRefsMessage;
		m_launchRefsMessage = 0;
	} else {
	    LauncherWindow* window = new LauncherWindow(m_lastWindowFrame);
	    window->Show();
	}
}
コード例 #2
0
ファイル: webpage.cpp プロジェクト: mcgrawp/webkit-webcl
QWebPage* WebPage::createWindow(QWebPage::WebWindowType type)
{
    LauncherWindow* mw = new LauncherWindow;
    if (type == WebModalDialog)
        mw->setWindowModality(Qt::ApplicationModal);
    mw->show();
    return mw->page();
}
コード例 #3
0
void LauncherApp::MessageReceived(BMessage* message)
{
    switch (message->what) {
    case LOAD_AT_STARTING: {
        BString url;
        if (message->FindString("url", &url) != B_OK)
        	break;
        bool openNewWindow = false;
        message->FindBool("new window", &openNewWindow);
        LauncherWindow* webWindow = NULL;
        for (int i = 0; BWindow* window = WindowAt(i); i++) {
            webWindow = dynamic_cast<LauncherWindow*>(window);
            if (!webWindow)
            	continue;
            if (!openNewWindow) {
            	// stop at the first window
	            break;
            }
        }
        if (webWindow) {
        	// There should always be at least one window open. If not, maybe we are about
        	// to quit anyway...
        	if (openNewWindow) {
        		// open a new window with an offset to the last window
                newWindow(url);
        	} else {
            	// load the URL in the first window
                webWindow->CurrentWebView()->LoadURL(url.String());
        	}
        }
        break;
    }
    case B_SILENT_RELAUNCH:
    	newWindow("");
    	break;
    case NEW_WINDOW: {
		BString url;
		if (message->FindString("url", &url) != B_OK)
			break;
    	newWindow(url);
    	break;
    }
    case WINDOW_OPENED:
    	m_windowCount++;
    	break;
    case WINDOW_CLOSED:
    	m_windowCount--;
        message->FindRect("window frame", &m_lastWindowFrame);
    	if (m_windowCount <= 0)
    		PostMessage(B_QUIT_REQUESTED);
    	break;

    default:
        BApplication::MessageReceived(message);
        break;
    }
}
コード例 #4
0
void LauncherApp::newWindow(const BString& url)
{
	m_lastWindowFrame.OffsetBy(20, 20);
	if (!BScreen().Frame().Contains(m_lastWindowFrame))
		m_lastWindowFrame.OffsetTo(50, 50);

	LauncherWindow* window = new LauncherWindow(m_lastWindowFrame);
	window->Show();
	if (url.Length())
	    window->CurrentWebView()->LoadURL(url.String());
}
コード例 #5
0
int main(int argc, char** argv)
{
  gtk_init(&argc, &argv);
  nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY"));
  nux::NuxInitialize(0);

  LauncherWindow lc;
  lc.Show();

  return 0;
}
コード例 #6
0
bool LauncherApp::QuitRequested()
{
    for (int i = 0; BWindow* window = WindowAt(i); i++) {
        LauncherWindow* webWindow = dynamic_cast<LauncherWindow*>(window);
        if (!webWindow)
        	continue;
        if (!webWindow->Lock())
        	continue;
        if (webWindow->QuitRequested()) {
        	m_lastWindowFrame = webWindow->Frame();
        	webWindow->Quit();
        	i--;
        } else {
        	webWindow->Unlock();
        	return false;
        }
    }

	BFile settingsFile;
	if (openSettingsFile(settingsFile, B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY)) {
		BMessage settingsArchive;
		settingsArchive.AddRect("window frame", m_lastWindowFrame);
		settingsArchive.Flatten(&settingsFile);
	}

    return true;
}
コード例 #7
0
ファイル: main.cpp プロジェクト: zaitsevyan/ttyhlauncher
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QTranslator t;
    QDate today = QDate::currentDate();
    if ( today.month() == 4 && today.day() == 1 )
    {
        t.load(":/translations/koi7.qm");
    }
    else
    {
        t.load(":/translations/ru.qm");
    }
    QApplication::installTranslator(&t);

    Settings::instance();
    Logger::logger();

    QPixmap logo(":/resources/logo.png");
    QSplashScreen *splash =
            new QSplashScreen(logo, Qt::FramelessWindowHint | Qt::SplashScreen);

    splash->setMask( logo.mask() );

    splash->show();
    Settings::instance()->updateLocalData();
    splash->close();

    delete splash;

    LauncherWindow w;
    w.show();

    return a.exec();
}
コード例 #8
0
	BOOL handleMessages( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
	{
		int index = 0;
		std::string mod;

		int modIndex = modSelector.getActiveIndex();
		int menuId = game::SimpleOptions::getInt(DH_OPT_I_MENU_LANGUAGE);
		int speechId = game::SimpleOptions::getInt(DH_OPT_I_SPEECH_LANGUAGE);
		int subtitleId = game::SimpleOptions::getInt(DH_OPT_I_SUBTITLE_LANGUAGE);
		std::string modDir;
		std::string parameters;

		switch( msg )
		{
		case WM_INITDIALOG:
			SetFocus( GetDlgItem( hwnd, IDOK ) );
			break; 

		case WM_COMMAND:
		{	
			int command = LOWORD(wParam);
						
			switch( command )
			{
			case IDOK:
				applyOptions( hwnd );
				GameOptionManager::getInstance()->save();
				PostQuitMessage( 0 );

				modSelector.restoreDir();

				//int modIndex = modSelector.getActiveIndex();
				if(modIndex >= 0)
				{
					//int menuId = game::SimpleOptions::getInt(DH_OPT_I_MENU_LANGUAGE);
					//int speechId = game::SimpleOptions::getInt(DH_OPT_I_SPEECH_LANGUAGE);
					//int subtitleId = game::SimpleOptions::getInt(DH_OPT_I_SUBTITLE_LANGUAGE);
					modDir = modSelector.getModDir(modIndex);

					parameters += "-mod=" + modDir;
					parameters += " -menu_language=" + boost::lexical_cast<std::string> (menuId);
					parameters += " -speech_language=" + boost::lexical_cast<std::string> (speechId);
					parameters += " -subtitle_language=" + boost::lexical_cast<std::string> (subtitleId);

					//MessageBox(0, command.c_str(), "Shit happens", MB_OK);
					ShellExecute( 0, 0, "claw_proto.exe", parameters.c_str(), 0, SW_NORMAL );
				}
				else
				{
					ShellExecute( 0, 0, "claw_proto.exe", 0, 0, SW_NORMAL );
				}

				// manager.save();
				break;

			case IDCHECKUPDATES:
				//applyOptions( hwnd );
				//GameOptionManager::getInstance()->save();
				//ShellExecute( 0, 0, "Updater.exe", 0, 0, SW_NORMAL );
				//system("start Updater.exe");
				modSelector.restoreDir();
				hiddencommand("Updater\\start_updater.bat", false);
				PostQuitMessage( 0 );
				// manager.save();
				break;

			case IDC_ACTIVATEMOD:
				index = SendMessage( GetDlgItem( hwnd, IDC_COMBOMODSELECTION ), CB_GETCURSEL, 0, 0);
				modSelector.saveActiveModFile(index - 1);

				modSelector.restoreDir();

				if(fileExists("Shadowgrounds Launcher.exe"))
					ShellExecute( 0, 0, "Shadowgrounds Launcher.exe", 0, 0, SW_NORMAL );
				else
					ShellExecute( 0, 0, "ShadowgroundsLauncher.exe", 0, 0, SW_NORMAL );

				PostQuitMessage( 0 );
				break;

			case IDC_EDITOR_MANUAL:
				modSelector.restoreDir();

				if(fileExists("Editor Manual.rtf"))
					ShellExecute( 0, 0, "Editor Manual.rtf", 0, 0, SW_NORMAL );
				else
					ShellExecute( 0, 0, "EditorManual.rtf", 0, 0, SW_NORMAL );


				modSelector.changeDir();
				break;

			case IDC_EDITOR_LAUNCH:
				modSelector.restoreDir();
#ifdef STEAM_HAX
				ShellExecute( 0, 0, "steam://run/2505", 0, 0, SW_NORMAL );
#else
				if(fileExists("Shadowgrounds Editor.exe"))
					ShellExecute( 0, 0, "Shadowgrounds Editor.exe", 0, 0, SW_NORMAL );
				else
					ShellExecute( 0, 0, "ShadowgroundsEditor.exe", 0, 0, SW_NORMAL );
#endif
				PostQuitMessage( 0 );
				break;

			case IDCANCEL:
				PostQuitMessage( 0 );
				break;

			case IDC_BUTTONADVANCED:
				applyOptions( hwnd );
				lwindow->openAdvanced();

				break;
			}

			break;
		}

		case WM_SHOWWINDOW:
			manager.load();
			initDialog( hwnd );	
			break;

		};


		return 0;
	}
コード例 #9
0
ファイル: main.cpp プロジェクト: krf/GammaRay
int main(int argc, char **argv)
{
    QApplication::setOrganizationName("KDAB");
    QApplication::setOrganizationDomain("kdab.com");
    QApplication::setApplicationName("GammaRay");

    QStringList args;
    for (int i = 1; i < argc; ++i) {
        args.push_back(QString::fromLocal8Bit(argv[i]));
    }
    QApplication app(argc, argv);

    QStringList builtInArgs = QStringList() << QLatin1String("-style")
                              << QLatin1String("-stylesheet")
                              << QLatin1String("-graphicssystem");

    QString injectorType;
    int pid = -1;
    while (!args.isEmpty() && args.first().startsWith('-')) {
        const QString arg = args.takeFirst();
        if ((arg == QLatin1String("-i") || arg == QLatin1String("--injector")) && !args.isEmpty()) {
            injectorType = args.takeFirst();
            continue;
        }
        if ((arg == QLatin1String("-p") || arg == QLatin1String("--pid")) && !args.isEmpty()) {
            pid = args.takeFirst().toInt();
            continue;
        }
        if (arg == QLatin1String("-h") || arg == QLatin1String("--help")) {
            usage(argv[0]);
            return 0;
        }
        if (arg == QLatin1String("-v") || arg == QLatin1String("--version")) {
            out << PROGRAM_NAME << " version " << GAMMARAY_VERSION_STRING << endl;
            out << "Copyright (C) 2010-2013 Klaralvdalens Datakonsult AB, "
                << "a KDAB Group company, [email protected]" << endl;
            return 0;
        }
        if (arg == QLatin1String("-filtertest")) {
            qputenv("GAMMARAY_TEST_FILTER", "1");
        }
        if (arg == QLatin1String("-unittest")) {
            qputenv("GAMMARAY_UNITTEST", "1");
        }
        if (arg == QLatin1String("-modeltest")) {
            qputenv("GAMMARAY_MODELTEST", "1");
        }
        // built-in arguments of QApp, could be meant for us if we are showing the launcher window
        foreach (const QString &builtInArg, builtInArgs) {
            if (arg == builtInArg && !args.isEmpty()) {
                args.takeFirst();
            }
        }
    }

    if (args.isEmpty() && pid <= 0) {
        LauncherWindow dialog;
        if (dialog.exec() == QDialog::Accepted) {
            args = dialog.launchArguments();
            bool ok;
            pid = dialog.pid().toInt(&ok);
            if (!ok && args.isEmpty()) {
                return 0;
            }
        } else {
            return 0;
        }
    }

    const QString probeDll = ProbeFinder::findProbe(QLatin1String("gammaray_probe"));
    qputenv("GAMMARAY_PROBE_PATH", QFileInfo(probeDll).absolutePath().toLocal8Bit());

    AbstractInjector::Ptr injector;
    if (injectorType.isEmpty()) {
        if (pid > 0) {
            injector = InjectorFactory::defaultInjectorForAttach();
        } else {
            injector = InjectorFactory::defaultInjectorForLaunch();
        }
    } else {
        injector = InjectorFactory::createInjector(injectorType);
    }

    if (injector) {
        if (pid > 0) {
            if (!injector->attach(pid, probeDll, QLatin1String("gammaray_probe_inject"))) {
                err << "Unable to attach injector " << injector->name() << endl;
                err << "Exit code: " << injector->exitCode() << endl;
                if (!injector->errorString().isEmpty()) {
                    err << "Error: " << injector->errorString() << endl;
                }
                return 1;
            } else {
                return 0;
            }
        } else {
            if (!injector->launch(args, probeDll, QLatin1String("gammaray_probe_inject"))) {
                err << "Failed to launch injector " << injector->name() << endl;
                err << "Exit code: " << injector->exitCode() << endl;
                if (!injector->errorString().isEmpty()) {
                    err << "Error: " << injector->errorString() << endl;
                }
                return 1;
            }
            return injector->exitCode();
        }
        return 1;
    }

    if (injectorType.isEmpty()) {
        if (pid > 0) {
#if defined(Q_OS_WIN)
            err << "Sorry, but at this time there is no attach injector on the Windows platform" << endl;
            err << "Only the launch injector windll is available on Windows" << endl;
#else
            err << "Uh-oh, there is no default attach injector" << endl;
#endif
        } else {
            err << "Uh-oh, there is no default launch injector" << endl;
        }
    } else {
        err << "Injector " << injectorType << " not found." << endl;
    }
    return 1;
}