FormSettingsContainer::FormSettingsContainer(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FormSettingsContainer)
{
    ui->setupUi(this);
    connect(ui->pushButtonConfirm,SIGNAL(released()),this,SLOT(addNewSettingsField()));
    connect(ui->pushButtonConfirm,SIGNAL(released()),this,SLOT(toggleAdding()));
    connect(ui->pushButtonCancel ,SIGNAL(released()),this,SLOT(toggleAdding()));
    connect(ui->lineEditFilterPreset,SIGNAL(textEdited(QString)),this,SLOT(filterPresets(QString)));
    ui->groupBoxAddingOptions->hide();
    ui->verticalLayoutSettingsList->setAlignment(Qt::AlignTop);


    QSettings list_settings("Configs/config_list",QSettings::IniFormat);
    FormSettingsField::settingsGlobalID =  list_settings.value("last_id",0).toInt();


    QStringList nameFilter("*.ini");
    QDir directory("Configs/");
    QStringList iniFiles = directory.entryList(nameFilter);
    qDebug() << "Reading the list of available configs settings:";
    // reading configs
    for (int i = 0; i < iniFiles.size(); ++i){
        FormSettingsField* sfield = new FormSettingsField("Configs/"+iniFiles[i],this);
        connect(sfield,SIGNAL(emitDeleteSettings(FormSettingsField*)),this,SLOT(removeSetting(FormSettingsField*)));
        connect(sfield,SIGNAL(emitLoadSettings(FormSettingsField*))  ,this,SLOT(reloadSettings(FormSettingsField*)));
        connect(sfield,SIGNAL(emitSaveSettings())  ,this,SLOT(saveSettings()));
        connect(sfield,SIGNAL(emitLoadAndConvert()),this,SLOT(loadAndConvert()));
        ui->verticalLayoutSettingsList->addWidget(sfield);


        settingsList.push_back(sfield);
    }

}
Example #2
0
static bool do_command(const char *s)
{
    if (!strcmp(s, "chain-set"))
        chain_set();

    else if (!strcmp(s, "dns-seeds"))
        list_dns_seeds();

    else if (!strcmp(s, "list-settings"))
        list_settings();

    else if (!strcmp(s, "new-address"))
        wallet_new_address();

    else if (!strcmp(s, "new-wallet"))
        wallet_create();

    else if (!strcmp(s, "netsync"))
        network_sync();

    else if (!strcmp(s, "version"))
        printf("version=%s\n", VERSION);

    else if (!strcmp(s, "wallet-addr"))
        wallet_addresses();

    else if (!strcmp(s, "wallet-info"))
        wallet_info();

    else if (!strcmp(s, "wallet-dump"))
        wallet_dump();

    return true;
}
Example #3
0
static int
sysinfo_cb (char *word[], char *word_eol[], void *userdata)
{
	error_printed = 0;
	int announce = 0;
	int buffer;
	char format[bsize];

	if (!hexchat_pluginpref_get_str (ph, "format", format))
	{
		hexchat_printf (ph, "%s\tError reading config file!", name);
		return HEXCHAT_EAT_ALL;
	}

	if (hexchat_list_int (ph, NULL, "type") >= 2)
	{
		announce = 1;
	}

	if (!g_ascii_strcasecmp ("HELP", word[2]))
	{
		hexchat_printf (ph, sysinfo_help);
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("LIST", word[2]))
	{
		list_settings ();
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("SET", word[2]))
	{
		if (!g_ascii_strcasecmp ("", word_eol[4]))
		{
			hexchat_printf (ph, "%s\tEnter a value!\n", name);
			return HEXCHAT_EAT_ALL;
		}
		if (!g_ascii_strcasecmp ("format", word[3]))
		{
			hexchat_pluginpref_set_str (ph, "format", word_eol[4]);
			hexchat_printf (ph, "%s\tformat is set to: %s\n", name, word_eol[4]);
		}
		else if (!g_ascii_strcasecmp ("percent", word[3]))
		{
			buffer = atoi (word[4]);	/* don't use word_eol, numbers must not contain spaces */

			if (buffer > 0 && buffer < INT_MAX)
			{
				hexchat_pluginpref_set_int (ph, "percent", buffer);
				hexchat_printf (ph, "%s\tpercent is set to: %d\n", name, buffer);
			}
			else
			{
				hexchat_printf (ph, "%s\tInvalid input!\n", name);
			}
		}
		else if (!g_ascii_strcasecmp ("pciids", word[3]))
		{
			hexchat_pluginpref_set_str (ph, "pciids", word_eol[4]);
			hexchat_printf (ph, "%s\tpciids is set to: %s\n", name, word_eol[4]);
		}
		else
		{
			hexchat_printf (ph, "%s\tInvalid variable name! Use 'pciids', 'format' or 'percent'!\n", name);
			return HEXCHAT_EAT_ALL;
		}

		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("RESET", word[2]))
	{
		reset_settings ();
		hexchat_printf (ph, "%s\tSettings have been restored to defaults.\n", name);
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("OS", word[2]))
	{
		print_os (announce, format);
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("DISTRO", word[2]))
	{
		print_distro (announce, format);
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("CPU", word[2]))
	{
		print_cpu (announce, format);
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("RAM", word[2]))
	{
		print_ram (announce, format);
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("DISK", word[2]))
	{
		print_disk (announce, format);
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("VGA", word[2]))
	{
		print_vga (announce, format);
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("SOUND", word[2]))
	{
		print_sound (announce, format);
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("ETHERNET", word[2]))
	{
		print_ethernet (announce, format);
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("UPTIME", word[2]))
	{
		print_uptime (announce, format);
		return HEXCHAT_EAT_ALL;
	}
	else if (!g_ascii_strcasecmp ("", word[2]))
	{
		print_summary (announce, format);
		return HEXCHAT_EAT_ALL;
	}
	else
	{
		hexchat_printf (ph, sysinfo_help);
		return HEXCHAT_EAT_ALL;
	}
}