Ejemplo n.º 1
0
DialogPreferences::DialogPreferences(boost::shared_ptr<SettingsManagerBase> settings_, QWidget* parent)
	: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
	, settings(settings_)
{
	this->setupUi(this);

	delete checkAutoClear;
	delete timeEdit;
	delete horizontalLayout_5;
	delete checkBox_6;

	scanWidgets(this);

	listAdvancedOptions->setItemDelegate(new ItemDelegateEditCollumn(listAdvancedOptions, CN_CURVALUE));
	std::vector<std::string> keys = settings->getAllKeys();
	BOOST_FOREACH(const std::string& s, keys) {
		if (widgets.count(s) == 0) {
			QTreeWidgetItem* twi = new QTreeWidgetItem(listAdvancedOptions);
			twi->setText(CN_KEY,     S2Q(s));
			twi->setText(CN_DEFAULT, S2Q(settings->getInfo(s)->getDefault()));
			twi->setFlags(twi->flags() | Qt::ItemIsEditable);
		}
	}

	listCategories->setCurrentRow(0);

	SettingsVariableBase* sv = settings->getVariable("gui.qt.showadvancedsettings");
	bool showadvanced = sv->getValue<bool>();
	if (!showadvanced)
		delete listCategories->item(listCategories->count()-1);

	initSettings();
}
Ejemplo n.º 2
0
void DialogPreferences::on_listAdvancedOptions_itemChanged(QTreeWidgetItem* item, int col)
{
	if (col != CN_CURVALUE) return;
	onSettingChanged();

	std::string curval = Q2S(item->text(CN_CURVALUE));
	bool isvalid = false;
	try {
		std::string normval = settings->getVariable(Q2S(item->text(CN_KEY)))->isValid(curval);
		if (curval != normval) {
			item->setText(CN_CURVALUE, S2Q(normval));
			return;
		}
		isvalid = true;
	} catch (...) {};

	bool bold = item->text(CN_CURVALUE) != item->text(CN_DEFAULT);
	QFont tfont = item->font(CN_DEFAULT);
	tfont.setBold(bold);
	item->setFont(CN_CURVALUE, tfont);
	item->setFont(CN_KEY     , tfont);

	QColor tcolor = item->textColor(CN_DEFAULT);
	if (!isvalid)
		tcolor = QColor("red");
	item->setTextColor(CN_CURVALUE, tcolor);
	item->setTextColor(CN_KEY     , tcolor);
}
Ejemplo n.º 3
0
QString EasyTrace::__GetModuleFileName(void *func)
{
    QString strPath = "";
    Dl_info info;
    int rc;
    rc = dladdr(func, &info);
    if (!rc)  {
         qCritical("Problem retrieving program information for %x:  %s\n", func, dlerror());
         return "";
    }

    strPath = S2Q(info.dli_fname);
    return strPath;
}