Ejemplo n.º 1
0
void MainWindow::actionScale()
{
	ui.glCanvas->setScale(scale());
	actionResolution();
}
Ejemplo n.º 2
0
void MainWindow::setupUiActions(){
    ui.setupUi(this);

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

    connect(ui.actionFull_Screen,   SIGNAL(triggered(bool)), this, SLOT(actionFull_Screen(bool)));
    connect(ui.actionHide_Menu,     SIGNAL(triggered()), this, SLOT(actionHide_Menu()));
    connect(ui.actionAlways_on_Top, SIGNAL(triggered(bool)), this, SLOT(actionAlwaysOnTop(bool)));

    connect(ui.actionQuarter,       SIGNAL(triggered()), this, SLOT(actionScale()));
    connect(ui.actionHalf,          SIGNAL(triggered()), this, SLOT(actionScale()));
    connect(ui.actionOriginal,      SIGNAL(triggered()), this, SLOT(actionScale()));
    connect(ui.actionDouble,        SIGNAL(triggered()), this, SLOT(actionScale()));
    connect(ui.actionTriple,        SIGNAL(triggered()), this, SLOT(actionScale()));
    connect(ui.actionZoom_In,       SIGNAL(triggered()), this, SLOT(actionScale()));
    connect(ui.actionZoom_Out,      SIGNAL(triggered()), this, SLOT(actionScale()));
    connect(ui.actionFit_To_Window, SIGNAL(triggered()), this, SLOT(actionScale()));

    connect(ui.actionFit_To_App, SIGNAL(triggered()), this, SLOT(actionFitWindow()));

    connect(ui.actionDraw_Infos, SIGNAL(triggered(bool)), this, SLOT(actionDraw_Infos(bool)));

    connect(ui.actionAuto_Scale, SIGNAL(triggered(bool)), this, SLOT(actionAuto_Scale(bool)));

    connect(ui.actionRotate_Left,  SIGNAL(triggered()), this, SLOT(actionRotate()));
    connect(ui.actionRotate_Right, SIGNAL(triggered()), this, SLOT(actionRotate()));

    connect(ui.actionPortrait,             SIGNAL(triggered()), this, SLOT(actionOrientation()));
    connect(ui.actionPortrait_Upside_Down, SIGNAL(triggered()), this, SLOT(actionOrientation()));
    connect(ui.actionLandscape_Left,       SIGNAL(triggered()), this, SLOT(actionOrientation()));
    connect(ui.actionLandscape_Right,      SIGNAL(triggered()), this, SLOT(actionOrientation()));

    connect(ui.action320x480,   SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action768x1024,  SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action640x960,   SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action1536x2048, SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action320x568,   SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action640x1136,  SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action480x800,   SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action240x320,   SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action540x960,   SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action480x854,   SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action240x400,   SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action360x640,   SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action800x1280,  SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action600x1024,  SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action600x800,   SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action768x1366,  SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action720x1280,  SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action1080x1920, SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action750x1334,  SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action1242x2208, SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action900x1200,  SIGNAL(triggered()), this, SLOT(actionResolution()));

    connect(ui.action15_fps,    SIGNAL(triggered()), this, SLOT(actionFps()));
    connect(ui.action30_fps,    SIGNAL(triggered()), this, SLOT(actionFps()));
    connect(ui.action60_fps,    SIGNAL(triggered()), this, SLOT(actionFps()));
    connect(ui.actionUnlimited, SIGNAL(triggered()), this, SLOT(actionFps()));

    connect(ui.actionSettings, SIGNAL(triggered()), this, SLOT(actionSettings()));

    connect(ui.glCanvas, SIGNAL(projectNameChanged(const QString&)), this, SLOT(projectNameChanged(const QString&)));
}
Ejemplo n.º 3
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
	ui.setupUi(this);

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

	connect(ui.actionRun, SIGNAL(triggered()), this, SLOT(sendRun()));

	connect(ui.actionRotate_Left, SIGNAL(triggered()), this, SLOT(rotateLeft()));
	connect(ui.actionRotate_Right, SIGNAL(triggered()), this, SLOT(rotateRight()));
	connect(ui.actionPortrait, SIGNAL(triggered()), this, SLOT(portrait()));
	connect(ui.actionPortrait_Upside_Down, SIGNAL(triggered()), this, SLOT(portraitUpsideDown()));
	connect(ui.actionLandscape_Left, SIGNAL(triggered()), this, SLOT(landscapeLeft()));
	connect(ui.actionLandscape_Right, SIGNAL(triggered()), this, SLOT(landscapeRight()));

	connect(ui.action15_fps, SIGNAL(triggered()), this, SLOT(action15_fps()));
	connect(ui.action30_fps, SIGNAL(triggered()), this, SLOT(action30_fps()));
	connect(ui.action60_fps, SIGNAL(triggered()), this, SLOT(action60_fps()));
	connect(ui.actionUnlimited, SIGNAL(triggered()), this, SLOT(actionUnlimited()));

	connect(ui.action320x480, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action768x1024, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action640x960, SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action1536x2048, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action320x568, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action640x1136, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action480x800, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action240x320, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action540x960, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action480x854, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action240x400, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action360x640, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action800x1280, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action600x1024, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action600x800, SIGNAL(triggered()), this, SLOT(actionResolution()));
	connect(ui.action768x1366, SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action720x1280, SIGNAL(triggered()), this, SLOT(actionResolution()));
    connect(ui.action1080x1920, SIGNAL(triggered()), this, SLOT(actionResolution()));


    connect(ui.actionQuarter, SIGNAL(triggered()), this, SLOT(actionScale()));
	connect(ui.actionHalf, SIGNAL(triggered()), this, SLOT(actionScale()));
	connect(ui.actionOriginal, SIGNAL(triggered()), this, SLOT(actionScale()));

	orientationGroup_ = new QActionGroup(this);
	orientationGroup_->addAction(ui.actionPortrait);
	orientationGroup_->addAction(ui.actionPortrait_Upside_Down);
	orientationGroup_->addAction(ui.actionLandscape_Left);
	orientationGroup_->addAction(ui.actionLandscape_Right);

	resolutionGroup_ = new QActionGroup(this);
	resolutionGroup_->addAction(ui.action320x480);
	resolutionGroup_->addAction(ui.action768x1024);
	resolutionGroup_->addAction(ui.action640x960);
    resolutionGroup_->addAction(ui.action1536x2048);
	resolutionGroup_->addAction(ui.action320x568);
	resolutionGroup_->addAction(ui.action640x1136);
	resolutionGroup_->addAction(ui.action480x800);
	resolutionGroup_->addAction(ui.action240x320);
	resolutionGroup_->addAction(ui.action540x960);
	resolutionGroup_->addAction(ui.action480x854);
	resolutionGroup_->addAction(ui.action240x400);
	resolutionGroup_->addAction(ui.action360x640);
	resolutionGroup_->addAction(ui.action800x1280);
	resolutionGroup_->addAction(ui.action600x1024);
	resolutionGroup_->addAction(ui.action600x800);
	resolutionGroup_->addAction(ui.action768x1366);
    resolutionGroup_->addAction(ui.action720x1280);
    resolutionGroup_->addAction(ui.action1080x1920);

	zoomGroup_ = new QActionGroup(this);
    zoomGroup_->addAction(ui.actionQuarter);
	zoomGroup_->addAction(ui.actionHalf);
	zoomGroup_->addAction(ui.actionOriginal);

	connect(ui.actionAlways_on_Top, SIGNAL(triggered(bool)), this, SLOT(alwaysOnTop(bool)));

	QSettings settings;

	QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
	QSize size = settings.value("size", QSize(1, 1)).toSize();
	resize(size);
	move(pos);

	bool alwaysOnTop = settings.value("alwaysOnTop").toBool();
	if (alwaysOnTop)
	{
		setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
		show();
	}

	ui.actionAlways_on_Top->setChecked(alwaysOnTop);

	QTimer::singleShot(0, this, SLOT(afterInitialization()));

	int resolution = settings.value("resolution", 320).toInt();
	switch (resolution)
	{
	case 320:
		ui.action320x480->setChecked(true);
		break;
	case 768:
		ui.action768x1024->setChecked(true);
		break;
	case 640:
		ui.action640x960->setChecked(true);
		break;
    case 1536:
        ui.action1536x2048->setChecked(true);
        break;
    case 320+1:
        ui.action320x568->setChecked(true);
        break;
    case 640+1:
        ui.action640x1136->setChecked(true);
        break;
	case 480:
		ui.action480x800->setChecked(true);
		break;
	case 240:
		ui.action240x320->setChecked(true);
		break;
	case 540:
		ui.action540x960->setChecked(true);
		break;
	case 480+1:
		ui.action480x854->setChecked(true);
		break;
	case 240+1:
		ui.action240x400->setChecked(true);
		break;
	case 360:
		ui.action360x640->setChecked(true);
		break;
	case 800:
		ui.action800x1280->setChecked(true);
		break;
	case 600:
		ui.action600x1024->setChecked(true);
		break;
	case 600+1:
		ui.action600x800->setChecked(true);
		break;
	case 768+1:
		ui.action768x1366->setChecked(true);
		break;
    case 720:
        ui.action720x1280->setChecked(true);
        break;
    case 1080:
        ui.action1080x1920->setChecked(true);
        break;
    }

    switch (settings.value("scale", 1).toInt())
    {
    case 1:
        ui.actionOriginal->setChecked(true);
        break;
    case 2:
        ui.actionHalf->setChecked(true);
        break;
    case 4:
        ui.actionQuarter->setChecked(true);
        break;
    }

	ui.glCanvas->setScale(scale());
	ui.glCanvas->setFixedSize(hardwareWidth()/scale(), hardwareHeight()/scale());
	ui.glCanvas->setResolution(hardwareWidth(), hardwareHeight());

	Orientation orientation = static_cast<Orientation>(settings.value("orientation", ePortrait).toInt());
	switch (orientation)
	{
	case ePortrait:
		portrait();
		ui.actionPortrait->setChecked(true);
		break;
	case eLandscapeLeft:
		landscapeLeft();
		ui.actionLandscape_Left->setChecked(true);
		break;
	case ePortraitUpsideDown:
		portraitUpsideDown();
		ui.actionPortrait_Upside_Down->setChecked(true);
		break;
	case eLandscapeRight:
		landscapeRight();
		ui.actionLandscape_Right->setChecked(true);
		break;
	}

	int fps = settings.value("fps2", 60).toInt();
	if (fps == 15)
		action15_fps();
	else if (fps == 30)
		action30_fps();
	else if (fps == 60)
		action60_fps();
	else
		actionUnlimited();

	connect(ui.glCanvas, SIGNAL(projectNameChanged(const QString&)), this, SLOT(projectNameChanged(const QString&)));
}