Example #1
0
MyDialog::MyDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MyDialog)
{
    ui->setupUi(this);

    createMenu();
    createHorizontalGroupBox();
    createGridGroupBox();
    createFormGroupBox();

    bigEditor = new QTextEdit(tr("Big Editor"));
    buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);


    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMenuBar(menuBar);

    mainLayout->addWidget(horizontalGroupBox);
    mainLayout->addWidget(gridGroupBox);
    mainLayout->addWidget(formGroupBox);
    mainLayout->addWidget(bigEditor);
    mainLayout->addWidget(buttonBox);

    setLayout(mainLayout);
    setWindowTitle(tr("Basic Layout"));

}
Example #2
0
//! [0]
Dialog::Dialog()
{
    createMenu();
    createHorizontalGroupBox();
    createGridGroupBox();
    createFormGroupBox();
//! [0]

//! [1]
    bigEditor = new QTextEdit;
    bigEditor->setPlainText(tr("This widget takes up all the remaining space "
                               "in the top-level layout."));

    buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
                                     | QDialogButtonBox::Cancel);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
//! [1]

//! [2]
    QVBoxLayout *mainLayout = new QVBoxLayout;
//! [2] //! [3]
    mainLayout->setMenuBar(menuBar);
//! [3] //! [4]
    mainLayout->addWidget(horizontalGroupBox);
    mainLayout->addWidget(gridGroupBox);
    mainLayout->addWidget(formGroupBox);
    mainLayout->addWidget(bigEditor);
    mainLayout->addWidget(buttonBox);
//! [4] //! [5]
    setLayout(mainLayout);

    setWindowTitle(tr("Basic Layouts"));
}
Example #3
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    createMenu();
    createChooseFilesGroupBox();
    createOptionsGroupBox();
    createSubmitGroupBox();
    createStatusBar();

    readSettings();

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMenuBar(menuBar);
    mainLayout->addWidget(chooseFilesGroupBox);
    mainLayout->addWidget(optionsGroupBox);
    mainLayout->addWidget(submitGroupBox);

    QWidget *widget = new QWidget();
    widget->setLayout(mainLayout);
    setCentralWidget(widget);

    feaProgram = QCoreApplication::applicationDirPath().toStdString() + "/fea_cmd";
    feaTmpConfigFilename = QCoreApplication::applicationDirPath().toStdString() +"/tmp_config.json";
    setMinimumWidth(600);

    setWindowTitle(tr("3D Beam FEA"));
    setWindowIcon(QIcon(":images/logo_64x64.png"));
    setUnifiedTitleAndToolBarOnMac(true);
}
ImageFilterExampleWidget::ImageFilterExampleWidget(QWidget* parent) {
    setWindowTitle(tr("OpenCL Image Filter Examples"));

    setFixedSize(820,500);
    ImageWidget *before = new ImageWidget(this);
    ImageWidget *oclFiltered = new ImageWidget(this);
    beforeW=before;
    afterW=oclFiltered;
    QLabel *beforeLabel = new QLabel(tr("Before"));
    beforeLabel->setAlignment(Qt::AlignHCenter);
    QLabel *afterLabel = new QLabel(tr("Ocl"));
    afterLabel->setAlignment(Qt::AlignHCenter);

    createMenu();

    before->setFixedSize(400,400);
    oclFiltered->setFixedSize(400,400);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);
    mainLayout->addWidget(this->menuBar);
    mainLayout->setMenuBar(this->menuBar);
    QGridLayout *layout = new QGridLayout;
//    layout->addWidget(menubar,0,0);
    layout->addWidget(before, 0, 0);
    layout->addWidget(oclFiltered, 0, 1);
    layout->addWidget(beforeLabel, 1, 0);
    layout->addWidget(afterLabel, 1, 1);
    mainLayout->addLayout(layout);

}
DataDialogWidget::DataDialogWidget(IDataForms *ADataForms, const IDataForm &AForm, QWidget *AParent) : QDialog(AParent)
{
    REPORT_VIEW;
    setAttribute(Qt::WA_DeleteOnClose,true);

    FFormWidget = NULL;
    FAllowInvalid = false;
    FDataForms = ADataForms;

    QToolBar *toolBar = new QToolBar(this);
    FToolBarChanger = new ToolBarChanger(toolBar);

    FFormHolder = new QWidget(this);
    FFormHolder->setLayout(new QVBoxLayout());
    FFormHolder->layout()->setMargin(0);

    QFrame *hline = new QFrame(this);
    hline->setFrameShape(QFrame::HLine);
    hline->setFrameShadow(QFrame::Raised);

    FDialogButtons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel,Qt::Horizontal,this);
    connect(FDialogButtons,SIGNAL(clicked(QAbstractButton *)),SLOT(onDialogButtonClicked(QAbstractButton *)));

    QVBoxLayout *dialogLayout = new QVBoxLayout(this);
    dialogLayout->setMargin(5);
    dialogLayout->setMenuBar(toolBar);
    dialogLayout->addWidget(FFormHolder);
    dialogLayout->addWidget(hline);
    dialogLayout->addWidget(FDialogButtons);

    setForm(AForm);
}
Example #6
0
CWidgetConsol::CWidgetConsol(QWidget *parent) :
    QWidget(parent)
{
    m_header = new CToolBarHeader(tr("Консоль"));

    m_header->insertStretch(m_header->actHint());

    m_actVisible = new QAction(tr("Отображать консоль"),this);
    m_actVisible->setCheckable(true);


    m_edit = new QPlainTextEdit();
    m_edit->setFont(QFont("Courier",12));
    m_edit->setReadOnly(true);
    m_edit->document()->setDocumentMargin(10);
    m_edit->setMaximumBlockCount(1000);

    QVBoxLayout *vbox = new QVBoxLayout();
    vbox->setMargin(0);
    vbox->setSpacing(0);
    this->setLayout(vbox);

    vbox->setMenuBar(m_header);
    vbox->addWidget(m_edit);

    connect(m_header->actHint(),SIGNAL(triggered(bool)),this,SLOT(hide()));
    connect(m_actVisible,SIGNAL(toggled(bool)),this,SLOT(setVisible(bool)));
    connect(m_actVisible,SIGNAL(toggled(bool)),m_actVisible,SLOT(setChecked(bool)));
    connect(m_header->actHint(),SIGNAL(triggered(bool)),m_actVisible,SLOT(setChecked(bool)));
}
Example #7
0
shotGun::shotGun()
{
createMenu();
createBoxes();

QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->setMenuBar(menuBar);
mainLayout->addWidget(shootBox);
mainLayout->addWidget(corruptBox);
setLayout(mainLayout);

setWindowTitle(tr("Shoot files!"));
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
RicGridStatisticsDialog::RicGridStatisticsDialog(QWidget* parent)
    : QDialog(parent, RiuTools::defaultDialogFlags())
{
    m_currentRimView = nullptr;

    // Create widgets
    m_toolBar = new QToolBar();
    m_mainViewWidget = new QFrame();
    m_label = new QLabel();
    m_textEdit = new QTextEdit();
    m_historgramPlot = new QwtPlot();
    m_aggregatedPlot = new QwtPlot();
    m_buttons = new QDialogButtonBox(QDialogButtonBox::Close);

    // Connect to close button signal
    connect(m_buttons, SIGNAL(rejected()), this, SLOT(slotDialogFinished()));

    // Set widget properties
    m_textEdit->setReadOnly(true);
    RiuQwtPlotTools::setCommonPlotBehaviour(m_historgramPlot);
    RiuQwtPlotTools::setCommonPlotBehaviour(m_aggregatedPlot);

    // Define layout
    QVBoxLayout* dialogLayout = new QVBoxLayout();
    dialogLayout->addWidget(m_mainViewWidget);

    QVBoxLayout* mainViewLayout = new QVBoxLayout();
    mainViewLayout->setMargin(0);
    m_mainViewWidget->setLayout(mainViewLayout);
    mainViewLayout->addWidget(m_label);
    mainViewLayout->addWidget(m_textEdit);

    QVBoxLayout* plotLayout = new QVBoxLayout();
    plotLayout->setSpacing(0);
    plotLayout->addWidget(m_historgramPlot);
    plotLayout->addWidget(m_aggregatedPlot);
    mainViewLayout->addLayout(plotLayout);

    dialogLayout->addWidget(m_buttons);

    setLayout(dialogLayout);

    // Toolbar
    dialogLayout->setMenuBar(m_toolBar);
    createAndConnectToolbarActions();
}
VentanaPrincipal::VentanaPrincipal()
{
    crearControl();

    cargarImagenes();
    crearMenu();
    crearPanelTitulo();
    crearTablero();
    crearPanelPie();

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMenuBar(menuBar);
    mainLayout->addWidget(horizontalGroupBox);
    mainLayout->addWidget(gridGroupBox);
    mainLayout->addWidget(horizontalGroupBox2);
    setLayout(mainLayout);

    setWindowTitle(tr("Parejas"));
}
Example #10
0
TeamStats::TeamStats(QString eventName)
{
    qDebug() << "Creating Team Stats";

    EventName = eventName;

    CreateTeamStatsGroupBox();
    CreateMenu();
    LoadTeamData();

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMenuBar(menuBar);
    mainLayout->addWidget(TeamStatsGroupBox);
    mainLayout->addWidget(Done);

    setLayout(mainLayout);

    setWindowTitle(tr("Add Teams"));

    qDebug() << "Team Stats Created";
}
Example #11
0
Window::Window(Controller * c, QWidget *parent)
    : QWidget(parent), IView(c)
{
    int width = controller->getWidth();
    int height = controller->getHeight();

    trace_run = false;

    menu = new QMenuBar(this);
    createMenu();

    area = new ImageArea(controller, this);
    connect(area, SIGNAL(pixelPainted()), this, SLOT(incProgress()));
    connect(area, SIGNAL(finish()), this, SLOT(finish()));

    pr_bar = new QProgressBar(this);
    pr_bar->setRange(0, width*height);
    pr_bar->setValue(0);
    pr_bar->setDisabled(true);

    render_button = new QPushButton(tr("&Render"), this);
    render_button->setDefault(true);
    connect(render_button, SIGNAL(clicked()), this, SLOT(render()));

    QHBoxLayout * hlayot = new QHBoxLayout;
    hlayot->setMargin(5);
    hlayot->addWidget(pr_bar);
    hlayot->addWidget(render_button);

    QVBoxLayout * vlayout = new QVBoxLayout(this);
    vlayout->setMargin(0);
    vlayout->setSpacing(0);
    vlayout->setSizeConstraint(QLayout::SetFixedSize);
    vlayout->setMenuBar(menu);
    vlayout->addWidget(area);
    vlayout->addLayout(hlayot);

    setWindowTitle(tr("Ray Tracer"));
}
Example #12
0
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{
    // Create a menu
    QPopupMenu *file = new QPopupMenu( this );
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );

    // Create a nice frame to put around the OpenGL widget
    QFrame* f = new QFrame( this, "frame" );
    f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f->setLineWidth( 2 );

    // Create our OpenGL widget.
    GLTeapots* c = new GLTeapots( f, "glteapots" );

    // Check if we obtained an overlay
    if ( !c->format().hasOverlay() ) {
	QMessageBox::warning( 0, qApp->argv()[0], 
			      "Failed to get an OpenGL overlay",
			      "Ok" );
    }

    // Now that we have all the widgets, put them into a nice layout

    // Put the GL widget inside the frame
    QHBoxLayout* flayout = new QHBoxLayout( f, 2, 2, "flayout");
    flayout->addWidget( c, 1 );

    // Top level layout
    QVBoxLayout* hlayout = new QVBoxLayout( this, 20, 20, "hlayout");
    hlayout->setMenuBar( m );
    hlayout->addWidget( f, 1 );
}
Example #13
0
MainWidget::MainWidget(QWidget *parent)
	: QWidget(parent)
{


//	building menu
	auto menu = new QMenuBar(this);

	openAction = new QAction(QIcon(":/image/doc-open"), tr("打开文件"), menu);
	openAction->setShortcuts(QKeySequence::Open);

	saveAction = new QAction(QIcon(":/image/doc-save"), tr("保存初始文件"), menu);
	saveAction->setShortcut(QKeySequence::Save);

	saveAction2 = new QAction(QIcon(":/image/doc-save"), tr("保存检修后文件"), menu);

	saveGantt = new QAction(QIcon(":/image/doc-save"), tr("保存初始甘特图"), menu);
	saveGantt2 = new QAction(QIcon(":/image/doc-save"), tr("保存检修后甘特图"), menu);

	auto menu_file = menu->addMenu(tr("文件(&F)"));
	menu_file->addAction(openAction);
	menu_file->addAction(saveAction);
	menu_file->addAction(saveAction2);
	connect(openAction, &QAction::triggered, this, &MainWidget::openFile);
	connect(saveAction, &QAction::triggered, this, &MainWidget::saveFile);
	connect(saveAction2, &QAction::triggered, this, &MainWidget::saveFile2);


	auto menu_file2 = menu->addMenu(tr("图片(&P)"));
	menu_file2->addAction(saveGantt);
	menu_file2->addAction(saveGantt2);
	connect(saveGantt, &QAction::triggered, this, &MainWidget::_saveGantt);
	connect(saveGantt2, &QAction::triggered, this, &MainWidget::_saveGantt2);

//	builiding the input text
	inputText = new QTextEdit(this);
	confirm_btn = new QPushButton(tr("提交任务"), this);
	confirm_btn->setFixedWidth(120);
	connect(confirm_btn, &QPushButton::clicked, this, &MainWidget::runSolution);


//	building the first gantt chart
	firstGantt = new FirstGantt(this);
	max1 = new FirstGantt();
	currentTime = new QLabel(tr("End Time: "), this);

	qsrand(QTime(0,0,0).msecsTo(QTime::currentTime()));
	for(int i=1;i<=34;i++)
	{
        color[i]=Color(qrand()%200 + 28,qrand()%200 + 28,qrand()%200 + 28);
	}
	color[0] = Color(0, 0, 0);
	QPushButton *maxFirst = new QPushButton(tr("最大化"), this);
	maxFirst->setFixedWidth(120);
	connect(maxFirst, &QPushButton::clicked, this, &MainWidget::maximizeFirstGantt);


//	building the second gantt chart
	timer = new QTimer(this);
	secondGantt = new SecondGantt(this);
	start_repair = new QPushButton(tr("启动模拟"), this);
	connect(start_repair, &QPushButton::clicked, this, &beginTime);
	connect(timer, &QTimer::timeout, this, &loopTime);
	start_repair->setFixedWidth(120);
	submit_repair = new QPushButton(tr("提交检修"), this);
	connect(submit_repair, &QPushButton::clicked, this, &readjustTime);
	currentTime2 = new QLabel(tr("当前时间 :"), this);


//	building the output text
	outputText = new QTextEdit(this);


//	combine layout
	QVBoxLayout *v = new QVBoxLayout(this);
	QHBoxLayout *h1 = new QHBoxLayout(this);
	QVBoxLayout *h1_1_v = new QVBoxLayout(this);
	QHBoxLayout *h1_1_v1_h = new QHBoxLayout(this);
	QVBoxLayout *h1_2_v = new QVBoxLayout(this);
	QHBoxLayout *h2 = new QHBoxLayout(this);
	QVBoxLayout *h2_1_v = new QVBoxLayout(this);
	QHBoxLayout *h2_1_v1_h = new QHBoxLayout(this);
	QVBoxLayout *h2_2_v = new QVBoxLayout(this);
	QHBoxLayout *h2_2_v2_h = new QHBoxLayout(this);

	h1_1_v1_h->addWidget(currentTime, 0, Qt::AlignLeft);
	h1_1_v1_h->addWidget(maxFirst, 0, Qt::AlignRight);

	h1_1_v->addLayout(h1_1_v1_h);
	h1_1_v->addWidget(firstGantt, 1);

	h1->addLayout(h1_1_v, 15);
	h1->setMargin(20);
	h1->addStretch(1);
	h1_2_v->addWidget(inputText);
	h1_2_v->addWidget(confirm_btn, 0, Qt::AlignCenter);
	h1->addLayout(h1_2_v, 10);

	h2_1_v1_h->addWidget(currentTime2, 0, Qt::AlignLeft);
	h2_1_v->addLayout(h2_1_v1_h);
	h2_1_v->addWidget(secondGantt, 1);
	h2->addLayout(h2_1_v, 15);
	h2->setMargin(20);
	h2_2_v->addWidget(outputText, 1);

	h2_2_v2_h->addWidget(start_repair, 0, Qt::AlignCenter);
	h2_2_v2_h->addWidget(submit_repair, 0, Qt::AlignCenter);
	h2_2_v->addLayout(h2_2_v2_h);

	h2->addStretch(1);
	h2->addLayout(h2_2_v, 10);

	v->setMenuBar(menu);
	v->addLayout(h1, 1);
	v->addLayout(h2, 1);
	setLayout(v);

	setWindowTitle(tr("车间调度"));
	setWindowIcon(QIcon(":/image/icon"));
	resize(1600, 900);
}
Example #14
0
/****** Main menu constructor ******/
main_menu::main_menu(QWidget *parent) : QWidget(parent)
{
	//Setup actions
	QAction* open = new QAction("Open", this);
	QAction* quit = new QAction ("Quit", this);

	QAction* pause = new QAction("Pause", this);
	QAction* reset = new QAction("Reset", this);
	QAction* fullscreen = new QAction("Fullscreen", this);
	QAction* screenshot = new QAction("Screenshot", this);
	QAction* nplay_start = new QAction("Start Netplay", this);
	QAction* nplay_stop = new QAction("Stop Netplay", this);

	QAction* general = new QAction("General Settings...", this);
	QAction* display = new QAction("Display", this);
	QAction* sound = new QAction("Sound", this);
	QAction* controls = new QAction("Controls", this);
	QAction* netplay = new QAction("Netplay", this);
	QAction* paths = new QAction("Paths", this);

	QAction* custom_gfx = new QAction("Custom Graphics...", this);
	QAction* debugging = new QAction("Debugger", this);

	QAction* about = new QAction("About", this);

	//Set shortcuts for actions
	open->setShortcut(tr("CTRL+O"));
	quit->setShortcut(tr("CTRL+Q"));

	pause->setShortcut(tr("CTRL+P"));
	reset->setShortcut(tr("F8"));
	fullscreen->setShortcut(tr("F12"));
	screenshot->setShortcut(tr("F9"));
	nplay_start->setShortcut(tr("F5"));
	nplay_stop->setShortcut(tr("F6"));

	pause->setCheckable(true);
	pause->setObjectName("pause_action");
	fullscreen->setCheckable(true);
	fullscreen->setObjectName("fullscreen_action");

	menu_bar = new QMenuBar(this);

	//Setup File menu
	QMenu* file;

	file = new QMenu(tr("File"), this);
	file->addAction(open);
	recent_list = file->addMenu(tr("Recent Files"));
	file->addSeparator();
	state_save_list = file->addMenu(tr("Save State"));
	state_load_list = file->addMenu(tr("Load State"));
	file->addSeparator();
	file->addAction(quit);
	menu_bar->addMenu(file);

	//Setup Emulation menu
	QMenu* emulation;

	emulation = new QMenu(tr("Emulation"), this);
	emulation->addAction(pause);
	emulation->addAction(reset);
	emulation->addSeparator();
	emulation->addAction(fullscreen);
	emulation->addAction(screenshot);
	emulation->addSeparator();
	emulation->addAction(nplay_start);
	emulation->addAction(nplay_stop);
	menu_bar->addMenu(emulation);

	//Setup Options menu
	QMenu* options;
	
	options = new QMenu(tr("Options"), this);
	options->addAction(general);
	options->addSeparator();
	options->addAction(display);
	options->addAction(sound);
	options->addAction(controls);
	options->addAction(netplay);
	options->addAction(paths);
	menu_bar->addMenu(options);

	//Advanced menu
	QMenu* advanced;

	advanced = new QMenu(tr("Advanced"), this);
	advanced->addAction(custom_gfx);
	advanced->addAction(debugging);
	menu_bar->addMenu(advanced);

	//Setup Help menu
	QMenu* help;

	help = new QMenu(tr("Help"), this);
	help->addAction(about);
	menu_bar->addMenu(help);

	//Setup signals
	connect(quit, SIGNAL(triggered()), this, SLOT(quit()));
	connect(open, SIGNAL(triggered()), this, SLOT(open_file()));
	connect(pause, SIGNAL(triggered()), this, SLOT(pause()));
	connect(fullscreen, SIGNAL(triggered()), this, SLOT(fullscreen()));
	connect(screenshot, SIGNAL(triggered()), this, SLOT(screenshot()));
	connect(nplay_start, SIGNAL(triggered()), this, SLOT(start_netplay()));
	connect(nplay_stop, SIGNAL(triggered()), this, SLOT(stop_netplay()));
	connect(reset, SIGNAL(triggered()), this, SLOT(reset()));
	connect(general, SIGNAL(triggered()), this, SLOT(show_settings()));
	connect(display, SIGNAL(triggered()), this, SLOT(show_display_settings()));
	connect(sound, SIGNAL(triggered()), this, SLOT(show_sound_settings()));
	connect(controls, SIGNAL(triggered()), this, SLOT(show_control_settings()));
	connect(netplay, SIGNAL(triggered()), this, SLOT(show_netplay_settings()));
	connect(paths, SIGNAL(triggered()), this, SLOT(show_paths_settings()));
	connect(custom_gfx, SIGNAL(triggered()), this, SLOT(show_cgfx()));
	connect(debugging, SIGNAL(triggered()), this, SLOT(show_debugger()));
	connect(about, SIGNAL(triggered()), this, SLOT(show_about()));

	sw_screen = new soft_screen();
	hw_screen = new hard_screen();

	QVBoxLayout* layout = new QVBoxLayout;
	layout->setContentsMargins(0, 0, 0, -1);
	layout->addWidget(sw_screen);
	layout->addWidget(hw_screen);
	layout->setMenuBar(menu_bar);
	setLayout(layout);

	config::scaling_factor = 2;

	hw_screen->hide();
	hw_screen->setEnabled(false);

	//Parse .ini options
	parse_ini_file();

	//Parse cheats file
	if(config::use_cheats) { parse_cheats_file(); }

	//Parse command-line arguments
	//These will override .ini options!
	if(!parse_cli_args()) { exit(0); }

	//Some command-line arguments are invalid for the Qt version
	config::use_debugger = false;

	//Setup Recent Files
	list_mapper = new QSignalMapper(this);

	for(int x = (config::recent_files.size() - 1); x >= 0; x--)
	{
		QString path = QString::fromStdString(config::recent_files[x]);
		QFileInfo file(path);
		path = file.fileName();

		QAction* temp = new QAction(path, this);
		recent_list->addAction(temp);

		connect(temp, SIGNAL(triggered()), list_mapper, SLOT(map()));
		list_mapper->setMapping(temp, x);
	}

	connect(list_mapper, SIGNAL(mapped(int)), this, SLOT(load_recent(int)));

	//Setup Save States
	QSignalMapper* save_mapper = new QSignalMapper(this);

	for(int x = 0; x < 10; x++)
	{
		QAction* temp;

		if(x == 0) 
		{
			temp = new QAction(tr("Quick Save"), this);
			temp->setShortcut(tr("F1"));
		}
		
		else
		{
			std::string slot_id = "Slot " + util::to_str(x);
			QString slot_name = QString::fromStdString(slot_id);
			temp = new QAction(slot_name, this);
		}

		state_save_list->addAction(temp);

		connect(temp, SIGNAL(triggered()), save_mapper, SLOT(map()));
		save_mapper->setMapping(temp, x);
	}

	connect(save_mapper, SIGNAL(mapped(int)), this, SLOT(save_state(int)));

	//Setup Load States
	QSignalMapper* load_mapper = new QSignalMapper(this);

	for(int x = 0; x < 10; x++)
	{
		QAction* temp;

		if(x == 0)
		{
			temp = new QAction(tr("Quick Load"), this);
			temp->setShortcut(tr("F2"));
		}
		
		else
		{
			std::string slot_id = "Slot " + util::to_str(x);
			QString slot_name = QString::fromStdString(slot_id);
			temp = new QAction(slot_name, this);
		}

		state_load_list->addAction(temp);

		connect(temp, SIGNAL(triggered()), load_mapper, SLOT(map()));
		load_mapper->setMapping(temp, x);
	}

	connect(load_mapper, SIGNAL(mapped(int)), this, SLOT(load_state(int)));

	//Set up settings dialog
	settings = new gen_settings();
	settings->set_ini_options();

	//Set up custom graphics dialog
	cgfx = new gbe_cgfx();
	cgfx->hide();
	cgfx->advanced->setChecked(true);

	//Set up DMG-GBC debugger
	main_menu::dmg_debugger = new dmg_debug();
	main_menu::dmg_debugger->hide();

	//Setup About pop-up
	about_box = new QWidget();
	about_box->resize(300, 250);
	about_box->setWindowTitle("About GBE+");

	QDialogButtonBox* about_button = new QDialogButtonBox(QDialogButtonBox::Close);
	connect(about_button->button(QDialogButtonBox::Close), SIGNAL(clicked()), about_box, SLOT(close()));

	QLabel* emu_title = new QLabel("GBE+ 1.0");
	QFont font = emu_title->font();
	font.setPointSize(18);
	font.setBold(true);
	emu_title->setFont(font);

	QImage logo(QString::fromStdString(config::cfg_path + "data/icons/gbe_plus.png"));
	logo = logo.scaled(128, 128);
	QLabel* emu_desc = new QLabel("A GB/GBC/GBA emulator with enhancements");
	QLabel* emu_copyright = new QLabel("Copyright D.S. Baxter 2014-2016");
	QLabel* emu_proj_copyright = new QLabel("Copyright GBE+ Team 2014-2016");
	QLabel* emu_license = new QLabel("This program is licensed under the GNU GPLv2");
	QLabel* emu_site = new QLabel("<a href=\"https://github.com/shonumi/gbe-plus/\">GBE+ on GitHub</a>");
	emu_site->setOpenExternalLinks(true);
	QLabel* emu_logo = new QLabel;
	emu_logo->setPixmap(QPixmap::fromImage(logo));

	QVBoxLayout* about_layout = new QVBoxLayout;
	about_layout->addWidget(emu_title, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_desc, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_copyright, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_proj_copyright, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_license, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_site, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(emu_logo, 0, Qt::AlignCenter | Qt::AlignTop);
	about_layout->addWidget(about_button);
	about_box->setLayout(about_layout);
	about_box->setWindowIcon(QIcon(QString::fromStdString(config::cfg_path + "data/icons/gbe_plus.png")));
	
	about_box->hide();

	//Setup warning message box
	warning_box = new QMessageBox;
	QPushButton* warning_box_ok = warning_box->addButton("OK", QMessageBox::AcceptRole);
	warning_box->setIcon(QMessageBox::Warning);
	warning_box->hide();

	display_width = QApplication::desktop()->screenGeometry().width();
	display_height = QApplication::desktop()->screenGeometry().height();

	fullscreen_mode = false;
}
//COSTRUTTORE
videoplayer::videoplayer(QWidget *parent)
{
	stoptick = false;

	signalMapper = new QSignalMapper(this);

	createMenu();	

    //includendo gli oggetti menu, bottoni e frame video in QVBoxLayout che li ordina verticalmente
    QVBoxLayout *mainLayout = new QVBoxLayout;

    mainLayout->setMenuBar(menuBar);

    // creo il display LDC e la barra di scorrimento video

    // LCD
    QPalette palette;
    palette.setBrush(QPalette::Light, Qt::darkGray);

	//timerLCD = new QTimer(this);
    panelLCD = new QLCDNumber;
    panelLCD->setPalette(palette);

    //------------------------------------------------------------------
    //qui devo gestire l'lcd con il video
	//impongo che ogni secondo venga refreshato il pannello
	//connect(timerLCD, &QTimer::timeout, this, &videoplayer::tick);
    //-------------------------------------------------------------------

    //Barra di scorrimento
    positionSlider = new QSlider(Qt::Horizontal);

    //Inglobo la barra e LCD in un contenitore che li mette io orizzontale
    QHBoxLayout *seekerLayout = new QHBoxLayout;
    seekerLayout->addWidget(positionSlider);
    seekerLayout->addWidget(panelLCD);
    //aggiungo il contenitore alla finestra principale
    mainLayout->addLayout(seekerLayout);

    //Ora mi occupo dei pulsati
    playAction = new QAction(style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this);
    playAction->setShortcut(tr("Ctrl+P"));
    playAction->setDisabled(true);
    pauseAction = new QAction(style()->standardIcon(QStyle::SP_MediaPause), tr("Pause"), this);
    pauseAction->setShortcut(tr("Ctrl+A"));
    pauseAction->setDisabled(true);
    stopAction = new QAction(style()->standardIcon(QStyle::SP_MediaStop), tr("Stop"), this);
    stopAction->setShortcut(tr("Ctrl+S"));
    stopAction->setDisabled(true);
	skipforwardAction = new QAction(style()->standardIcon(QStyle::SP_MediaSkipForward), tr("SkipForward"), this);
    skipforwardAction->setShortcut(tr("Ctrl+S+F"));
    skipforwardAction->setDisabled(true);
	skipbackwardAction = new QAction(style()->standardIcon(QStyle::SP_MediaSkipBackward), tr("SkipBackward"), this);
    skipbackwardAction->setShortcut(tr("Ctrl+S+B"));
    skipbackwardAction->setDisabled(true);
	seekforwardAction = new QAction(style()->standardIcon(QStyle::SP_MediaSeekForward), tr("SeekForward"), this);
    seekforwardAction->setShortcut(tr("Ctrl+F"));
    seekforwardAction->setDisabled(true);
	seekbackwardAction = new QAction(style()->standardIcon(QStyle::SP_MediaSeekBackward), tr("SeekBackward"), this);
    seekbackwardAction->setShortcut(tr("Ctrl+B"));
    seekbackwardAction->setDisabled(true);

	histoAction = new QAction(QIcon(":/images/histogram2.png"), tr("histo"), this);
	logAction = new QAction(QIcon(":/images/log.png"), tr("log"), this);

	histoAction->setDisabled(true);
	logAction->setDisabled(true);


	//event listener dei pulsanti
	connect(playAction, &QAction::triggered, this, &videoplayer::resume);
	connect(this, &videoplayer::first_play, this, &videoplayer::playing);
	connect(pauseAction, &QAction::triggered, this, &videoplayer::pause);
	connect(histoAction, &QAction::triggered, this, &videoplayer::histoClicked);
	connect(logAction, &QAction::triggered, this, &videoplayer::openDialog);

	/**
	utilizzo di un signalMapper per collegare l'evento di pressione dei pulsanti SEEK,
	con un particolare valore che verra inviato allo SLOT seek
	*/
	signalMapper->setMapping(seekforwardAction, 10);
	signalMapper->setMapping(seekbackwardAction, -10);
	signalMapper->setMapping(skipbackwardAction, -60);
	signalMapper->setMapping(skipforwardAction, 60);

	connect(skipforwardAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
	connect(seekforwardAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
	connect(skipbackwardAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
	connect(seekbackwardAction, SIGNAL(triggered()), signalMapper, SLOT(map()));

	connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(seek(int)));

    QToolBar *bar = new QToolBar;
    bar->addAction(playAction);
    bar->addAction(pauseAction);
    bar->addAction(stopAction);
	bar->addAction(skipbackwardAction);
	bar->addAction(seekbackwardAction);
	bar->addAction(seekforwardAction);
	bar->addAction(skipforwardAction);
	bar->addAction(histoAction);
	bar->addAction(logAction);

    QLabel *volumeLabel = new QLabel;
    volumeLabel->setPixmap(QPixmap(":/images/volume.png"));

    volumeSlider = new QSlider(Qt::Horizontal);
    volumeSlider->setRange(0,100);
    volumeSlider->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);

    //aggiungo i bottoni alla finestra principale
    QHBoxLayout *controlButton = new QHBoxLayout;
    controlButton->addWidget(bar);
    controlButton->addStretch();
    //controlButton->addWidget(volumeLabel);
    //controlButton->addWidget(volumeSlider);
    //controlButton->addSpacing(0);// questa serve per spostare il volume a destra e di quanto dal bordo
    mainLayout->addLayout(controlButton);


    setLayout(mainLayout);

    // setto il titolo del finestra
    setWindowTitle(tr("VideoPlayer"));

    setFixedSize(400,100);

	_clock = new AVClock();										//inizializzazione del clock

	//connect sullo SLIDER
	connect(_clock, &AVClock::needupdate, this, &videoplayer::tick);
	connect(positionSlider, &QSlider::sliderReleased, this, &videoplayer::slider_seek);
	connect(positionSlider, &QSlider::sliderPressed, this, &videoplayer::stop_tick);
}