void UIVMLogViewerDialog::loadSettings()
{
    /* Acquire widget: */
    const UIVMLogViewerWidget *pWidget = qobject_cast<const UIVMLogViewerWidget*>(widget());

    /* Restore window geometry: */
    const QRect desktopRect = gpDesktop->availableGeometry(this);
    int iDefaultWidth = desktopRect.width() / 2;
    int iDefaultHeight = desktopRect.height() * 3 / 4;

    /* Try obtain the default width of the current logviewer: */
    if (pWidget)
    {
        int iWidth =  pWidget->defaultLogPageWidth();
        if (iWidth != 0)
            iDefaultWidth = iWidth;
    }

    QRect defaultGeometry(0, 0, iDefaultWidth, iDefaultHeight);
    if (centerWidget())
        defaultGeometry.moveCenter(centerWidget()->geometry().center());

    /* Load geometry from extradata: */
    QRect geometry = gEDataManager->logWindowGeometry(this, defaultGeometry);

    /* Restore geometry: */
    LogRel2(("GUI: UIVMLogViewer: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n",
             geometry.x(), geometry.y(), geometry.width(), geometry.height()));
    setDialogGeometry(geometry);
}
Beispiel #2
0
	void Application::initialise(void)
	{

		mOgreWidget->show();
		mOgreWidget->resize(800,600);
		centerWidget(mOgreWidget);

		centerWidget(mLogManager, mOgreWidget);

		mLogManager->setForceProcessEvents(true);
		initialiseOgre();
		
		
		mLogManager->setForceProcessEvents(false);

		//mLogManager->hide();




		mOgreWidget->setEventHandler(mGameLogic);

		//This is a bit of a hack, necessary because we want to use the settings dialog in two different
		//ways. The first time it is shown (by Application::exec()) no slot is connected - the Accepted
		//event is handled explicitly because the system is not initialised at that point. But now (and
		//when the dialog is shown in future) we are ready for it, so we connect the accepted() signal.
		//We also call accept, to do the initial setup. See also Application::exec().
		connect(mSettingsDialog, SIGNAL(accepted()), this, SLOT(applySettings()));
		mSettingsDialog->accept();

		Ogre::NameValuePairList ogreWindowParams;
		//ogreWindowParams["FSAA"] = "8";
		mOgreWidget->initialise(&ogreWindowParams);

		//Set up resource paths. This can't be done until the OgreWidget
		//is initialised, because we need the GPUProgramManager.
		if(QFile::exists("resources.cfg"))
		{
			loadResourcePathsFromConfigFile("resources.cfg");
			Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
		}

		mFPSDialog = new FPSDialog(mOgreWidget, Qt::ToolTip);
		mFPSDialog->setWindowOpacity(settings()->value("System/DefaultWindowOpacity", 1.0).toDouble());
		mFPSDialog->move(mainWidget()->geometry().topLeft() + QPoint(10,10));

		mLogManager->move(mainWidget()->geometry().left() + 10, mainWidget()->geometry().top() + mainWidget()->geometry().height() - mLogManager->frameGeometry().height() - 10);

		mGameLogic->initialise();

		if(mAutoUpdateEnabled)
		{
			mAutoUpdateTimer->start();
		}

		mIsInitialised = true;
	}
Beispiel #3
0
    void Application::initialise( void )
    {

        mOgreWidget->show();
        mOgreWidget->resize( 800, 600 );
        centerWidget( mOgreWidget );

        //mLogManagerDockWidget = mMainWindow->addAsDockWidget(mLogManager, "Logs", Qt::AllDockWidgetAreas);
        //mLogManager->setParent(mMainWindow);
        centerWidget( mLogManager, mOgreWidget );

        mLogManager->show();

        //mLogManager->setForceProcessEvents(true);
        initialiseOgre();
        Ogre::NameValuePairList ogreWindowParams;
        ogreWindowParams["FSAA"] = "8";
        mOgreWidget->initialise( &ogreWindowParams );
        mGameLogic->initialise();
        //mLogManager->setForceProcessEvents(false);

        //mLogManager->hide();




        mOgreWidget->setEventHandler( mGameLogic );

        //This is a bit of a hack, necessary because we want to use the settings dialog in two different
        //ways. The first time it is shown (by Application::exec()) no slot is connected - the Accepted
        //event is handled explicitly because the system is not initialised at that point. But now (and
        //when the dialog is shown in future) we are ready for it, so we connect the accepted() signal.
        //We also call accept, to do the initial setup. See also Application::exec().
        connect( mSettingsDialog, SIGNAL( accepted() ), this, SLOT( applySettings() ) );
        mSettingsDialog->accept();

        mFPSDialog = new FPSDialog( mOgreWidget, Qt::FramelessWindowHint );
        mFPSDialog->setWindowOpacity( settings()->value( "System/DefaultWindowOpacity", 1.0 ).toDouble() );
        mFPSDialog->move( mainWidget()->geometry().topLeft() + QPoint( 10, 10 ) );
        mFPSDialog->show();

        mLogManager->move( mainWidget()->geometry().left() + 10, mainWidget()->geometry().top() + mainWidget()->geometry().height() - mLogManager->frameGeometry().height() - 10 );

        mUpdateTimer = new QTimer;
        QObject::connect( mUpdateTimer, SIGNAL( timeout() ), this, SLOT( update() ) );
        //On the test system, a value of one here gives a high frame rate and still allows
        //event prcessing to take place. A value of 0 doubles the frame rate but the mouse
        //becomes jumpy. This property should probably be configurable.
        mUpdateTimer->start( 1 );
    }
AlignInBlocksDialog::AlignInBlocksDialog(QWidget *parent)
  : QDialog(parent), blockLen(5)
{
  QLabel *header = new QLabel(tr("Select the size of the blocks to rearrange the ciphertext into."));
  QLabel *lblLen = new QLabel(tr("Block length:"));

  spinLen = new QSpinBox;
  spinLen->setValue(blockLen);

  QDialogButtonBox *box =
    new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
  connect(box, SIGNAL(accepted()), this, SLOT(onFinished()));
  connect(box, SIGNAL(rejected()), this, SLOT(reject()));

  QHBoxLayout *layoutLen = new QHBoxLayout;
  layoutLen->addWidget(lblLen);
  layoutLen->addWidget(spinLen);

  QVBoxLayout *layout = new QVBoxLayout;
  layout->addWidget(header);    
  layout->addLayout(layoutLen);
  layout->addWidget(box);

  setLayout(layout);

  setWindowTitle(tr("Align in Blocks"));
  centerWidget(this);   
}
Beispiel #5
0
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent)
{
	setWindowTitle(tr("Configure %1").arg(KtikzApplication::applicationName()));

	addPage(generalPage(), tr("&General"), "preferences-desktop-theme");
	addPage(editorPage(), tr("&Editor"), "accessories-text-editor");
	addPage(appearancePage(), tr("&Highlighting"), "preferences-desktop-color");

	QDialogButtonBox *buttonBox = new QDialogButtonBox;
	QAction *whatsThisAction = QWhatsThis::createAction(this);
	whatsThisAction->setIcon(Icon("help-contextual"));
	QToolButton *whatsThisButton = new QToolButton(this);
	whatsThisButton->setDefaultAction(whatsThisAction);
	whatsThisButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);
	buttonBox->addButton(whatsThisButton, QDialogButtonBox::HelpRole);
	buttonBox->addButton(QDialogButtonBox::Ok);
	buttonBox->addButton(QDialogButtonBox::Cancel);
	connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
	connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addWidget(centerWidget());
	mainLayout->addWidget(buttonBox);
	setLayout(mainLayout);
}
Beispiel #6
0
void MainDialog::trayIconClicked(QSystemTrayIcon::ActivationReason reason)
{
	(void)(reason); /* unused */

	if (this->isVisible())
		this->hide();
	else {
		centerWidget(this);
		this->show();
		this->raise();
		this->activateWindow();
	}
}
Beispiel #7
0
void MainDialog::NowRun()
{
	centerWidget(this);
	this->show();

	obj_this = this;

	ui.setupUi(this);
	QIcon accountIcon(QLatin1String(":rc/user.png"));
	QListWidgetItem *account = new QListWidgetItem(accountIcon, "Account", ui.labelWidget);
	account->setSizeHint(QSize(0, 32));
	this->accountSettings = new AccountSettings(this);
	ui.stack->addWidget(this->accountSettings);

	QIcon syslogIcon(QLatin1String(":rc/loop_alt4.png"));
	QListWidgetItem *syslog = new QListWidgetItem(syslogIcon, "Log Activity", ui.labelWidget);
	syslog->setSizeHint(QSize(0, 32));
	this->logSettings = new LogSettings;
	ui.stack->addWidget(this->logSettings);

	QIcon generalIcon(QLatin1String(":rc/cog.png"));
	QListWidgetItem *general = new QListWidgetItem(generalIcon, "General", ui.labelWidget);
	general->setSizeHint(QSize(0, 32));
	this->generalSettings = new GeneralSettings(this);
	ui.stack->addWidget(this->generalSettings);

	ui.labelWidget->setCurrentRow(ui.labelWidget->row(account));

	connect(ui.labelWidget, SIGNAL(currentRowChanged(int)),
		ui.stack, SLOT(setCurrentIndex(int)));

	connect(this->ui.exitButton, SIGNAL(clicked()), this, SLOT(slotExit()));

	createTrayIcon();
	setTrayIcon();
	trayIcon->show();	
	
	agent_cfg = (struct agent_cfg*)calloc(1, sizeof(struct agent_cfg));
	agent_cfg->ev.on_log = this->onLog;

	if (agent_config_init(agent_cfg)) {
		jlog(L_ERROR, "agent_config_init failed");
		return;
	}

	if (agent_cfg->auto_connect != 0) {
		emit this->generalSettings->slotCheckAutoConnect();
		emit accountSettings->slotConnWaiting();
		emit this->slotFireConnection();
	}
}
Beispiel #8
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // Qt uses queued connections for signals and slots across threads.
    // Qt can only use data types that it 'knows about' for this.
    // Therefore we must register the map<string, string> type with
    // Qt.  While I'm sure there is a perfectly valid reason for this,
    // It annoys me.  That is all.
    qRegisterMetaType< std::map<std::string, std::string> >("map<string, string>");
    MainWindow w;
    centerWidget(w);
    w.show();
    return a.exec();
}
KeywordMixedSequenceDialog::KeywordMixedSequenceDialog(QWidget *parent)
  : QDialog(parent), keyword(""), columnar(false), mode(true), dump(false)
{
  QLabel *header = new QLabel(tr("Generate the keyword-mixed sequence."));
  QLabel *lblKeyword = new QLabel(tr("Keyword:"));

  txtKeyword = new QLineEdit(keyword);

  chkColumnar = new QCheckBox(tr("Use columnar transposition"));
  chkColumnar->setCheckState(columnar ? Qt::Checked : Qt::Unchecked);

  chkMode = new QCheckBox(tr("Do decipherment"));
  chkMode->setCheckState(mode ? Qt::Checked : Qt::Unchecked);  

  chkDump = new QCheckBox(tr("Dump sequence"));
  chkDump->setCheckState(dump ? Qt::Checked : Qt::Unchecked);  

  QDialogButtonBox *box =
    new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
  connect(box, SIGNAL(accepted()), this, SLOT(onFinished()));
  connect(box, SIGNAL(rejected()), this, SLOT(reject()));

  QHBoxLayout *layoutKeyword = new QHBoxLayout;
  layoutKeyword->addWidget(lblKeyword);
  layoutKeyword->addWidget(txtKeyword);

  QVBoxLayout *layout = new QVBoxLayout;
  layout->addWidget(header);  
  layout->addLayout(layoutKeyword);
  layout->addWidget(chkColumnar);
  layout->addWidget(chkMode);  
  layout->addWidget(chkDump);
  layout->addWidget(box);

  setLayout(layout);

  setWindowTitle(tr("Keyword-mixed Sequence"));
  centerWidget(this);    
}