t_stat sim_load (FILE *fileref, char *cptr, char *fnam, int flag) { if (flag) return my_save(fileref, cptr, fnam); else return my_load(fileref, cptr, fnam); }
int event_folder(void *tp, t_event_mouse *action) { t_tek *tekpaint; char *response; char *path; tekpaint = tp; if (action && tekpaint) { my_putstr("Voulez-vous ouvrir un fichier .bmp(0) ou .ini(1) ? > "); response = get_next_line(0); my_putstr("Quel fichier voulez-vous ouvrir ? > "); path = get_next_line(0); if (my_getnbr(response) == 1) { bunny_delete_clipable(&tekpaint->img->clipable); tekpaint->img = my_load(path); } else { bunny_delete_clipable(&tekpaint->img->clipable); tekpaint->img = my_load_bmp(path); } } return (0); }
int main(int argc, char *argv[]) { int do_load = 1; int do_exec = 0; int do_shutdown = 1; int do_sync = 1; int do_ifdown = 0; int do_unload = 0; int do_reuse_initrd = 0; unsigned long kexec_flags = 0; char *type = 0; char *endptr; int opt; int result = 0; int fileind; static const struct option options[] = { KEXEC_ARCH_OPTIONS { 0, 0, 0, 0}, }; static const char short_options[] = KEXEC_OPT_STR; opterr = 0; /* Don't complain about unrecognized options here */ while ((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { switch(opt) { case OPT_HELP: usage(); return 0; case OPT_VERSION: version(); return 0; case OPT_NOIFDOWN: do_ifdown = 0; break; case OPT_FORCE: do_load = 1; do_shutdown = 0; do_sync = 1; do_ifdown = 1; do_exec = 1; break; case OPT_LOAD: do_load = 1; do_exec = 0; do_shutdown = 0; break; case OPT_UNLOAD: do_load = 0; do_shutdown = 0; do_sync = 0; do_unload = 1; break; case OPT_EXEC: do_load = 0; do_shutdown = 0; do_sync = 1; do_ifdown = 1; do_exec = 1; break; case OPT_TYPE: type = optarg; break; case OPT_PANIC: do_load = 1; do_exec = 0; do_shutdown = 0; do_sync = 0; kexec_flags = KEXEC_ON_CRASH; break; case OPT_MEM_MIN: mem_min = strtoul(optarg, &endptr, 0); if (*endptr) { fprintf(stderr, "Bad option value in --mem-min=%s\n", optarg); usage(); return 1; } break; case OPT_MEM_MAX: mem_max = strtoul(optarg, &endptr, 0); if (*endptr) { fprintf(stderr, "Bad option value in --mem-max=%s\n", optarg); usage(); return 1; } break; case OPT_REUSE_INITRD: do_reuse_initrd = 1; break; default: break; } } if ((kexec_flags & KEXEC_ON_CRASH) && !is_crashkernel_mem_reserved()) { printf("Memory for crashkernel is not reserved\n"); printf("Please reserve memory by passing "); printf("\"crashkernel=X@Y\" parameter to the kernel\n"); die("Then try loading kdump kernel\n"); } fileind = optind; /* Reset getopt for the next pass; called in other source modules */ opterr = 1; optind = 1; result = arch_process_options(argc, argv); /* Check for bogus options */ if (!do_load) { while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { if ((opt == '?') || (opt >= OPT_ARCH_MAX)) { usage(); return 1; } } } if (do_reuse_initrd){ check_reuse_initrd(); arch_reuse_initrd(); } if (do_unload) { result = k_unload(kexec_flags); } if (do_load && (result == 0)) { result = my_load(type, fileind, argc, argv, kexec_flags); } /* Don't shutdown unless there is something to reboot to! */ if ((result == 0) && (do_shutdown || do_exec) && !kexec_loaded()) { die("Nothing has been loaded!\n"); } if ((result == 0) && do_shutdown) { result = my_shutdown(); } if ((result == 0) && do_sync) { sync(); } if ((result == 0) && do_ifdown) { extern int ifdown(void); (void)ifdown(); } if ((result == 0) && do_exec) { result = my_exec(); } fflush(stdout); fflush(stderr); return result; }
WarningConfig::WarningConfig (int t, TQWidget * parent, const char *name) : TDECModule(parent, name), checkSuspend(0), checkStandby(0), checkHibernate(0) { TDEGlobal::locale()->insertCatalogue("klaptopdaemon"); // For translation of klaptopdaemon messages type = t; apm = laptop_portable::has_power_management(); config = new TDEConfig("kcmlaptoprc"); my_load(0); if (!apm) { TQVBoxLayout *top_layout = new TQVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); KActiveLabel* explain = laptop_portable::no_power_management_explanation(this); top_layout->addWidget(explain, 0); top_layout->addStretch(1); } else { TQGridLayout *grid = new TQGridLayout( this, 11, 2, /* rows x cols */ KDialog::marginHint(), KDialog::spacingHint() ); grid->setColStretch( 1, 1 ); int curRow = 0; // setup the trigger stuff: if (type) { checkCriticalTime = new TQCheckBox( i18n("Critical &trigger:"), this ); checkCriticalPercent = new TQCheckBox( i18n("Critical &trigger:"), this ); editCriticalTime = new TQSpinBox(1, 60*24, 1, this); editCriticalTime->setSuffix(i18n("keep short, unit in spinbox", "min")); TQToolTip::add(editCriticalTime, i18n("When this amount of battery life is left the actions below will be triggered")); editCriticalPercent = new TQSpinBox(1, 100, 1, this); editCriticalPercent->setSuffix(i18n("keep short, unit in spinbox", "%")); TQToolTip::add(editCriticalPercent, i18n("When this amount of battery life is left the actions below will be triggered")); grid->addWidget(checkCriticalTime, curRow, 0); grid->addWidget(editCriticalTime, curRow++, TQt::AlignLeft); grid->addWidget(checkCriticalPercent, curRow, 0); grid->addWidget(editCriticalPercent, curRow++, TQt::AlignLeft); connect(editCriticalTime, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(configChanged())); connect(editCriticalPercent, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(configChanged())); connect(checkCriticalTime, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(configChanged())); connect(checkCriticalPercent, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(configChanged())); connect(checkCriticalTime, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(checkCriticalTimeChanged(bool))); connect(checkCriticalPercent, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(checkCriticalPercentChanged(bool))); } else { checkLowTime = new TQCheckBox( i18n("Low &trigger:"), this ); checkLowPercent = new TQCheckBox( i18n("Low &trigger:"), this ); editLowTime = new TQSpinBox(1, 60*24, 1, this); editLowTime->setSuffix(i18n("keep short, unit in spinbox", "min")); TQToolTip::add(editLowTime, i18n("When this amount of battery life is left the actions below will be triggered")); editLowPercent = new TQSpinBox(1, 100, 1, this); editLowPercent->setSuffix(i18n("keep short, unit in spinbox", "%")); TQToolTip::add(editLowPercent, i18n("When this amount of battery life is left the actions below will be triggered")); grid->addWidget(checkLowTime, curRow, 0); grid->addWidget(editLowTime, curRow++, TQt::AlignLeft); grid->addWidget(checkLowPercent, curRow, 0); grid->addWidget(editLowPercent, curRow++, TQt::AlignLeft); connect(editLowTime, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(configChanged())); connect(editLowPercent, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(configChanged())); connect(checkLowTime, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(configChanged())); connect(checkLowPercent, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(configChanged())); connect(checkLowTime, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(checkLowTimeChanged(bool))); connect(checkLowPercent, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(checkLowPercentChanged(bool))); } // setup the Run Command stuff checkRunCommand = new TQCheckBox(i18n("Run &command:"), this); grid->addWidget(checkRunCommand, curRow, 0); editRunCommand = new KURLRequester( this ); editRunCommand->setEnabled(false); connect( checkRunCommand, TQT_SIGNAL(toggled(bool)), editRunCommand, TQT_SLOT(setEnabled(bool)) ); connect( checkRunCommand, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged()) ); connect( editRunCommand, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(configChanged()) ); grid->addWidget(editRunCommand, curRow++, 1); TQToolTip::add( editRunCommand, i18n( "This command will be run when the battery gets low" ) ); // setup the Play Sound stuff checkPlaySound = new TQCheckBox(i18n("&Play sound:"), this); grid->addWidget(checkPlaySound, curRow, 0); editPlaySound = new KURLRequester( this ); editPlaySound->setEnabled(false); connect( checkPlaySound, TQT_SIGNAL(toggled(bool)), editPlaySound, TQT_SLOT(setEnabled(bool)) ); connect( checkPlaySound, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged()) ); connect( editPlaySound, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(configChanged()) ); grid->addWidget(editPlaySound, curRow++, 1); TQToolTip::add( editPlaySound, i18n( "This sound will play when the battery gets low" ) ); // setup the System Sound stuff checkBeep = new TQCheckBox(i18n("System &beep"), this); grid->addWidget(checkBeep, curRow++, 0); connect(checkBeep, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged())); TQToolTip::add( checkBeep, i18n( "The system will beep if this is enabled" ) ); checkNotify = new TQCheckBox(i18n("&Notify"), this); grid->addWidget(checkNotify, curRow++, 0); connect(checkNotify, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged())); int can_suspend = laptop_portable::has_suspend(); int can_standby = laptop_portable::has_standby(); int can_hibernate = laptop_portable::has_hibernation(); int can_brightness = laptop_portable::has_brightness(); if (can_brightness) { checkBrightness = new TQCheckBox(i18n("Panel b&rightness"), this); checkBrightness->setMinimumSize(checkBrightness->sizeHint()); TQToolTip::add( checkBrightness, i18n( "If enabled the back panel brightness will change" ) ); grid->addWidget(checkBrightness, curRow, 0); connect(checkBrightness, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(brightness_changed(bool))); TQHBoxLayout *v = new TQHBoxLayout(); v->addWidget(new TQLabel("-", this)); valueBrightness = new TQSlider(0, 255, 16, 160, Qt::Horizontal, this); TQToolTip::add( valueBrightness, i18n( "How bright or dim to make the back panel" ) ); valueBrightness->setMaximumWidth(70); v->addWidget(valueBrightness); v->addWidget(new TQLabel("+", this)); v->addStretch(1); grid->addLayout(v, curRow, 1); valueBrightness->setEnabled(0); connect(valueBrightness, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(configChanged())); ++curRow; } else {