//slots
void manager_menu::on_show_humans_button_clicked()
{
    QString qtext("SELECT first_name as \"Ім’я\",last_name as \"Фамілія\",patronymic as \"По-батькові\",tel_num as \"Номер телефона\",passport as \"Номер паспорта\",code as \"Ідентифікаційний код\" FROM people_workers");
    QSqlQuery query(qtext);
    QSqlQueryModel* model = new QSqlQueryModel();
    model->setQuery(query);
    emit open_main_window(model);
    this->hide();
}
void manager_menu::on_show_personel_button_clicked()
{
    QString qtext("SELECT first_name||' '||last_name||' '||patronymic||' - '||passport as \"Людина\", position_name as \"Назва посади\", incentive as \"Надбавка\", p.start_date as \"Дата початку роботи\", p.end_date as \"Дата закінчення роботи\" FROM personnel p join administrating_positions ap on p.id_administrating_position=ap.id_administrating_position join people_workers pw on p.id_human=pw.id_human join positions pos on ap.id_position=pos.id_position order by position_name asc,p.start_date desc");
    QSqlQuery query(qtext);
    QSqlQueryModel* model = new QSqlQueryModel();
    model->setQuery(query);
    emit open_main_window(model);
    this->hide();
}
void manager_menu::on_show_administrating_positions_button_clicked()
{
    QString qtext("SELECT position_name as \"Назва посади\",salary as \"Зарплата\",position_quantity as \"Кількість місць\",start_date as \"Дата початку\",end_date as \"Дата закінчення\" FROM administrating_positions a join positions p on a.id_position=p.id_position order by position_name, start_date desc");
    QSqlQuery query(qtext);
    QSqlQueryModel* model = new QSqlQueryModel();
    model->setQuery(query);
    emit open_main_window(model);
    this->hide();
}
void manager_menu::on_show_positions_button_clicked()
{
    QString qtext("SELECT position_name as \"Назва посади\",subject_name as \"Назва предмета\" FROM positions p join subjects s on p.id_subject=s.id_subject order by position_name");
    QSqlQuery query(qtext);
    QSqlQueryModel* model = new QSqlQueryModel();
    model->setQuery(query);
    emit open_main_window(model);
    this->hide();
}
void manager_menu::on_show_subjects_button_clicked()
{
    QString qtext("SELECT subject_name as \"Назва предмета\",hours_quantity as \"Кількість годин\",study_programe as \"Програма навчання\" FROM subjects order by subject_name");
    QSqlQuery query(qtext);
    QSqlQueryModel* model = new QSqlQueryModel();
    model->setQuery(query);
    emit open_main_window(model);
    this->hide();
}
예제 #6
0
int main(int argc, char *argv[])
{
#ifdef DEBUG
	gtk_init(&argc, &argv);
	gtk_gl_init(&argc, &argv);
#else
	gtk_init(NULL, NULL);
	gtk_gl_init(NULL, NULL);
#endif

	setup_splash();
	splash("Starting up...");

	// Init logfile
	FILE* f = fopen("slade.log", "wt");
	fclose(f);

	load_main_config();

	init_console();
	setup_icons();

	log_message("Init textures...\n");
	init_textures();

	log_message("Loading colour configurations...\n");
	load_colour_configs();
	string ccfg = col_config;
	set_colour_config(ccfg);

	log_message("Setup editor window...\n");
	setup_editor_window();
	log_message("Setup wad manager window...\n");

	splash_hide();

	setup_main_window();
	log_message("Init OK.\n");

	open_main_window();

	// Setup gl font
	//font_list = glGenLists(256);
	//PangoFontDescription *font_desc = pango_font_description_from_string("Monospace 10");
	//gdk_gl_font_use_pango_font(font_desc, 0, 255, font_list);

	gtk_main();
	
	save_main_config();

	return 0;
}
예제 #7
0
int main(int argc, char *argv[])
{
	gtk_init(&argc, &argv);
	setup_splash();
	splash("Starting up...");
	//gtk_gl_init(&argc, &argv);

	// Init logfile
	FILE* f = fopen("slade.log", "wt");
	fclose(f);

	load_main_config();

	init_console();
	setup_icons();
	init_textures();

	load_colour_configs();
	string ccfg = col_config;
	set_colour_config(ccfg);

	setup_editor_window();
	setup_main_window();
	open_main_window();

	// Setup gl font
	//font_list = glGenLists(256);
	//PangoFontDescription *font_desc = pango_font_description_from_string("Monospace 10");
	//gdk_gl_font_use_pango_font(font_desc, 0, 255, font_list);

	splash_hide();

	gtk_main();
	
	save_main_config();

	return 0;
}
예제 #8
0
void initialize(void)
{
    int i;
    const char* p;

    add_preprocessor_option(yes, "-I%s", get_preference("RESOURCES_FOLDER"));

    root.numwindows = 0;
    root.messages.line = NULL;

    root.gldesc.max_screen_x = glutGet(GLUT_SCREEN_WIDTH);
    if (root.gldesc.max_screen_x <= 0)
        root.gldesc.max_screen_x = 1024;
    root.gldesc.max_screen_y = glutGet(GLUT_SCREEN_HEIGHT);
    if (root.gldesc.max_screen_y <= 0)
        root.gldesc.max_screen_y = 768;

    root.gldesc.max_screen_x -= 10;
    root.gldesc.max_screen_y -= 30;

    if (is_preference_on(get_preference("MULTIPLE_SCREENS")) == no)
        glueSetConstrainedWindows(yes);
    else
        glueSetConstrainedWindows(no);

    if (is_preference_on(get_preference("MULTIPLE_SCREENS")) == no)
        open_main_window();

    init_global_lighting();

    if (make_selectors() == code_bad)
        error(exit_program,tool_message);

    /* Initialize some root structure variables */
    root.nummodels = 0;
    root.numplots = 0;
    root.numtools = 0;
    root.currentwindow = NO_WINDOW;
    root.modelcount = 0;
    root.confirm_window_open = no;

    root.gfont.defaultfont = SIMM_DEFAULT_FONT;
    root.gfont.largefont   = SIMM_LARGE_FONT;
    root.gfont.smallfont   = SIMM_SMALL_FONT;
    root.gfont.italics     = SIMM_ITALIC_FONT;
    root.gfont.bold        = SIMM_BOLD_FONT;

    /* Set all the plot pointers to NULL */
    for (i=0; i<PLOTBUFFER; i++)
        gPlot[i] = NULL;

    /* Set all the model pointers to NULL */
    for (i=0; i<MODELBUFFER; i++)
        gModel[i] = NULL;

    /* Set all the tool structures to unused */
    for (i=0; i<TOOLBUFFER; i++)
    {
        tool[i].used = no;
        tool[i].name = NULL;
    }

    /* Make the [initially empty] model menu */
    root.modelmenu = -1;
    root.plotmenu = -1;

    root.gravityMenu = glueCreateMenu("Gravity");
    glueAddMenuEntryWithValue(root.gravityMenu, " +X", smX);
    glueAddMenuEntryWithValue(root.gravityMenu, " -X", smNegX);
    glueAddMenuEntryWithValue(root.gravityMenu, " +Y", smY);
    glueAddMenuEntryWithValue(root.gravityMenu, " -Y", smNegY);
    glueAddMenuEntryWithValue(root.gravityMenu, " +Z", smZ);
    glueAddMenuEntryWithValue(root.gravityMenu, " -Z", smNegZ);
    glueAddMenuEntryWithValue(root.gravityMenu, "none", smNoAlign);

    /* Init the command list */
    root.num_commands = 0;
    for (i=0; i<COMMAND_BUFFER; i++)
        root.command[i] = NULL;

    updatemodelmenu();

    /* Call routines to make the color map */
    init_color_database();

    /* Make the confirm-action menu */
    make_confirm_menu();

    /* Malloc the SIMM event queue */
    root.simm_event_queue = (SimmEvent*)simm_malloc(EVENT_QUEUE_SIZE*sizeof(SimmEvent));
    if (root.simm_event_queue == NULL)
        error(exit_program,tool_message);

    root.event_queue_length = EVENT_QUEUE_SIZE;
    root.events_in_queue = 0;
}
// menu_action: Called when a menu/toolbar item is selected
// ----------------------------------------------------- >>
static void menu_action(GtkAction *action)
{
	string act = gtk_action_get_name(action);

	if (act == "WadManager")
		open_main_window();
	else if (act == "Exit")
		gtk_main_quit();
	else if (act == "Close")
		file_close();
	else if (act == "ModeVerts")
		change_edit_mode(0);
	else if (act == "ModeLines")
		change_edit_mode(1);
	else if (act == "ModeSectors")
		change_edit_mode(2);
	else if (act == "ModeThings")
		change_edit_mode(3);
	else if (act == "Mode3d")
	{
		if (map.opened)
			start_3d_mode();
	}
	else if (act == "ShowConsole")
		popup_console();
	else if (act == "ShowScriptEditor")
		open_script_edit();
	else if (act == "Preferences")
		open_prefs_dialog();
	else if (act == "About")
	{
		gtk_show_about_dialog(GTK_WINDOW(editor_window),
								"name", "SLADE",
								"comments", "by Simon 'SlayeR' Judd, 2005",
								"version", __SLADEVERS,
								"website", "http://slade.mancubus.net",
								NULL);
	}
	else if (act == "Save")
	{
		if (edit_wad)
			file_save();
		else
			file_saveas();
	}
	else if (act == "SaveAs")
		file_saveas();
	else if (act == "MergeSectors")
		sector_merge(false);
	else if (act == "JoinSectors")
		sector_merge(true);
	else if (act == "CreateDoor")
		sector_create_door(open_texture_browser(true, false, false, "-"));
	else if (act == "CreateStairs")
		edit_create_stairs();
	else if (act == "CheckMapStats")
		check_map_stats();
	else if (act == "CheckTags")
		message_box(parse_string("%d Tags Cleaned", clean_tags()), GTK_MESSAGE_INFO);
	else if (act == "CheckVerts")
		message_box(parse_string("%d Vertices Removed", remove_free_verts()), GTK_MESSAGE_INFO);
	else if (act == "CheckLines")
		message_box(parse_string("%d 0-Length Lines Removed", remove_zerolength_lines()), GTK_MESSAGE_INFO);
	else if (act == "CheckSectors")
		message_box(parse_string("%d Sectors Removed", remove_unused_sectors()), GTK_MESSAGE_INFO);
	else if (act == "CheckTextures")
		check_textures();
	else if (act == "AlignX")
		line_align_x();
	else if (act == "CorrectRefs")
		line_correct_references();
	else if (act == "SplitLine")
	{
		int splits = 2;
		string ret = entry_box("Enter Number Of Splits:");

		if (ret != "")
			splits = atoi(ret.c_str());

		line_split(splits);
	}
	else
		message_box("Menu action not implemented", GTK_MESSAGE_INFO);

	force_map_redraw(true, true);
}