コード例 #1
0
ファイル: kssh.cpp プロジェクト: skoegl/kssh4
void KSSH::userFor(const QString& host)
{
    userCB->clear();
    compUser->clear();

    KConfig config;
    KConfigGroup user_config = config.group(host % QString("-User List"));

    QStringList data = user_config.readEntry("User", QStringList());
    compUser->setItems(data);
    userCB->setHistoryItems(data);

    userCB->setEditText(user_config.readEntry("LastUsed", ""));

    loadOptions("DefaultConfig");

    if (loadOptions(host % QString("-Options"))) {
        QFont tmpFont = optionsPB->font();
        tmpFont.setItalic(true);
        optionsPB->setFont(tmpFont);
    }
    else {
        QFont tmpFont = optionsPB->font();
        tmpFont.setItalic(false);
        optionsPB->setFont(tmpFont);
    }
}
コード例 #2
0
ファイル: util.cpp プロジェクト: amoylel/avTranscoder
OptionArrayMap getOutputFormatOptions()
{
    OptionArrayMap optionsPerFormat;

    AVOutputFormat* outputFormat = av_oformat_next( NULL );

    // iterate on formats
    while( outputFormat )
    {
        // add only format with video track
        // outputFormat->audio_codec ?
        if( outputFormat->video_codec != AV_CODEC_ID_NONE )
        {
            if( outputFormat->priv_class )
            {
                const std::string outputFormatName( outputFormat->name );
                OptionArray options;
                loadOptions( options, (void*)&outputFormat->priv_class, 0  );
                optionsPerFormat.insert( std::make_pair( outputFormatName, options ) );
            }
        }
        outputFormat = av_oformat_next( outputFormat );
    }
    return optionsPerFormat;
}
コード例 #3
0
ファイル: ui.c プロジェクト: jeremysrand/a2bejwld
void initUI(void)
{
    bool optionsLoaded;
    bool mouseInitialized;
    
    initMachine();
    
    optionsLoaded = loadOptions();
    
    initGameEngine(&gCallbacks);
    mouseInitialized = initMouse(&gMouseCallbacks);
    
    // If we couldn't initialize a mouse and it was enabled on the options, then disable it.
    if ((!mouseInitialized) &&
        (gGameOptions.enableMouse)) {
        gGameOptions.enableMouse = false;
        gGameOptions.optionsSaved = false;
        
        // If there were no options loaded, then let's turn on the joystick instead.
        if (!optionsLoaded) {
            gGameOptions.enableJoystick = true;
        }
    }
    
    initJoystick(&gJoyCallbacks);
    
    if (gGameOptions.enableSound) {
        soundInit(gGameOptions.mockingBoardSlot, gGameOptions.enableSpeechChip);
    }
    
    if (!gGameOptions.optionsSaved) {
        saveOptions();
    }
}
コード例 #4
0
/** Constructor */
QtDataProcessorOptionsDialog::QtDataProcessorOptionsDialog(
    DataProcessorView *view, DataProcessorPresenter *presenter)
    : QDialog(dynamic_cast<QWidget *>(view)), m_presenter(presenter) {
  initLayout();
  initBindings();
  loadOptions();
}
コード例 #5
0
 std::string OSArgumentRecord_Impl::stringVectorToString(const std::vector<std::string>& strs) const
 {
   TableLoadOptions loadOptions(false,false,false); // choices are all strings
   Table table;
   table.appendRow(strs,loadOptions);
   return table.print(TableFormat::CSV);
 }
コード例 #6
0
// load Xml
bool TCompGuiButton::load(MKeyValue& atts)
{
	loadOptions();
	init_enabled = atts.getBool("enabled", true);
	language = atts.getBool("lang", true);
	return true;
}
コード例 #7
0
ファイル: mads.cpp プロジェクト: Strangerke/scummvm
void MADSEngine::initialize() {
	// Set up debug channels
	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
	DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling");

	// Initial sub-system engine references
	MSurface::setVm(this);
	MSprite::setVm(this);

	Resources::init(this);
	Conversation::init(this);
	_debugger = new Debugger(this);
	_dialogs = Dialogs::init(this);
	_events = new EventsManager(this);
	_palette = new Palette(this);
	Font::init(this);
	_font = new Font();
	_screen = new Screen();
	_sound = new SoundManager(this, _mixer);
	_audio = new AudioPlayer(_mixer, getGameID());
	_game = Game::init(this);
	_gameConv = new GameConversations(this);

	loadOptions();

	_screen->clear();
}
コード例 #8
0
ファイル: BonusManager.cpp プロジェクト: sopyer/Shadowgrounds
		BonusManagerImpl(Game *game) : game(game), available(false)
		{
			IBonusOption *opt;
			
			// register options
			//
			opt = new BWModeBonusOption();
			options[opt->name] = opt;

			opt = new SuperPhysicsBonusOption();
			options[opt->name] = opt;

			opt = new WeaponsAndUpgradesBonusOption();
			options[opt->name] = opt;

			opt = new SpeedModeBonusOption();
			options[opt->name] = opt;

			opt = new ElectricGunBonusOption();
			options[opt->name] = opt;
			
			opt = new BloopersBonusOption();
			options[opt->name] = opt;

			opt = new InvulnerabilityBonusOption();
			options[opt->name] = opt;

			opt = new ThirdPersonModeBonusOption();
			options[opt->name] = opt;


			// load unlocked options
			loadOptions();
		}
コード例 #9
0
ファイル: LightFocus.cpp プロジェクト: nguyenkha/light-focus
OptionsWindow::OptionsWindow(Window *parent) : CustomWindow(parent)
{
	Window::init(NULL, WS_OVERLAPPEDWINDOW & ~WS_MINIMIZEBOX & ~WS_MAXIMIZEBOX & ~WS_THICKFRAME, _T("Light Focus Options"), CW_USEDEFAULT, 0, 300, 300, (HMENU)NULL);

	_HookPrintScreenCheckBox = new CheckBox(this);
	_HookPrintScreenCheckBox->init(_T("Use Print Screen"), 15, 10, 200, 25);

	_includeBackgroundCheckBox = new CheckBox(this);
	_includeBackgroundCheckBox->init(_T("Include background"), 15, 35, 200, 25);

	_delayLabel = new Label(this);
	_delayLabel->init(_T("Delay before capture: "), 15, 65, 200, 25);
	
	_delayEditBox = new EditBox(this);
	_delayEditBox->init(_T(""), 130, 60, 40, 20);

	_savePathLabel = new Label(this);
	_savePathLabel->init(_T("Save path: "), 15, 90, 200, 25);
	
	_savePathEditBox = new EditBox(this);
	_savePathEditBox->init(_T(""), 15, 110, 180, 20);
	_savePathEditBox->setReadOnly(true);

	_browseForFolder = new Button(this);
	_browseForFolder->init(_T("Browse"), 200, 109, 70, 22, IDM_BROWSE);

	_saveTypeLabel = new Label(this);
	_saveTypeLabel->init(_T("Save type: "), 15, 145, 200, 25);

	_saveTypeComboBox = new ComboBox(this);
	_saveTypeComboBox->init(75, 140, 90, 25, CBS_DROPDOWNLIST);
	_saveTypeComboBox->addString(_T("JPEG"));
	_saveTypeComboBox->addString(_T("PNG"));
	_saveTypeComboBox->addString(_T("BMP"));
	_saveTypeComboBox->setSelectedIndex(0);

	_captureModeLabel = new Label(this);
	_captureModeLabel->init(_T("Capture mode: "), 15, 175, 200, 25);

	_captureModeComboBox = new ComboBox(this);
	_captureModeComboBox->init(95, 170, 90, 25, CBS_DROPDOWNLIST);
	_captureModeComboBox->addString(_T("Desktop"));
	_captureModeComboBox->addString(_T("Window"));
	_captureModeComboBox->addString(_T("Rectangle"));
	_captureModeComboBox->setSelectedIndex(0);


	_okButton = new Button(this);
	_okButton->init(_T("OK"), 15, 230, 80, 25, IDM_OK);
	_cancelButton = new Button(this);
	_cancelButton->init(_T("Cancel"), 105, 230, 80, 25, IDM_CANCEL);
	_applyButton = new Button(this);
	_applyButton->init(_T("Apply"), 195, 230, 80, 25, IDM_APLLY);

	loadOptions();

	update();
	show(SW_SHOW);
}
コード例 #10
0
ファイル: qtractorOptions.cpp プロジェクト: EQ4/qtractor
// Constructor.
qtractorOptions::qtractorOptions (void)
	: m_settings(QTRACTOR_DOMAIN, QTRACTOR_TITLE)
{
	// Pseudo-singleton reference setup.
	g_pOptions = this;

	loadOptions();
}
コード例 #11
0
ファイル: Option.cpp プロジェクト: Kthulhu/avTranscoder
void loadOptions( OptionArray& outOptions, void* av_class, int req_flags )
{
	OptionMap optionMap;
	loadOptions( optionMap, av_class, req_flags );

	for( OptionMap::iterator it = optionMap.begin(); it != optionMap.end(); ++it )
		outOptions.push_back( it->second );
}
コード例 #12
0
ファイル: mainwindowimpl.cpp プロジェクト: Fale/Ascii-Design
bool MainWindowImpl::showOptionsDialog()
{
	dialogOptionsImpl *dialogOpt = new dialogOptionsImpl;
	bool dlgState = dialogOpt->exec();

	loadOptions();

	return dlgState;
}
コード例 #13
0
 std::vector<std::string> OSArgumentRecord_Impl::stringToStringVector(const std::string& str) const
 {
   StringVector result;
   TableLoadOptions loadOptions(false,false,false); // choices are all strings
   Table table = Table::load(str,loadOptions);
   OS_ASSERT(table.nRows() < 2);
   if (table.nRows() == 1) {
     TableRow row = table[0];
     BOOST_FOREACH(const TableElement& e,row) {
       result.push_back(e.toString());
     }
コード例 #14
0
ファイル: UIOptions.cpp プロジェクト: pasnox/monkeystudio1
UIOptions::UIOptions( QWidget* parent )
	: QDialog( parent )
{
	setupUi( this );
	setAttribute( Qt::WA_DeleteOnClose );
	//
	loadOptions();
	// Make Connections
	QList<QToolButton*> tbs = tbOptions->findChildren<QToolButton*>( QRegExp( "tb*" ) );
	foreach ( QToolButton* tb, tbs )
		if ( tb != tbPath )
			connect( tb, SIGNAL( clicked() ), this, SLOT( tbText_clicked() ) );
}
コード例 #15
0
Options::Options(QWidget *parent)
    : QDialog(parent)
{
  ui.setupUi(this);

  connect(ui.chkSaveConnection, SIGNAL(stateChanged(int)),
          this, SLOT(toggleDBOptions(int)));

  connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
  connect(ui.btnApply, SIGNAL(clicked()), this, SLOT(saveOptions()));
  connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(saveOptionsAndClose()));

  loadOptions();
}
コード例 #16
0
ファイル: MainWindow.cpp プロジェクト: jangoclik/c4
void MainWindow::setupGame()
{
    //load all options needed
    loadOptions();
    m_gameWidget = new GameWidget(this);
    m_model = new GameModel(this);
    connect(m_model, SIGNAL(gameFinishedWithResult(GameResult*)), SLOT(onGameFinishedWithResult(GameResult*)));

    m_controller = new GameController(this);

    m_controller->setGameModel(m_model);
    m_gameWidget->setGameModel(m_model);
    m_controller->setGameWidget(m_gameWidget);


    m_controller->startGame();

    setCentralWidget(m_gameWidget);
}
コード例 #17
0
TabWidget::TabWidget(QWidget *parent) :
    QTabWidget(parent),
    m_ui(new Ui::TabWidget)
{
    m_ui->setupUi(this);
    connect(m_ui->pushButton_upload, SIGNAL(clicked()), this, SLOT(uploadDialog()));
    connect(m_ui->pushButton_clear, SIGNAL(clicked()), this, SLOT(clearTableView()));
    uploadings_model = new QStandardItemModel(0,2);
    m_ui->tableView->setModel(uploadings_model);
    connect(m_ui->pushButton_control, SIGNAL(clicked()), this, SLOT(controlUpload()));
    suffixes << "B" << "KB" << "MB" << "GB" << "TB" << "PB";
    loadOptions();
    connect(&Listener::instance(), SIGNAL(UploadingsReceived()), this, SLOT(newUpload()));
    connect(&Window::instance(), SIGNAL(UploadingsReceived()), this, SLOT(newUpload()));
    connect(m_ui->checkBox_api, SIGNAL(stateChanged(int)), this, SLOT(toggleApiKey(int)));
    connect(m_ui->lineEdit_api,SIGNAL(editingFinished()), this, SLOT(updateApiKey()));
    connect(m_ui->checkBox_systemtray, SIGNAL(stateChanged(int)), this, SLOT(toggleSystemTray(int)));
    newUpload();
}
コード例 #18
0
ファイル: mainwindowimpl.cpp プロジェクト: Fale/Ascii-Design
MainWindowImpl::MainWindowImpl(QWidget * parent)
	: QMainWindow(parent)
{
	setupUi(this);
	
	currentDocument = "";
    m_alignment = "-x";
	
	comboFonts = new QComboBox;
	toolBar->addWidget(comboFonts);
	opt = new Options;
	
    if (!opt->optionsTest()) {
		/*On windows set auto path */
		//
		#ifdef Q_OS_WIN32
		opt->windowsAutoOptions();
		#endif
		//
		#ifdef Q_OS_LINUX
		if (!showOptionsDialog()) {
			QMessageBox::information(0, tr("Warning"),
                                 tr("Please, set correctly \"figlet path\" and \"figlet fonts path\" in order to use \"Ascii Design\"!"));
            close();
		}
		#endif
    }
	loadOptions();	// Loads inifile ".ascii-design_options.conf";
	
	fMan = new FigletManager(figletPath);
	
	connect(textEditNormal, SIGNAL(textChanged()), this, SLOT(writeText()));
	connect(comboFonts, SIGNAL(currentIndexChanged(int)), this, SLOT(writeText()));
	
	setActions();

    QActionGroup *anActionGroup = new QActionGroup(this);
    anActionGroup->addAction(actionAlign_left);
    anActionGroup->addAction(actionAlign_center);
    anActionGroup->addAction(actionAlign_right);
}
コード例 #19
0
P2PConnectionsWindow::P2PConnectionsWindow(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) : WindowBase(parent, id, pos, size, style),
																																  m_connectionsCtrl(nullptr),
																																  m_imageList(16, 16),
																																  m_connectionsLimit(0)
{
	s_valid = true;

	m_timer = new wxTimer(this, idRefreshTimer);

	m_connectionInIcon = m_imageList.Add(wxBitmap(conversions::from_utf16<wxString>(Application::instance()->getResourcesFilePath(_S("main_icons_connection_in.png"))), wxBITMAP_TYPE_PNG));
	m_connectionOutIcon = m_imageList.Add(wxBitmap(conversions::from_utf16<wxString>(Application::instance()->getResourcesFilePath(_S("main_icons_connection_out.png"))), wxBITMAP_TYPE_PNG));

	createLayout();
	initWindow();

	loadOptions();

	shared_ptr<P2PServer> server = p2p::P2PSystem::instance()->getServer();
	if(server != nullptr)
	{
		shared_ptr<ConnectionsManager> connectionsManager = server->getConnectionsManager();
		if(connectionsManager != nullptr)
		{
			// Inizializza le connessioni attive
			Locked<const ConnectionsManager::Connections>::unique activeConnections = connectionsManager->getConnections();
			for(ConnectionsManager::Connections::const_iterator i = activeConnections->begin(); i != activeConnections->end(); ++i)
			{
				refreshConnectionInfo(i->second, connectionAdded);
			}

			// Registra il callback per la modifica delle connessioni (N.B.: tiene attivo "activeConnections" per assicurare la sincronizzazione tenendo loccato il mutex)
			connectionsManager->addListener(boost::bind(&P2PConnectionsWindow::connectionEventCallback, _1, _2));
		}
	}

	Options::instance()->subscribeUpdateHandler(boost::bind(&P2PConnectionsWindow::handleUpdateOptions, this));

	m_timer->Start(OS_UI_CONNECTIONS_PENDING_REFRESH_TIMER);
}
コード例 #20
0
ファイル: CliConfig.cpp プロジェクト: jktjkt/deska
CliConfig::CliConfig(const std::string &configFile, int argc, char **argv): CliConfigBase()
{
    namespace po = boost::program_options;

    boost::program_options::options_description options("Deska CLI Options");
    options.add_options()
        ((CmdLine_Help + ",h").c_str(), "produces this help message")
        ((CmdLine_Version + ",v").c_str(), "prints version information")
        ((CmdLine_NonInteractive + ",n").c_str(), "flag singalising, that all questions concerning object deletion, creation, etc. will be automaticly confirmed")
        ((CmdLine_Dump + ",d").c_str(), po::value<std::string>()->implicit_value(""), "dumps DB to a file or to standard output")
        ((CmdLine_Backup + ",b").c_str(), po::value<std::string>(), "creates backup of the DB to a file")
        ((CmdLine_Restore + ",r").c_str(), po::value<std::string>(), "restores the DB from a file")
        ((CmdLine_Execute + ",e").c_str(), po::value<std::string>(), "executes commands from a file")
        // FIXME: Proper handling of required options is not available in Boost 1.41
        (DBConnection_Server.c_str(), po::value<std::vector<std::string> >()->multitoken()/*->required()*/, "path to executable for connection to Deska server including arguments")
        (CLI_HistoryFilename.c_str(), po::value<std::string>()->default_value(std::getenv("HOME") + std::string("/.local/share/deska/.deska_cli_history")), "name of file with history")
        (CLI_HistoryLimit.c_str(), po::value<unsigned int>()->default_value(64), "number of lines stored in history")
        (CLI_LineWidth.c_str(), po::value<unsigned int>()->default_value(0), "width of line for wrapping")
        (CLI_NonInteractive.c_str(), po::value<bool>()->default_value(false), "flag singalising, that all questions concerning object deletion, creation, etc. will be automaticly confirmed");

    loadOptions(options, configFile, argc, argv);
}
コード例 #21
0
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	if (FindWindow(msgClassName, NULL)) return 1;

	CoInitialize(NULL);

	WNDCLASSEX msgClass = {};
	msgClass.cbSize = sizeof(WNDCLASSEX);
	msgClass.lpfnWndProc = msgClassProc;
	msgClass.hInstance = hInstance;
	msgClass.lpszClassName = msgClassName;

	RegisterClassEx(&msgClass);
	msgWindow = CreateWindowEx(0, msgClassName, msgWindowName, NULL, 0, 0, 0, 0, NULL, NULL, hInstance, NULL);
	popupMenu = GetSubMenu(LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1)), 0);
	loadOptions();

	shellData = {};
	shellData.cbSize = sizeof(NOTIFYICONDATA);
	shellData.hWnd = msgWindow;
	shellData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
	shellData.uCallbackMessage = shellCallback;
	shellData.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
	strcpy_s(shellData.szTip, "Netflix and Game");

	Shell_NotifyIcon(NIM_ADD, &shellData);
	keyHook = SetWindowsHookEx(WH_KEYBOARD_LL, keyHookProc, hInstance, 0);

	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0) > 0)
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	Shell_NotifyIcon(NIM_DELETE, &shellData);
	UnhookWindowsHookEx(keyHook);
	return 0;
}
コード例 #22
0
ファイル: LightFocus.cpp プロジェクト: nguyenkha/light-focus
MainWindow::MainWindow(Application *application) : CustomWindow(application)
{
	Window::init(NULL, WS_OVERLAPPEDWINDOW, _application->loadString(IDS_APP_TITLE), CW_USEDEFAULT, 0, 400, 300, NULL);

	// Load options
	loadOptions();

	// Never show this window
	show(SW_HIDE);

	// Init notify icon
	NOTIFYICONDATA createStruct;
	createStruct.cbSize = sizeof(NOTIFYICONDATA);
	createStruct.hWnd = _handle;
	createStruct.uID = 0;
	createStruct.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
	createStruct.uCallbackMessage = UWM_NOTIFY_ICON;
	createStruct.hIcon = LoadIcon(_application->getHandle(), MAKEINTRESOURCE(IDI_LIGHTFOCUS));
	_tcscpy(createStruct.szTip, _T("Light Focus - A screenshot program")); // name of program for icon in system tray
	Shell_NotifyIcon(NIM_ADD, &createStruct); // NIM_ADD : flag for adding icon into system tray, createStruct is struct of icon to add.

	// Create notify icon menu
	_notifyIconMenu = CreatePopupMenu();
	InsertMenu(_notifyIconMenu, 0, MF_BYPOSITION | MF_STRING, IDM_ABOUT, _T("About"));
	InsertMenu(_notifyIconMenu, 1, MF_BYPOSITION | MF_STRING, IDM_OPEN_FODLER, _T("Open strorage Folder"));
	InsertMenu(_notifyIconMenu, 2, MF_BYPOSITION | MF_STRING, IDM_OPTIONS, _T("Options"));
	InsertMenu(_notifyIconMenu, 3, MF_BYPOSITION | MF_SEPARATOR, 0, 0);
	InsertMenu(_notifyIconMenu, 4, MF_BYPOSITION | MF_STRING, IDM_EXIT, _T("Exit"));
	InsertMenu(_notifyIconMenu, 5, MF_BYPOSITION | MF_STRING, IDM_PRINT_SCREEN, _T("Take a screenshot"));

	// Init background window
	_backgroundWindow = new BackgroundWindow(this);

	// Init overlay window
	_overlayWindow = new OverlayWindow(this);

	_optionsWindow = NULL;
}
コード例 #23
0
ファイル: mads.cpp プロジェクト: 86400/scummvm
void MADSEngine::initialize() {
	// Initial sub-system engine references
	MSurface::setVm(this);
	MSprite::setVm(this);

	Resources::init(this);
	Conversation::init(this);
	_debugger = new Debugger(this);
	_dialogs = Dialogs::init(this);
	_events = new EventsManager(this);
	_palette = new Palette(this);
	Font::init(this);
	_font = new Font();
	_screen = new Screen();
	_sound = new SoundManager(this, _mixer);
	_audio = new AudioPlayer(_mixer, getGameID());
	_game = Game::init(this);
	_gameConv = new GameConversations(this);

	loadOptions();

	_screen->clear();
}
コード例 #24
0
ファイル: util.cpp プロジェクト: amoylel/avTranscoder
OptionArrayMap getAudioCodecOptions()
{
    OptionArrayMap audioCodecOptions;

    AVCodec* codec = av_codec_next( NULL );

    // iterate on codecs
    while( codec )
    {
        // add only audio codec
        if( codec->type == AVMEDIA_TYPE_AUDIO )
        {
            if( codec->priv_class )
            {
                std::string audioCodecName( codec->name );
                OptionArray options;
                loadOptions( options, (void*)&codec->priv_class, 0  );
                audioCodecOptions.insert( std::make_pair( audioCodecName, options ) );
            }
        }
        codec = av_codec_next( codec );
    }
    return audioCodecOptions;
}
コード例 #25
0
ファイル: main.cpp プロジェクト: stream009/launchy
LaunchyWidget::LaunchyWidget(CommandFlags command) :
#ifdef Q_WS_WIN
	QWidget(NULL, Qt::FramelessWindowHint | Qt::Tool),
#endif
#ifdef Q_WS_X11
        QWidget(NULL, Qt::FramelessWindowHint),
#endif
#ifdef Q_WS_MAC
        QWidget(NULL, Qt::FramelessWindowHint),
#endif

	frameGraphic(NULL),
	trayIcon(NULL),
	alternatives(NULL),
	updateTimer(NULL),
	dropTimer(NULL),
	condensedTempIcon(NULL)
{
	setObjectName("launchy");
	setWindowTitle(tr("Launchy"));
#ifdef Q_WS_WIN
	setWindowIcon(QIcon(":/resources/launchy128.png"));
#endif
#ifdef Q_WS_MAC
        setWindowIcon(QIcon("../Resources/launchy_icon_mac.icns"));
        //setAttribute(Qt::WA_MacAlwaysShowToolWindow);
#endif

	setAttribute(Qt::WA_AlwaysShowToolTips);
	setAttribute(Qt::WA_InputMethodEnabled);
	if (platform->supportsAlphaBorder())
	{
		setAttribute(Qt::WA_TranslucentBackground);
	}
	setFocusPolicy(Qt::ClickFocus);

	createActions();

	gMainWidget = this;
	menuOpen = false;
	optionsOpen = false;
	dragging = false;
	gSearchText = "";

	alwaysShowLaunchy = false;

	connect(&iconExtractor, SIGNAL(iconExtracted(int, QIcon)), this, SLOT(iconExtracted(int, QIcon)));

	fader = new Fader(this);
	connect(fader, SIGNAL(fadeLevel(double)), this, SLOT(setFadeLevel(double)));

	optionsButton = new QPushButton(this);
	optionsButton->setObjectName("opsButton");
	optionsButton->setToolTip(tr("Launchy Options"));
	optionsButton->setGeometry(QRect());
	connect(optionsButton, SIGNAL(clicked()), this, SLOT(showOptionsDialog()));

	closeButton = new QPushButton(this);
	closeButton->setObjectName("closeButton");
	closeButton->setToolTip(tr("Close Launchy"));
	closeButton->setGeometry(QRect());
	connect(closeButton, SIGNAL(clicked()), qApp, SLOT(quit()));

	output = new QLabel(this);
	output->setObjectName("output");
	output->setAlignment(Qt::AlignHCenter);

	input = new CharLineEdit(this);
#ifdef Q_WS_MAC
        QMacStyle::setFocusRectPolicy(input, QMacStyle::FocusDisabled);
#endif
	input->setObjectName("input");
	connect(input, SIGNAL(keyPressed(QKeyEvent*)), this, SLOT(inputKeyPressEvent(QKeyEvent*)));
	connect(input, SIGNAL(focusIn(QFocusEvent*)), this, SLOT(focusInEvent(QFocusEvent*)));
	connect(input, SIGNAL(focusOut(QFocusEvent*)), this, SLOT(focusOutEvent(QFocusEvent*)));
	connect(input, SIGNAL(inputMethod(QInputMethodEvent*)), this, SLOT(inputMethodEvent(QInputMethodEvent*)));

	outputIcon = new QLabel(this);
	outputIcon->setObjectName("outputIcon");

	workingAnimation = new AnimationLabel(this);
	workingAnimation->setObjectName("workingAnimation");
	workingAnimation->setGeometry(QRect());

	// Load settings
	settings.load();

	// If this is the first time running or a new version, call updateVersion
	if (gSettings->value("version", 0).toInt() != LAUNCHY_VERSION)
	{
		updateVersion(gSettings->value("version", 0).toInt());
		command |= ShowLaunchy;
	}

	alternatives = new CharListWidget(this);
	alternatives->setObjectName("alternatives");
	alternatives->setWindowFlags(Qt::Window | Qt::Tool | Qt::FramelessWindowHint);
	alternatives->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	alternatives->setTextElideMode(Qt::ElideLeft);
	alternatives->setUniformItemSizes(true);
	listDelegate = new IconDelegate(this);
	defaultListDelegate = alternatives->itemDelegate();
	setSuggestionListMode(gSettings->value("GenOps/condensedView", 0).toInt());
	altScroll = alternatives->verticalScrollBar();
	altScroll->setObjectName("altScroll");
	connect(alternatives, SIGNAL(currentRowChanged(int)), this, SLOT(alternativesRowChanged(int)));
	connect(alternatives, SIGNAL(keyPressed(QKeyEvent*)), this, SLOT(alternativesKeyPressEvent(QKeyEvent*)));
	connect(alternatives, SIGNAL(focusOut(QFocusEvent*)), this, SLOT(focusOutEvent(QFocusEvent*)));

	alternativesPath = new QLabel(alternatives);
	alternativesPath->setObjectName("alternativesPath");
	alternativesPath->hide();
	listDelegate->setAlternativesPathWidget(alternativesPath);

	// Load the plugins
	plugins.loadPlugins();

	// Set the general options
	if (setAlwaysShow(gSettings->value("GenOps/alwaysshow", false).toBool()))
		command |= ShowLaunchy;
	setAlwaysTop(gSettings->value("GenOps/alwaystop", false).toBool());

	// Check for udpates?
	if (gSettings->value("GenOps/updatecheck", true).toBool())
	{
		checkForUpdate();
	}

	// Set the hotkey
	QKeySequence hotkey = getHotkey();
	if (!setHotkey(hotkey))
	{
		QMessageBox::warning(this, tr("Launchy"), tr("The hotkey %1 is already in use, please select another.").arg(hotkey.toString()));
		command = ShowLaunchy | ShowOptions;
	}

	// Set the timers
	updateTimer = new QTimer(this);
	dropTimer = new QTimer(this);
	dropTimer->setSingleShot(true);
	connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateTimeout()));
	connect(dropTimer, SIGNAL(timeout()), this, SLOT(dropTimeout()));
	int time = gSettings->value("GenOps/updatetimer", 10).toInt();
	if (time > 0)
		updateTimer->start(time * 60000);

	// Load the catalog
	catalog.reset(CatalogBuilder::createCatalog());
	catalog->load(settings.catalogFilename());

	// Load the history
	history.load(settings.historyFilename());

	// Load the skin
	applySkin(gSettings->value("GenOps/skin", "Default").toString());

	// Move to saved position
	loadPosition(gSettings->value("Display/pos", QPoint(0,0)).toPoint());
	loadOptions();

	executeStartupCommand(command);
}
コード例 #26
0
ファイル: mainc.cpp プロジェクト: BackTrackCRoot/DIE-engine
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    //    __DIE_OPTIONS options;
    QStringList arguments=QCoreApplication::arguments();
    // Default options
    //    options.bShowErrors=true;
    //    options.bShowOptions=true;
    //    options.bShowVersion=true;
    //    options.bScanSubfolders=true;
    //    options.bShowEntropy=false;
    //    options.bShowScanTime=false;
#ifdef QT_DEBUG
    //    arguments.append("/home/trix/progs/xntsv32/xntsv32.exe");
    ////    arguments.append("-database:$app/help");
    //////    arguments.append("-singlelineoutput:yes");
    //   // arguments.append("-showfileformatonce:no");
    //    arguments.append("-showentropy:yes");
    //   // arguments.append("-fullscan:yes");
#endif

    loadOptions(&SingleFileScan::options);
    //    // fill scripts
    Scan::loadScripts(&SingleFileScan::options);

    bool bInvalidBase=(SingleFileScan::options.listBinaryScripts.count()==0)
                      &&(SingleFileScan::options.listELFScripts.count()==0)
                      &&(SingleFileScan::options.listMACHScripts.count()==0)
                      &&(SingleFileScan::options.listMSDOSScripts.count()==0)
                      &&(SingleFileScan::options.listPEScripts.count()==0)
                      &&(SingleFileScan::options.listTextScripts.count()==0);


    if(arguments.count()==1)
    {
        printf(__DIE);
        printf(" ");
        printf(__VERSION);
        printf(" console\n");
        printf("\n");
        printf("Copyright(C) 2006-2008 Hellsp@wn 2012-2016 Hors\n");
        printf("Website: http://ntinfo.biz\n");
        printf("Bugreports: [email protected]\n");
        printf("\n");
        int nTotal=0;
        nTotal+=printSignatures("Binary",&SingleFileScan::options.listBinaryScripts);
        nTotal+=printSignatures("Text",&SingleFileScan::options.listTextScripts);
        nTotal+=printSignatures("MSDOS",&SingleFileScan::options.listMSDOSScripts);
        nTotal+=printSignatures("PE/PE+",&SingleFileScan::options.listPEScripts);
        nTotal+=printSignatures("ELF/ELF64",&SingleFileScan::options.listELFScripts);
        nTotal+=printSignatures("MACH/MACH64",&SingleFileScan::options.listMACHScripts);
        printf("Total signatures: %d\n",nTotal);
        //        printf("Number of Binary signatures: %d\n",getNumberOfScripts(&options.listBinaryScripts));
        //        printf("Number of Text signatures: %d\n",getNumberOfScripts(&options.listTextScripts));
        //        printf("Number of MSDOS signatures: %d\n",getNumberOfScripts(&options.listMSDOSScripts));
        //        printf("Number of PE/PE+ signatures: %d\n",getNumberOfScripts(&options.listPEScripts));
        //        printf("Number of ELF/ELF64 signatures: %d\n",getNumberOfScripts(&options.listELFScripts));
        //        printf("Number of MACH/MACH64 signatures: %d\n",getNumberOfScripts(&options.listMACHScripts));
        printf("\n");
        printf("Usage: DIEC file/directory [options]\n");
        printf("\n");
        printf("Options:\n");
        printf(QString("-showerrors [default: -showerrors:%1] Show all errors\n").arg(SingleFileScan::options.bShowErrors?"yes":"no").toAscii().data());
        printf(QString("-showoptions [default: -showoptions:%1] Show compiler/protector/packer/etc options\n").arg(SingleFileScan::options.bShowOptions?"yes":"no").toAscii().data());
        printf(QString("-showversion [default: -showversion:%1] Show compiler/protector/packer/etc version\n").arg(SingleFileScan::options.bShowVersion?"yes":"no").toAscii().data());
        printf(QString("-subfolders [default: -subfolders:%1] Scan subfolders. Only for directory scan\n").arg(SingleFileScan::options.bScanSubfolders?"yes":"no").toAscii().data());
        printf(QString("-showentropy [default: -showentropy:%1] Show entropy\n").arg(SingleFileScan::options.bShowEntropy?"yes":"no").toAscii().data());
        printf(QString("-singlelineoutput [default: -singlelineoutput:%1] Output as single line\n").arg(SingleFileScan::options.bSingleLineOutput?"yes":"no").toAscii().data());
        printf(QString("-showfileformatonce [default: -showfileformatonce:%1] Show file format once\n").arg(SingleFileScan::options.bShowFileFormatOnce?"yes":"no").toAscii().data());
        printf(QString("-fullscan [default: -fullscan:%1] Full scan for all valid types\n").arg(SingleFileScan::options.bFullScan?"yes":"no").toAscii().data());
        printf(QString("-database [default: -database:\"%1\"] Set scan database\n").arg(SingleFileScan::options.sDataBasePath).toAscii().data());
    }
    else if(arguments.count()>1)
    {
        QStringList listFiles;

        if(!ParseOptions(&SingleFileScan::options,&arguments,&listFiles))
        {
            return 0;
        }

        _MainClass mc(&a);

        mc.setOptions(&SingleFileScan::options);

        if(listFiles.count()!=1)
        {
            mc.handleMessage(QString("Number of files: %1").arg(listFiles.count()));
            printf("\n");
        }

        SingleFileScan sfs;

        //        sfs.setOptions(&options);

        for(int i=0; i<listFiles.count(); i++)
        {
            if(listFiles.count()!=1)
            {
                printf("%s",listFiles.at(i).toAscii().data());

                if(SingleFileScan::options.bSingleLineOutput)
                {
                    printf(": ");
                }
                else
                {
                    printf("\n");
                }
            }

            QString sResult=sfs.process(listFiles.at(i));

            printf("%s",sResult.toAscii().data());

            if(i!=listFiles.count()-1)
            {
                printf("\n");
            }
        }
    }

    if(bInvalidBase)
    {
        printf("Invalid signatures database! Please download signatures from https://github.com/horsicq/Detect-It-Easy/tree/master/db and put it to the application path.\n");
    }

    return 0;
    //    return a.exec();
}
コード例 #27
0
ファイル: ex1.cpp プロジェクト: rd3k/WaterSprinkler
void keyboardSpecial (int key, int x, int y) {
	switch (key) {
	case GLUT_KEY_PAGE_UP:
		if (selectedGravitationalForce != -1) {
			double m = gravitationalForce[selectedGravitationalForce].mass;
			m = std::min(m + 10, 100.0);
			gravitationalForce[selectedGravitationalForce].mass = m;
		}
		break;
	case GLUT_KEY_PAGE_DOWN:
		if (selectedGravitationalForce != -1) {
			double m = gravitationalForce[selectedGravitationalForce].mass;
			m = std::max(m - 10, 1.0);
			gravitationalForce[selectedGravitationalForce].mass = m;
		}
		break;
	case GLUT_KEY_UP:
		if (menu) {
			currentOption -= 1;
			if (currentOption < 0) {
				currentOption = optionCount - 1;
			}
		}
		break;
	case GLUT_KEY_DOWN:
		if (menu) {
			currentOption += 1;
			if (currentOption == optionCount) {
				currentOption = 0;
			}
		}
		break;
	case GLUT_KEY_LEFT:
		if (menu) {
			switch (currentOption) {
			case 0:
				Particle::initialVelocity = std::max(--Particle::initialVelocity, 1.0);
				break;
			case 1:
				initialColour = (--initialColour) < 0 ? (colourCount - 1) : initialColour;
				Particle::startColour = emitColours[initialColour];
				break;
			case 2:
				gravityIntensity = (--gravityIntensity) < minGravityIntensity ? minGravityIntensity : gravityIntensity;
				break;
			case 3:
				Particle::startLifeSpan = (Particle::startLifeSpan -= 20) < minParticleLifetime ? minParticleLifetime : Particle::startLifeSpan;
				break;
			case 4:
				renderMode = (--renderMode) < 0 ? (renderModeCount - 1) : renderMode;
				Particle::renderMode = (PARTICLERENDERMODE)renderMode;
				break;
			case 5:
				emitterCount = (--emitterCount) < minEmitterCount ? minEmitterCount : emitterCount;
				makeSprinkler();
				break;
			case 6:
				emitterSpacing = (--emitterSpacing) < minEmitterSpacing ? minEmitterSpacing : emitterSpacing;
				makeSprinkler();
				break;
			case 7:
				currentCamera = (--currentCamera) < 0 ? (cameraCount - 1) : currentCamera;
				if (currentCamera >= 4) {
					selectedFlyBy = currentCamera - 4;
					flyByElapsed = 0;
				}
				break;
			case 8:
				Particle::airResistance = (Particle::airResistance -= 0.1) < 1.0 ? 1.0 : Particle::airResistance;
				break;
			case 9:
				cycleColours = !cycleColours;
				break;
			case 10:
				emitFrequency = (--emitFrequency) < 1 ? 1 : emitFrequency;
				particleSystem.setEmitTicks(emitFrequency);
				break;
			case 11:
				ParticleEmitter::emitSpread = (--ParticleEmitter::emitSpread) < 1 ? 1 : ParticleEmitter::emitSpread;
				break;
			case 12:
				ParticleSystem::perEmit = (--ParticleSystem::perEmit) < 1 ? 1 : ParticleSystem::perEmit;
				break;
			case 13:
				ParticleEmitter::show = !ParticleEmitter::show;
				break;
			case 14:
				wireframe = !wireframe;
				break;
			case 15:
				showMountains = !showMountains;
				break;
			case 16:
				showTrees = !showTrees;
				break;
			case 17:
				showSky = !showSky;
				break;
			case 18:
				showGround = !showGround;
				break;
			case 19:
				demo = (--demo) < 0 ? (demoCount - 1) : demo;
				particleSystem.removeAllParticles();
				loadOptions(*demos[demo]);
				break;
			case 20:
				Particle::bounce = (Particle::bounce -= 0.1) < minParticleBounce ? minParticleBounce : Particle::bounce;
				break;
			case 21:
				skyTexture = !skyTexture;
				break;
			case 22:
				grassTexture = !grassTexture;
				break;
			case 23:
				showPipe = !showPipe;
				break;
			case 24:
				ParticleEmitter::randomness = !ParticleEmitter::randomness;
				break;
			case 25:
				Tree::drawLeaves = !Tree::drawLeaves;
				break;
			default:
				break;
			}
		}
		break;
	case GLUT_KEY_RIGHT:
		if (menu) {
			switch (currentOption) {
			case 0:
				Particle::initialVelocity = (++Particle::initialVelocity) > Particle::terminalVelocity ? 
					Particle::terminalVelocity : Particle::initialVelocity;
				break;
			case 1:
				initialColour = (++initialColour) == colourCount ? 0 : initialColour;
				Particle::startColour = emitColours[initialColour];
				break;
			case 2:
				gravityIntensity = (++gravityIntensity) > maxGravityIntensity ? maxGravityIntensity : gravityIntensity;
				break;
			case 3:
				Particle::startLifeSpan = (Particle::startLifeSpan += 20) > maxParticleLifetime ? maxParticleLifetime : Particle::startLifeSpan;
				break;
			case 4:
				renderMode = (++renderMode) == renderModeCount ? 0 : renderMode;
				Particle::renderMode = (PARTICLERENDERMODE)renderMode;
				break;
			case 5:
				emitterCount = (++emitterCount) > maxEmitterCount ? maxEmitterCount : emitterCount;
				makeSprinkler();
				break;
			case 6:
				emitterSpacing = (++emitterSpacing) > maxEmitterSpacing ? maxEmitterSpacing : emitterSpacing;
				makeSprinkler();
				break;
			case 7:
				currentCamera = (++currentCamera) == cameraCount ? 0 : currentCamera;
				if (currentCamera >= 4) {
					selectedFlyBy = currentCamera - 4;
					flyByElapsed = 0;
				}
				break;
			case 8:
				Particle::airResistance = (Particle::airResistance += 0.1) > 4.0 ? 4.0 : Particle::airResistance;
				break;
			case 9:
				cycleColours = !cycleColours;
				break;
			case 10:
				emitFrequency = (++emitFrequency) > 20 ? 20 : emitFrequency;
				particleSystem.setEmitTicks(emitFrequency);
				break;
			case 11:
				ParticleEmitter::emitSpread = (ParticleEmitter::emitSpread += 0.5) > 10 ? 10 : ParticleEmitter::emitSpread;
			case 12:
				ParticleSystem::perEmit = (++ParticleSystem::perEmit) > maxPerEmit ? maxPerEmit : ParticleSystem::perEmit;
				break;
			case 13:
				ParticleEmitter::show = !ParticleEmitter::show;
				break;
			case 14:
				wireframe = !wireframe;
				break;
			case 15:
				showMountains = !showMountains;
				break;
			case 16:
				showTrees = !showTrees;
				break;
			case 17:
				showSky = !showSky;
				break;
			case 18:
				showGround = !showGround;
				break;
			case 19:
				demo = (++demo) == demoCount ? 0 : demo;
				particleSystem.removeAllParticles();
				loadOptions(*demos[demo]);
				break;
			case 20:
				Particle::bounce = (Particle::bounce += 0.1) > maxParticleBounce ? maxParticleBounce : Particle::bounce;
				break;
			case 21:
				skyTexture = !skyTexture;
				break;
			case 22:
				grassTexture = !grassTexture;
				break;
			case 23:
				showPipe = !showPipe;
				break;
			case 24:
				ParticleEmitter::randomness = !ParticleEmitter::randomness;
				break;
			case 25:
				Tree::drawLeaves = !Tree::drawLeaves;
				break;
			default:
				break;
			}
		}
		break;
	case GLUT_KEY_HOME:
		std::cout << currentCamera << ", "
				  << cameraAngle << ", "
				  << cameraDistance << ", "
				  << cameraElevation << ", "
				  << Particle::initialVelocity << ", "
				  << gravityIntensity << ", "
				  << Particle::startLifeSpan << ", "
				  << renderMode << ", "
				  << emitterCount << ", "
				  << emitterSpacing << ", "
				  << Particle::airResistance << ", "
				  << emitFrequency << ", "
				  << ParticleEmitter::emitSpread << ", "
				  << ParticleSystem::perEmit << ", "
				  << ParticleEmitter::show << ", "
				  << wireframe << std::endl;
		break;
	case GLUT_KEY_END:
		std::cout << std::endl << "Camera position: Vector3(" << camera.x << ", " << camera.y << ", " << camera.z << ")" << std::endl;
		std::cout << "Camera lookat: Vector3(" << cameraLookAt.x << ", " << cameraLookAt.y << ", " << cameraLookAt.z << ")" << std::endl;
		std::cout << "Camera up: Vector3(" << cameraUp.x << ", " << cameraUp.y << ", " << cameraUp.z << ")" << std::endl;
		std::cout << "flyBy#.push_back(CameraSettings(0, Vector3(0.235554, 1319.98, 89.9972), Vector3(0.238018, 1318.98, 90.0285), Vector3(0, 1, 0), EASE_LINEAR));";
		break;
	default:
		// std::cout << key;
		break;
	}
}
コード例 #28
0
bool OptionsWrapper::loadMapOptions( const wxString& mapname)
{
	return loadOptions(MapOption,mapname);
}
コード例 #29
0
OptionsWrapper::OptionsWrapper()
{
	unLoadOptions();
	loadOptions( EngineOption, _T("") );
	loadOptions( PrivateOptions,_T("") );
}
コード例 #30
0
FormatContext::FormatContext( int req_flags )
	: _avFormatContext( NULL )
{
	_avFormatContext = avformat_alloc_context();
	loadOptions( _avFormatContext, req_flags );
}