RTAutomationManager::RTAutomationManager()
    : QMainWindow()
{
    ui.setupUi(this);

    layoutWindow();

    m_dialog = NULL;

    m_client = new ManagerClient();

    connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));

    connect(m_client, SIGNAL(clientConnected()), this, SLOT(clientConnected()));
    connect(m_client, SIGNAL(clientDisconnected()), this, SLOT(clientDisconnected()));
    connect(this, SIGNAL(clientRestart()), m_client, SLOT(clientRestart()));
    connect(this, SIGNAL(clientEnable(bool)), m_client, SLOT(clientEnable(bool)));

    m_client->resumeThread();

    restoreWindowState();
    initStatusBar();

    setWindowTitle(RTAutomationArgs::getAppName());
}
SyntroZigbeeGateway::SyntroZigbeeGateway(QSettings *settings, QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags), m_settings(settings)
{
	ui.setupUi(this);
	initStatusBar();
	initStatTable();

	loadNodeIDList();

	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
	connect(ui.actionConnect, SIGNAL(triggered()), this, SLOT(onConnect()));
	connect(ui.actionDisconnect, SIGNAL(triggered()), this, SLOT(onDisconnect()));
	connect(ui.actionConfigure, SIGNAL(triggered()), this, SLOT(onConfigure()));

	ui.actionDisconnect->setEnabled(false);

	m_controller = NULL;
	m_refreshTimer = 0;

	m_client = new ZigbeeGWClient(this, settings);
	m_client->resumeThread();

	m_syntroStatusTimer = startTimer(3000);

	restoreWindowState();
}
Example #3
0
void MainWindow::actionFullScreen()
{
	if (isFullScreen())
	{
		restoreWindowState();
	}
	else
	{
		storeWindowState();
		showFullScreen();
	}
}
Example #4
0
MainWindow::MainWindow(const QUrl& url)
: QMainWindow()
{
  MainApplication::application()->setActivationWindow(this);
  MainApplication::application()->registerWindow(this);

  QWebSettings::setIconDatabasePath(MainApplication::temporaryDir().path());

  //ensure the toolbars are unified on mac
  setUnifiedTitleAndToolBarOnMac(true);

  //create the tab widget
  m_tabWidget = new TabWidget(this, this);

  //create the main toolbar
  m_toolBar = new MainToolBar(m_tabWidget, this);

  //create the bookmarks toolbar
  m_bookmarksToolBar = new BookmarksToolBar(this);
  connect(m_bookmarksToolBar, SIGNAL(bookmarkTriggered(const QUrl&)),
          this, SLOT(onBookmarkTriggered(const QUrl&)));

  //create the find toolbar
  m_findToolBar = new QToolBar(this);
  setupFindToolBar();

  //add the widgets
  addToolBar(Qt::TopToolBarArea, m_toolBar);
  addToolBarBreak(Qt::TopToolBarArea);
  addToolBar(Qt::TopToolBarArea, m_bookmarksToolBar);
  addToolBar(Qt::BottomToolBarArea, m_findToolBar);
  setCentralWidget(m_tabWidget);

  //create and set up the menubar
  m_menuBar = new MenuBar(this);
  setMenuBar(m_menuBar);

  //set the window title and restore the state
  setWindowTitle(MainApplication::APPLICATION_NAME);
  restoreWindowState();

  //add a new tab to begin
  if (!url.toString().isEmpty())
    m_tabWidget->addNewTab(url);
  else
    m_tabWidget->addNewTab();

  connect(m_tabWidget, SIGNAL(tabChanged(WebPanel*)),
          this, SLOT(onTabChanged(WebPanel*)));

  show();
}
Example #5
0
BBGraphics *gxRuntime::openGraphics( int w,int h,int d,int driver,int flags ){
	if( graphics ) return 0;

	busy=true;

	bool d3d=flags & BBGraphics::GRAPHICS_3D ? true : false;
	bool windowed=flags & BBGraphics::GRAPHICS_WINDOWED ? true : false;

	if( windowed ) driver=0;

	curr_driver=drivers[driver];

	if( windowed ){
		if( (graphics=openWindowedGraphics( w,h,d,d3d )) ){
			gfx_mode=(flags & BBGraphics::GRAPHICS_SCALED) ? 1 : 2;
			auto_suspend=(flags & BBGraphics::GRAPHICS_AUTOSUSPEND) ? true : false;
			resize( w,h );
		}
	}else{
		backupWindowState();
		fullscreen();
		ShowCursor( 0 );
		if( graphics=openExclusiveGraphics( w,h,d,d3d ) ){
			gfx_mode=3;
			auto_suspend=true;
			SetCursorPos(0,0);
		}else{
			ShowCursor( 1 );
			restoreWindowState();
		}
	}

	if( !graphics ){
		gxGraphics::wipeSystemProperties();
		curr_driver=0;
	}else{
		((gxGraphics*)graphics)->setSystemProperties();
	}

	gfx_lost=false;

	busy=false;

	return graphics;
}
Example #6
0
ViewSingleCamera::ViewSingleCamera(QWidget *parent, AVSource *avSource)
	: QDialog(parent, Qt::WindowCloseButtonHint | Qt::WindowTitleHint)
{
	ui.setupUi(this);

	m_avSource = avSource;
	m_lastFrame = -1;

	restoreWindowState();
		
	if (m_avSource) {
		setWindowTitle(m_avSource->name());
		m_timer = startTimer(30);
	}
	else {
		m_timer = 0;
	}
}
Example #7
0
SyntroStore::SyntroStore(QSettings *settings, QWidget *parent)
	: QMainWindow(parent), m_settings(settings)
{
	m_startingUp = true;
	ui.setupUi(this);

	m_storeStreamDlg = NULL;

	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
	connect(ui.actionBasicSetup, SIGNAL(triggered()), this, SLOT(onBasicSetup()));

	initStatusBar();
	initDisplayStats();
	restoreWindowState();

	m_timerId = startTimer(2000);

	SyntroUtils::syntroAppInit(m_settings);
	m_client = new StoreClient(this, m_settings);
	setWindowTitle(QString("%1 - %2")
		.arg(m_settings->value(SYNTRO_PARAMS_APPNAME).toString())
		.arg(m_settings->value(SYNTRO_PARAMS_COMPTYPE).toString()));
	
	connect(this, SIGNAL(refreshStreamSource(int)), m_client, SLOT(refreshStreamSource(int)), Qt::QueuedConnection); 
	m_client->resumeThread();

	m_settings->beginReadArray(SYNTROSTORE_PARAMS_STREAM_SOURCES);
	for (int index = 0; index < SYNTROSTORE_MAX_STREAMS; index++) {
		m_settings->setArrayIndex(index);

		m_rxStreamTable->item(index, SYNTROSTORE_COL_STREAM)->setText(m_settings->value(SYNTROSTORE_PARAMS_STREAM_SOURCE).toString());
		if (m_settings->value(SYNTROSTORE_PARAMS_INUSE).toString() == SYNTRO_PARAMS_TRUE)
			m_useBox[index]->setCheckState(Qt::Checked);
		else
			m_useBox[index]->setCheckState(Qt::Unchecked);
	}
	m_settings->endArray();

	for (int index = 0; index < SYNTROSTORE_MAX_STREAMS; index++)
		emit refreshStreamSource(index);

	m_startingUp = false;
}
Example #8
0
/** Overloaded QWidget::setVisible(). If this window is already visible and
 * <b>visible</b> is true, this window will be brought to the top and given 
 * focus. If <b>visible</b> is false, then the window state will be saved and
 * this window will be hidden. */
void
VidaliaWindow::setVisible(bool visible)
{
  if (visible) {
    /* Bring the window to the top, if it's already open. Otherwise, make the
     * window visible. */
    if (isVisible()) {
      activateWindow();
      setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
      raise();
    } else {
      restoreWindowState();
    }
  } else {
    /* Save the last size and position of this window. */
    saveWindowState();
  }
  QMainWindow::setVisible(visible);
}
Example #9
0
void gxRuntime::closeGraphics( BBGraphics *g ){
	if( !graphics || graphics!=g ) return;

	auto_suspend=false;

	busy=true;

	freeInvalidationTimer();
	if( clipper ){ clipper->Release();clipper=0; }
	if( primSurf ){ primSurf->Release();primSurf=0; }
	delete graphics;graphics=0;

	if( gfx_mode==3 ){
		ShowCursor( 1 );
		restoreWindowState();
	}
	gfx_mode=0;

	gfx_lost=false;

	busy=false;
}
Example #10
0
SyntroReview::SyntroReview(QWidget *parent)
	: QMainWindow(parent)
{
	ui.setupUi(this);

	layoutWindow();
	restoreWindowState();

	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
	connect(m_slider, SIGNAL(sliderMoved(int)), this, SLOT(sliderMoved(int)));
	connect(ui.actionBasicSetup, SIGNAL(triggered()), this, SLOT(onBasicSetup()));
	connect(ui.actionCFSSelection, SIGNAL(triggered()), this, SLOT(onCFSSelection()));
	connect(ui.actionAudioSetup, SIGNAL(triggered()), this, SLOT(onAudioSetup()));
	ui.actionOpen->setEnabled(false);
	ui.actionClose->setEnabled(false);
	ui.actionCFSSelection->setEnabled(false);

	SyntroUtils::syntroAppInit();

	m_audioSize = -1;
	m_audioRate = -1;
	m_audioChannels = -1;

#if defined(Q_OS_OSX) || defined(Q_OS_WIN32)
		m_audioOut = NULL;
		m_audioOutDevice = NULL;
#else
		m_audioOutIsOpen = false;
#endif

    QSettings *settings = SyntroUtils::getSettings();

    settings->beginGroup(AUDIO_GROUP);

    if (!settings->contains(AUDIO_OUTPUT_DEVICE))

#ifdef Q_OS_OSX
        settings->setValue(AUDIO_OUTPUT_DEVICE, AUDIO_DEFAULT_DEVICE_MAC);
#else
#ifdef Q_OS_LINUX
        settings->setValue(AUDIO_OUTPUT_DEVICE, 0);

    if (!settings->contains(AUDIO_OUTPUT_CARD))
        settings->setValue(AUDIO_OUTPUT_CARD, 0);
#else
        settings->setValue(AUDIO_OUTPUT_DEVICE, AUDIO_DEFAULT_DEVICE);
#endif
#endif
    if (!settings->contains(AUDIO_ENABLE))
        settings->setValue(AUDIO_ENABLE, true);

	m_audioEnabled = settings->value(AUDIO_ENABLE).toBool();

	settings->endGroup();
	delete settings;
	m_client = new ReviewClient(this);
	connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(onOpen()));
	connect(ui.actionClose, SIGNAL(triggered()), this, SLOT(onClose()));
	connect(m_client, SIGNAL(newDirectory(QStringList)), this, SLOT(newDirectory(QStringList)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(showImage(QImage, QByteArray, unsigned int, QDateTime)), 
			this, SLOT(showImage(QImage, QByteArray, unsigned int, QDateTime)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(newAudio(QByteArray, int, int, int)), this, SLOT(newAudio(QByteArray, int, int, int)));
	connect(m_client, SIGNAL(newCFSState(int)), this, SLOT(newCFSState(int)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(newFileLength(unsigned int)), this, SLOT(newFileLength(unsigned int)), Qt::QueuedConnection);
	connect(this, SIGNAL(openFile(QString)), m_client, SLOT(openFile(QString)), Qt::QueuedConnection);
	connect(this, SIGNAL(closeFile()), m_client, SLOT(closeFile()), Qt::QueuedConnection);
	connect(this, SIGNAL(setPlayMode(int, bool)), m_client, SLOT(setPlayMode(int, bool)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(newPlayMode(int)), this, SLOT(newPlayMode(int)), Qt::QueuedConnection);
	connect(this, SIGNAL(setFrameIndex(unsigned int, int, bool)), m_client, SLOT(setFrameIndex(unsigned int, int, bool)), Qt::QueuedConnection);

	connect(m_client, SIGNAL(dirResponse(QStringList)), this, SLOT(dirResponse(QStringList)));
	connect(this, SIGNAL(requestDir()), m_client, SLOT(requestDir()));
	connect(this, SIGNAL(newCFSList()), m_client, SLOT(newCFSList()));

	m_client->resumeThread();

	m_statusTimer = startTimer(2000);
	m_directoryTimer = startTimer(10000);

	setWindowTitle(QString("%1 - %2")
		.arg(SyntroUtils::getAppType())
		.arg(SyntroUtils::getAppName()));

	setDisabledPlayControls();
}
Example #11
0
void MainWindow::triggerAction(int identifier, const QVariantMap &parameters)
{
	switch (identifier)
	{
		case ActionsManager::NewWindowAction:
			emit requestedNewWindow(false, false, QUrl());

			break;
		case ActionsManager::NewWindowPrivateAction:
			emit requestedNewWindow(true, false, QUrl());

			break;
		case ActionsManager::OpenAction:
			{
				const QUrl url = QFileDialog::getOpenFileUrl(this, tr("Open File"));

				if (url.isValid())
				{
					m_windowsManager->open(url);
				}
			}

			break;
		case ActionsManager::ClosePrivateTabsPanicAction:
			if (SessionsManager::isPrivate())
			{
				Application::getInstance()->close();
			}
			else
			{
				const QList<MainWindow*> windows = SessionsManager::getWindows();

				for (int i = 0; i < windows.count(); ++i)
				{
					if (windows[i]->getWindowsManager()->isPrivate())
					{
						windows[i]->close();
					}
					else
					{
						windows[i]->getWindowsManager()->triggerAction(ActionsManager::ClosePrivateTabsAction);
					}
				}
			}

			break;
		case ActionsManager::MaximizeTabAction:
		case ActionsManager::MinimizeTabAction:
		case ActionsManager::RestoreTabAction:
		case ActionsManager::AlwaysOnTopTabAction:
		case ActionsManager::MaximizeAllAction:
		case ActionsManager::MinimizeAllAction:
		case ActionsManager::RestoreAllAction:
		case ActionsManager::CascadeAllAction:
		case ActionsManager::TileAllAction:
			m_workspace->triggerAction(identifier, parameters);

			break;
		case ActionsManager::CloseWindowAction:
			close();

			break;
		case ActionsManager::SessionsAction:
			{
				SessionsManagerDialog dialog(this);
				dialog.exec();
			}

			break;
		case ActionsManager::SaveSessionAction:
			{
				SaveSessionDialog dialog(this);
				dialog.exec();
			}

			break;
		case ActionsManager::GoToPageAction:
			{
				OpenAddressDialog dialog(this);

				connect(&dialog, SIGNAL(requestedLoadUrl(QUrl,WindowsManager::OpenHints)), m_windowsManager, SLOT(open(QUrl,WindowsManager::OpenHints)));
				connect(&dialog, SIGNAL(requestedOpenBookmark(BookmarksItem*,WindowsManager::OpenHints)), m_windowsManager, SLOT(open(BookmarksItem*,WindowsManager::OpenHints)));
				connect(&dialog, SIGNAL(requestedSearch(QString,QString,WindowsManager::OpenHints)), m_windowsManager, SLOT(search(QString,QString,WindowsManager::OpenHints)));

				dialog.exec();
			}

			break;
		case ActionsManager::GoToHomePageAction:
			{
				const QString homePage = SettingsManager::getValue(QLatin1String("Browser/HomePage")).toString();

				if (!homePage.isEmpty())
				{
					m_windowsManager->open(QUrl(homePage), WindowsManager::CurrentTabOpen);
				}
			}

			break;
		case ActionsManager::BookmarksAction:
			{
				const QUrl url(QLatin1String("about:bookmarks"));

				if (!SessionsManager::hasUrl(url, true))
				{
					m_windowsManager->open(url);
				}
			}

			break;
		case ActionsManager::AddBookmarkAction:
			addBookmark(QUrl(), QString(), QString(), true);

			break;
		case ActionsManager::QuickBookmarkAccessAction:
			{
				OpenBookmarkDialog dialog(this);

				connect(&dialog, SIGNAL(requestedOpenBookmark(BookmarksItem*)), m_windowsManager, SLOT(open(BookmarksItem*)));

				dialog.exec();
			}

			break;
		case ActionsManager::WorkOfflineAction:
			SettingsManager::setValue(QLatin1String("Network/WorkOffline"), parameters);

			break;
		case ActionsManager::FullScreenAction:
			if (isFullScreen())
			{
				restoreWindowState();
			}
			else
			{
				storeWindowState();
				showFullScreen();
			}

			break;
		case ActionsManager::ShowTabSwitcherAction:
			if (!m_tabSwitcher)
			{
				m_tabSwitcher = new TabSwitcherWidget(m_windowsManager, this);
			}

			m_tabSwitcher->raise();
			m_tabSwitcher->resize(size());
			m_tabSwitcher->show(TabSwitcherWidget::ActionReason);

			break;
		case ActionsManager::ShowMenuBarAction:
			{
				ToolBarDefinition definition = ToolBarsManager::getToolBarDefinition(ToolBarsManager::MenuBar);
				definition.visibility = (parameters.value(QLatin1String("isChecked")).toBool() ? AlwaysVisibleToolBar : AlwaysHiddenToolBar);

				ToolBarsManager::setToolBar(definition);
			}

			break;
		case ActionsManager::ShowTabBarAction:
			{
				ToolBarDefinition definition = ToolBarsManager::getToolBarDefinition(ToolBarsManager::TabBar);
				definition.visibility = (parameters.value(QLatin1String("isChecked")).toBool() ? AlwaysVisibleToolBar : AlwaysHiddenToolBar);

				ToolBarsManager::setToolBar(definition);
			}

			break;
		case ActionsManager::ShowSidebarAction:
			SettingsManager::setValue(QLatin1String("Sidebar/Visible"), parameters.value(QLatin1String("isChecked")).toBool());

			break;
		case ActionsManager::OpenPanelAction:
			if (m_sidebar && m_sidebar->getCurrentPanel())
			{
				m_windowsManager->open(m_sidebar->getCurrentPanel()->getUrl(), WindowsManager::NewTabOpen);
			}

			break;
		case ActionsManager::ClosePanelAction:
			SettingsManager::setValue(QLatin1String("Sidebar/CurrentPanel"), QString());

			break;
		case ActionsManager::ShowErrorConsoleAction:
			m_ui->consoleDockWidget->setVisible(parameters.value(QLatin1String("isChecked")).toBool());

			break;
		case ActionsManager::LockToolBarsAction:
			ToolBarsManager::setToolBarsLocked(parameters.value(QLatin1String("isChecked")).toBool());

			break;
		case ActionsManager::ContentBlockingAction:
			{
				ContentBlockingDialog dialog(this);
				dialog.exec();
			}

			break;
		case ActionsManager::HistoryAction:
			{
				const QUrl url(QLatin1String("about:history"));

				if (!SessionsManager::hasUrl(url, true))
				{
					m_windowsManager->open(url);
				}
			}

			break;
		case ActionsManager::ClearHistoryAction:
			{
				ClearHistoryDialog dialog(SettingsManager::getValue(QLatin1String("History/ManualClearOptions")).toStringList(), false, this);
				dialog.exec();
			}

			break;
		case ActionsManager::NotesAction:
			{
				const QUrl url(QLatin1String("about:notes"));

				if (!SessionsManager::hasUrl(url, true))
				{
					m_windowsManager->open(url);
				}
			}

			break;
		case ActionsManager::TransfersAction:
			{
				const QUrl url(QLatin1String("about:transfers"));

				if (!SessionsManager::hasUrl(url, true))
				{
					m_windowsManager->open(url);
				}
			}

			break;
		case ActionsManager::CookiesAction:
			{
				const QUrl url(QLatin1String("about:cookies"));

				if (!SessionsManager::hasUrl(url, true))
				{
					m_windowsManager->open(url);
				}
			}

			break;
		case ActionsManager::PreferencesAction:
			{
				PreferencesDialog dialog(QLatin1String("general"), this);
				dialog.exec();
			}

			break;
		case ActionsManager::SwitchApplicationLanguageAction:
			{
				LocaleDialog dialog(this);
				dialog.exec();
			}

			break;
		case ActionsManager::CheckForUpdatesAction:
			{
				UpdateCheckerDialog *dialog = new UpdateCheckerDialog(this);
				dialog->show();
			}

			break;
		case ActionsManager::DiagnosticReportAction:
			{
				ReportDialog *dialog = new ReportDialog(this);
				dialog->show();
			}

			break;
		case ActionsManager::AboutApplicationAction:
			{
				WebBackend *backend = AddonsManager::getWebBackend();
				QString about = tr("<b>Otter %1</b><br>Web browser controlled by the user, not vice-versa.").arg(Application::getInstance()->getFullVersion());
				about.append(QLatin1String("<br><br>") + tr("Web backend: %1 %2.").arg(backend->getTitle()).arg(backend->getEngineVersion()) + QLatin1String("<br><br>"));

				if (QSslSocket::supportsSsl())
				{
					 about.append(tr("SSL library version: %1.").arg(QSslSocket::sslLibraryVersionString()));
				}
				else
				{
					about.append(tr("SSL library not available."));
				}

				QMessageBox::about(this, QLatin1String("Otter"), about);
			}

			break;
		case ActionsManager::AboutQtAction:
			Application::getInstance()->aboutQt();

			break;
		case ActionsManager::ExitAction:
			Application::getInstance()->close();

			break;
		default:
			m_windowsManager->triggerAction(identifier, parameters);

			break;
	}
}
Example #12
0
SyntroDB::SyntroDB()
	: QMainWindow()
{
	m_startingUp = true;
	ui.setupUi(this);

	m_storeStreamDlg = NULL;

	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
	connect(ui.actionBasicSetup, SIGNAL(triggered()), this, SLOT(onBasicSetup()));
	connect(ui.actionConfiguration, SIGNAL(triggered()), this, SLOT(onConfiguration()));

	initStatusBar();
	initDisplayStats();
	restoreWindowState();

	SyntroUtils::syntroAppInit();
	startControlServer();

	setWindowTitle(QString("%1 - %2")
		.arg(SyntroUtils::getAppType())
		.arg(SyntroUtils::getAppName()));

	m_storeClient = new StoreClient(this);
	
    connect(this, SIGNAL(refreshStreamSource(int)),
        m_storeClient, SLOT(refreshStreamSource(int)), Qt::QueuedConnection);
    connect(m_storeClient, SIGNAL(running()),
        this, SLOT(storeRunning()), Qt::QueuedConnection);
    m_storeClient->resumeThread();

	m_CFSClient = new CFSClient(this);
	m_CFSClient->resumeThread();

	QSettings *settings = SyntroUtils::getSettings();

	settings->beginReadArray(SYNTRODB_PARAMS_STREAM_SOURCES);

	for (int index = 0; index < SYNTRODB_MAX_STREAMS; index++) {
		settings->setArrayIndex(index);

		QString source = settings->value(SYNTRODB_PARAMS_STREAM_SOURCE).toString();

		m_rxStreamTable->item(index, SYNTRODB_COL_STREAM)->setText(source);

		if (source.length() > 0) {
			if (settings->value(SYNTRODB_PARAMS_INUSE, SYNTRO_PARAMS_FALSE).toString() == SYNTRO_PARAMS_TRUE)
				m_useBox[index]->setCheckState(Qt::Checked);
			else
				m_useBox[index]->setCheckState(Qt::Unchecked);
		}
		else {
			m_useBox[index]->setCheckState(Qt::Unchecked);
		}
	}

	settings->endArray();

	m_startingUp = false;

	delete settings;

	m_timerId = startTimer(2000);
}