Esempio n. 1
0
void MainWindow::createMenu()
{
	m_appMenu = menuBar()->addMenu(tr("&Bluecherry"));
	m_browseEventsAction = m_appMenu->addAction(tr("Browse &events"), this, SLOT(showEventsWindow()));
	m_downloadManagerAction = m_appMenu->addAction(tr("Show &download manager"), this, SLOT(showDownloadsWindow()));
	m_appMenu->addSeparator();
	m_addServerAction = m_appMenu->addAction(tr("Add another server"), this, SLOT(addServer()));
	m_optionsAction = m_appMenu->addAction(tr("&Options"), this, SLOT(showOptionsDialog()));
	m_appMenu->addSeparator();
	m_quitAction = m_appMenu->addAction(tr("&Quit"), qApp, SLOT(quit()));

    m_serversMenu = menuBar()->addMenu(QString());
    updateServersMenu();

	m_liveMenu = menuBar()->addMenu(tr("&Live"));
	updateLiveMenu();

    connect(m_serverRepository, SIGNAL(serverAdded(DVRServer*)), SLOT(updateServersMenu()));
    connect(m_serverRepository, SIGNAL(serverRemoved(DVRServer*)), SLOT(updateServersMenu()));

    connect(bcApp->liveView, SIGNAL(bandwidthModeChanged(int)), SLOT(bandwidthModeChanged(int)));

	m_helpMenu = menuBar()->addMenu(tr("&Help"));
	m_documentationAction = m_helpMenu->addAction(tr("&Documentation"), this, SLOT(openDocumentation()));
	m_supportAction = m_helpMenu->addAction(tr("Bluecherry &support"), this, SLOT(openSupport()));
	m_suggestionsAction = m_helpMenu->addAction(tr("Suggest a &feature"), this, SLOT(openIdeas()));
	m_helpMenu->addSeparator();
	m_aboutAction = m_helpMenu->addAction(tr("&About Bluecherry"), this, SLOT(openAbout()));
}
Esempio n. 2
0
void LaunchyWidget::executeStartupCommand(int command)
{
	if (command & ResetPosition)
	{
		QRect r = geometry();
		int primary = qApp->desktop()->primaryScreen();
		QRect scr = qApp->desktop()->availableGeometry(primary);

		QPoint pt(scr.width()/2 - r.width()/2, scr.height()/2 - r.height()/2);
		move(pt);
	}

	if (command & ResetSkin)
	{
		setOpaqueness(100);
		showTrayIcon();
		applySkin("Default");
	}

	if (command & ShowLaunchy)
		showLaunchy();

	if (command & ShowOptions)
		showOptionsDialog();

	if (command & Rescan)
		buildCatalog();

	if (command & Exit)
		close();
}
Esempio n. 3
0
void MainWindow::connectSignals
(
    void
)
{
    connect( ui->fileMenu, SIGNAL( aboutToShow() ), this, SLOT( enableExport() ) );
    connect( ui->toolsMenu, SIGNAL( aboutToShow() ), this, SLOT( enableClassify() ) );

    connect( ui->addFilesAction, SIGNAL( triggered() ), this, SLOT( addFiles() ) );
    connect( ui->addDirectoryAction, SIGNAL( triggered() ), this, SLOT( addDirectory() ) );
    connect( ui->aetExportAction, SIGNAL( triggered() ), this, SLOT( exportAetSession() ) );
    connect( ui->stepExportAction, SIGNAL( triggered() ), this, SLOT( exportStepSession() ) );
    connect( ui->exitAction, SIGNAL( triggered() ), qApp, SLOT( quit() ) );

    connect( ui->classifyAction, SIGNAL( triggered() ), session, SLOT( classify() ) );
    connect( ui->optionsAction, SIGNAL( triggered() ), this, SLOT( showOptionsDialog() ) );

    connect( this, SIGNAL( settingsChanged() ), session, SLOT( loadSettings() ) );

    connect( itemListModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( updateFileTreeView() ) );
    connect( variantListModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( updateFileTreeView() ) );

    connect( ui->varianceSlider, SIGNAL( valueChanged( int ) ), session, SLOT( setCurrentVariance( int ) ) );

    connect( session, SIGNAL( classificationChanged() ), this, SLOT( updateVariance() ) );
}
Esempio n. 4
0
void MainMenu::processMainMenu(Rocket::Core::Event& event)
{
    const Rocket::Core::String& id = event.GetCurrentElement()->GetId();
    if (id == "singleplayer") {
        m_mainMenuSingleplayer->Show();
    } else if (id == "multiplayer") {
        m_mainMenuMultiplayer->Show();
    } else if (id == "options") {
        showOptionsDialog();
    } else if (id == "quit") {
        // no prompt needed for save, no active connection.
        m_client->shutdown();
    }
}
Esempio n. 5
0
void LaunchyWidget::launchItem(CatItem& item)
{
	int ops = MSG_CONTROL_LAUNCHITEM;

	if (item.id != HASH_LAUNCHY && item.id != HASH_LAUNCHYFILE)
	{
		ops = plugins.execute(&inputData, &item);
		if (ops > 1)
		{
			switch (ops)
			{
			case MSG_CONTROL_EXIT:
				close();
				break;
			case MSG_CONTROL_OPTIONS:
				showOptionsDialog();
				break;
			case MSG_CONTROL_REBUILD:
				buildCatalog();
				break;
			case MSG_CONTROL_RELOADSKIN:
				reloadSkin();
				break;
			default:
				break;
			}
		}
	}
	
	if (ops == MSG_CONTROL_LAUNCHITEM)
	{
		QString args = "";
		if (inputData.count() > 1)
			for(int i = 1; i < inputData.count(); ++i)
				args += inputData[i].getText() + " ";

/* UPDATE
#ifdef Q_WS_X11
		if (!platform->Execute(item.fullPath, args))
			runProgram(item.fullPath, args);
#else
*/
		runProgram(item.fullPath, args);
//#endif
	}
	
	catalog->incrementUsage(item);
	history.addItem(inputData);
}
Esempio n. 6
0
void MainWindowImpl::setActions()
{
	connect(actionOpenFile, SIGNAL(triggered()), this, SLOT(openText()));
	connect(actionSave, SIGNAL(triggered()), this, SLOT(save()));
	connect(actionSaveAs, SIGNAL(triggered()), this, SLOT(saveAs()));
	connect(actionClose, SIGNAL(triggered()), this, SLOT(close()));

    connect(actionAlign_left, SIGNAL(triggered()), this, SLOT(changeAlignment()));
    connect(actionAlign_center, SIGNAL(triggered()), this, SLOT(changeAlignment()));
    connect(actionAlign_right, SIGNAL(triggered()), this, SLOT(changeAlignment()));

	connect(actionConfigure, SIGNAL(triggered()), this, SLOT(showOptionsDialog()));

	connect(actionInfo, SIGNAL(triggered()), this, SLOT(showInfo()));
}
Esempio n. 7
0
void MainMenu::processEscapeMenu(Rocket::Core::Event& event)
{
    const Rocket::Core::String& id = event.GetCurrentElement()->GetId();

    if (id == "resume") {
        hideEscapeMenu();
    } else if (id == "disconnect") {
        m_client->disconnect();
    } else if (id == "options") {
        showOptionsDialog();
    } else if (id == "quit") {
        //FIXME: prompt dialog to disconnect, as we clearly are connected.
        m_client->shutdown();
    }
}
Esempio n. 8
0
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);
}
Esempio n. 9
0
/**
 * Test dialog opening
 */
void DialogsManager::testDialogOpening() {
	if (_vm->_globals->_cityMapEnabledFl)
		_vm->_events->_gameKey = KEY_NONE;

	if ((_vm->_events->_gameKey == KEY_NONE) || _inventFl)
		return;

	DIALOG_KEY key = _vm->_events->_gameKey;
	_vm->_events->_gameKey = KEY_NONE;
	_inventFl = true;

	switch (key) {
	case KEY_INVENTORY:
		showInventory();
		break;
	case KEY_OPTIONS:
		_vm->_graphicsMan->_scrollStatus = 1;
		showOptionsDialog();
		_vm->_graphicsMan->_scrollStatus = 0;
		break;
	case KEY_LOAD:
		_vm->_graphicsMan->_scrollStatus = 1;
		showLoadGame();
		_vm->_graphicsMan->_scrollStatus = 0;
		break;
	case KEY_SAVE:
		_vm->_graphicsMan->_scrollStatus = 1;
		showSaveGame();
		_vm->_graphicsMan->_scrollStatus = 0;
		break;
	default:
		break;
	}

	_inventFl = false;
	_vm->_events->_gameKey = KEY_NONE;
}
Esempio n. 10
0
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);
}
Esempio n. 11
0
void DialogsManager::showInventory() {
	if (_removeInventFl || _inventDisplayedFl || _vm->_globals->_disableInventFl)
		return;

	_vm->_graphicsMan->_scrollStatus = 1;
	_vm->_objectsMan->_eraseVisibleCounter = 4;
	_vm->_objectsMan->_visibleFl = false;
	for (int i = 0; i <= 1; i++) {
		inventAnim();
		_vm->_events->getMouseX();
		_vm->_events->getMouseY();
		_vm->_events->refreshScreenAndEvents();
	}
	_inventWin1 = NULL;

	bool loopFl;
	do {
		loopFl = false;
		_vm->_events->_curMouseButton = 0;
		_vm->_events->_mouseButton = 0;
		_vm->_globals->_disableInventFl = true;
		_vm->_graphicsMan->setColorPercentage2(251, 100, 100, 100);

		Common::String filename;
		if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
			filename = "INVENT.SPR";
		else {
			switch (_vm->_globals->_language) {
			case LANG_EN:
				filename = "INVENTAN.SPR";
				break;
			case LANG_FR:
				filename = "INVENTFR.SPR";
				break;
			case LANG_SP:
				filename = "INVENTES.SPR";
				break;
			}
		}

		Common::File f;
		if (!f.open(filename))
			error("Error opening file - %s", filename.c_str());

		size_t filesize = f.size();
		_inventWin1 = _vm->_globals->allocMemory(filesize);
		_vm->_fileIO->readStream(f, _inventWin1, filesize);
		f.close();

		_inventBuf2 = _vm->_fileIO->loadFile("INVENT2.SPR");

		_inventX = _vm->_graphicsMan->_scrollOffset + 152;
		_inventY = 114;
		_inventWidth = _vm->_objectsMan->getWidth(_inventWin1, 0);
		_inventHeight = _vm->_objectsMan->getHeight(_inventWin1, 0);

		_vm->_graphicsMan->drawCompressedSprite(_vm->_graphicsMan->_frontBuffer, _inventWin1, _inventX + 300, 414, 0, 0, 0, false);
		int curPosY = 0;
		int inventCount = 0;
		for (int inventLine = 1; inventLine <= 5; inventLine++) {
			int curPosX = 0;
			for (int inventCol = 1; inventCol <= 6; inventCol++) {
				++inventCount;
				int inventIdx = _vm->_globals->_inventory[inventCount];
				// The last two zones are not reserved for the inventory: Options and Save/Load
				if (inventIdx && inventCount <= 29) {
					byte *obj = _vm->_objectsMan->loadObjectFromFile(inventIdx, false);
					_vm->_graphicsMan->restoreSurfaceRect(_vm->_graphicsMan->_frontBuffer, obj, _inventX + curPosX + 6,
						curPosY + 120, _vm->_objectsMan->getObjectWidth(), _vm->_objectsMan->getObjectHeight());
					_vm->_globals->freeMemory(obj);
				}
				curPosX += 54;
			};
			curPosY += 38;
		}
		_vm->_graphicsMan->copySurfaceRect(_vm->_graphicsMan->_frontBuffer, _inventWin1, _inventX, _inventY, _inventWidth, _inventHeight);
		_vm->_events->_curMouseButton = 0;
		int newInventoryItem = 0;

		// Main loop to select an inventory item
		while (!_vm->shouldQuit()) {
			// Turn on drawing the inventory dialog in the event manager
			_inventDisplayedFl = true;

			int mousePosX = _vm->_events->getMouseX();
			int mousePosY = _vm->_events->getMouseY();
			int mouseButton = _vm->_events->getMouseButton();
			int oldInventoryItem = newInventoryItem;
			newInventoryItem = _vm->_linesMan->checkInventoryHotspots(mousePosX, mousePosY);
			if (newInventoryItem != oldInventoryItem)
				_vm->_objectsMan->initBorder(newInventoryItem);
			int cursorId = _vm->_events->_mouseCursorId;
			if (cursorId != 1 && cursorId != 2 && cursorId != 3 && cursorId != 16) {
				if (mouseButton == 2) {
					_vm->_objectsMan->nextObjectIcon(newInventoryItem);
					cursorId = _vm->_events->_mouseCursorId;
					if (cursorId != 23)
						_vm->_events->changeMouseCursor(cursorId);
				}
			}
			cursorId = _vm->_events->_mouseCursorId;
			if (mouseButton == 1) {
				if (cursorId == 1 || cursorId == 2 || cursorId == 3 || cursorId == 16 || !cursorId)
					break;
				_vm->_objectsMan->takeInventoryObject(_vm->_globals->_inventory[newInventoryItem]);
				if (_vm->_events->_mouseCursorId == 8)
					break;

				_vm->_script->_tempObjectFl = true;
				_vm->_globals->_saveData->_data[svLastObjectIndex] = _vm->_objectsMan->_curObjectIndex;
				_vm->_globals->_saveData->_data[svLastInventoryItem] = _vm->_globals->_inventory[newInventoryItem];
				_vm->_globals->_saveData->_data[svLastInvMouseCursor] = _vm->_events->_mouseCursorId;
				_vm->_objectsMan->loadObjectIniFile();
				_vm->_script->_tempObjectFl = false;

				if (_vm->_soundMan->_voiceOffFl) {
					do {
						_vm->_events->refreshScreenAndEvents();
					} while (!_vm->_globals->_exitId && _vm->_events->getMouseButton() != 1);
					_vm->_fontMan->hideText(9);
				}
				if (_vm->_globals->_exitId) {
					if (_vm->_globals->_exitId == 2) {
						_vm->_globals->_exitId = 0;
						break;
					}

					_vm->_globals->_exitId = 0;
					_inventBuf2 = _vm->_globals->freeMemory(_inventBuf2);
					_inventWin1 = _vm->_globals->freeMemory(_inventWin1);
					loopFl = true;
					break;
				} else
					_inventDisplayedFl = true;
			}
			if (_removeInventFl)
				break;
			_vm->_events->refreshScreenAndEvents();
			if (_vm->_globals->_screenId >= 35 && _vm->_globals->_screenId <= 40)
				_vm->_objectsMan->handleSpecialGames();
		}
	} while (loopFl);

	_vm->_fontMan->hideText(9);
	if (_inventDisplayedFl) {
		_inventDisplayedFl = false;
		_vm->_graphicsMan->copySurface(_vm->_graphicsMan->_backBuffer, _inventX, 114, _inventWidth, _inventHeight, _vm->_graphicsMan->_frontBuffer, _inventX, 114);
		_vm->_graphicsMan->addDirtyRect(_inventX, 114, _inventX + _inventWidth, _inventWidth + 114);
		_vm->_objectsMan->_refreshBobMode10Fl = true;
	}

	_inventWin1 = _vm->_globals->freeMemory(_inventWin1);
	_inventBuf2 = _vm->_globals->freeMemory(_inventBuf2);

	int cursorId = _vm->_events->_mouseCursorId;
	if (cursorId == 1)
		showOptionsDialog();
	else if (cursorId == 3)
		showLoadGame();
	else if (cursorId == 2)
		showSaveGame();

	_vm->_events->_mouseCursorId = 4;
	_vm->_events->changeMouseCursor(4);
	_vm->_objectsMan->_oldBorderPos = Common::Point(0, 0);
	_vm->_objectsMan->_borderPos = Common::Point(0, 0);
	_vm->_globals->_disableInventFl = false;
	_vm->_graphicsMan->_scrollStatus = 0;
}