示例#1
0
void handle_sig(int signum)
{
	//Don't usr printf in a sig handler. This is just for my testing for now. 
	
//	printf("\nProcess %d got signal %d\n", getpid(), signum);

	//Basically, do nothing if the in_handler is 1. This means someone else is
	//Running a signal handler too. And they will exit appropriately
	//from the application
	//If you're the first person in there who needs to fix the mess
	//You restore the registers and exit. You don't need to set the in_handler to 0 again,
	//Because you are eventually terminating the program and no one else but you is in the signal handler.
	//A naive version of mutual exclusion, I suppose
	
	//The reason this check is required is to avoid multiple segfaults leading to
	//non-deterministic behavior, and to be able to run our non-reentrant unsafe 
	//library code as safely as possible.
	
	if(in_handler == 0){
		restore_defaults(); 
	}
	//You should never reach this point.
	
	printf("\n \n In handle_sig: this is bad. If you're here, your exit call failed. ");
}
    QVBoxLayout *nobles_layout = new QVBoxLayout;
    nobles_layout->addWidget(ui->cb_noble_highlight);
    foreach(CustomColor *cc, m_noble_colors) {
        nobles_layout->addWidget(cc);
    }
    nobles_layout->setSpacing(2);
    ui->tab_noble_colors->setLayout(nobles_layout);

    ui->horizontal_curse_layout->addWidget(m_curse_color);

    ui->cb_skill_drawing_method->addItem("Growing Center Box", UberDelegate::SDM_GROWING_CENTRAL_BOX);
    ui->cb_skill_drawing_method->addItem("Line Glyphs", UberDelegate::SDM_GLYPH_LINES);
    ui->cb_skill_drawing_method->addItem("Growing Fill", UberDelegate::SDM_GROWING_FILL);
    ui->cb_skill_drawing_method->addItem("Text", UberDelegate::SDM_NUMERIC);

    connect(ui->btn_restore_defaults, SIGNAL(pressed()), this, SLOT(restore_defaults()));

    connect(ui->btn_change_font, SIGNAL(pressed()), this, SLOT(show_row_font_chooser()));
    connect(ui->btn_change_header_font, SIGNAL(pressed()), this, SLOT(show_header_font_chooser()));
    connect(ui->btn_change_tooltip_font, SIGNAL(pressed()), this, SLOT(show_tooltip_font_chooser()));
    connect(ui->btn_change_main_font, SIGNAL(pressed()), this, SLOT(show_main_font_chooser()));

    connect(ui->cb_auto_contrast, SIGNAL(toggled(bool)), m_general_colors.at(0), SLOT(setDisabled(bool)));
    connect(ui->cb_moodable, SIGNAL(toggled(bool)), m_general_colors.at(8), SLOT(setEnabled(bool)));
    connect(ui->cb_moodable, SIGNAL(toggled(bool)), m_general_colors.at(9), SLOT(setEnabled(bool)));

    connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tab_index_changed(int)));

    read_settings();
}