static void initialize_categories (void) { gint n_added; if (initialized) return; initialized = TRUE; categories_table = g_hash_table_new_full ( g_str_hash, g_str_equal, g_free, (GDestroyNotify) free_category_info); g_atexit (finalize_categories); n_added = load_categories (); if (n_added > 0) { g_debug ("Loaded %d categories", n_added); save_is_pending = FALSE; return; } n_added = migrate_old_categories (); if (n_added > 0) { g_debug ("Loaded %d categories", n_added); save_categories (); return; } load_default_categories (); g_debug ("Loaded default categories"); save_categories (); }
CategorySelectDialog::CategorySelectDialog(View *parentView, QString text, QWidget *parent) : QDialog(parent), ui(new Ui::CategorySelectDialog) { this->parent = parentView; this->setWindowTitle("Category Selector"); this->pm = new PManager; this->selected_category = NULL; QHBoxLayout *button_layout = new QHBoxLayout; QVBoxLayout *main_layout = new QVBoxLayout; this->list_categories = new QComboBox; load_categories(); QPushButton *button_ok = new QPushButton("OK"); QPushButton *button_cancel = new QPushButton("Cancel"); button_cancel->setFixedWidth(50); button_ok->setFixedWidth(50); connect(button_cancel, &QPushButton::clicked, this, &CategorySelectDialog::on_button_cancel_click); connect(button_ok, &QPushButton::clicked, this, &CategorySelectDialog::on_button_ok_click); QLabel *message = new QLabel(text); main_layout->addWidget(message); main_layout->addWidget(this->list_categories); button_layout->addWidget(button_ok); button_layout->addWidget(button_cancel); main_layout->addLayout(button_layout); this->setLayout(main_layout); }
Plugin_Chooser::Plugin_Chooser ( int X,int Y,int W,int H, const char *L ) : Fl_Double_Window ( X,Y,W,H,L ) { set_modal(); _value = 0; _plugins = Plugin_Module::get_all_plugins(); { Plugin_Chooser_UI *o = ui = new Plugin_Chooser_UI(X,Y,W,H); o->name_input->callback( &Plugin_Chooser::cb_handle, this ); o->name_input->when( FL_WHEN_CHANGED ); o->author_input->callback( &Plugin_Chooser::cb_handle, this ); o->author_input->when( FL_WHEN_CHANGED ); o->inputs_input->callback( &Plugin_Chooser::cb_handle, this ); o->inputs_input->when( FL_WHEN_CHANGED ); o->outputs_input->callback( &Plugin_Chooser::cb_handle, this ); o->outputs_input->when( FL_WHEN_CHANGED ); o->favorites_button->callback( &Plugin_Chooser::cb_handle, this ); o->favorites_button->when( FL_WHEN_CHANGED ); o->all_button->callback( &Plugin_Chooser::cb_handle, this ); o->all_button->when( FL_WHEN_CHANGED ); o->category_choice->callback( &Plugin_Chooser::cb_handle, this ); o->category_choice->when( FL_WHEN_CHANGED ); { Plugin_Table *o = new Plugin_Table(ui->table->x(),ui->table->y(),ui->table->w(),ui->table->h() ); ui->table_group->add(o); ui->table_group->resizable(o); delete ui->table; ui->table = o; /* ui->scalepack->add( o ); */ /* ui->scalepack->resizable( o ); */ o->col_header(1); o->col_resize(1); o->row_resize(1); o->cols(6); o->col_resize_min(4); o->col_width(0,30); o->col_width(1,350 - 7); o->col_width(2,200); o->col_width(3,75); o->col_width(4,30); o->col_width(5,30); o->color(FL_BLACK); o->box(FL_NO_BOX); o->when(FL_WHEN_CHANGED); o->callback( &Plugin_Chooser::cb_table, this ); } resizable(o); } size_range( 735, 300, 735, 0 ); end(); load_categories(); if ( load_favorites() ) { ui->all_button->value(0); ui->favorites_button->value(1); } }