Ejemplo n.º 1
0
toTemplateSetting::toTemplateSetting(toTool *tool, QWidget *parent, const char *name)
    : QWidget(parent)
    , toSettingTab("template.html#setup")
    , Tool(tool)
{

    setupUi(this);
    TemplatesMap def = DefaultText();

    TemplatesMap tMap = toConfigurationNewSingle::Instance().option(ToConfiguration::Template::TemplateMap).toMap();
    TemplatesMapIterator i(tMap);
    while (i.hasNext())
    {
        i.next();
        new toTreeWidgetItem(FileList, i.key(), i.value().toString());
        if (def.find(i.key()) != def.end())
            def.erase(def.find(i.key()));
    }
    TemplatesMapIterator j(def);
    while (j.hasNext())
    {
        j.next();
        new toTreeWidgetItem(FileList, j.key(), j.value().toString());
    }
    toSettingTab::loadSettings(this);
}
void toTextTemplate::insertItems(toTreeWidget *parent, QToolBar *)
{
    TemplatesMap def = DefaultText();

    TemplatesMapIterator i(toConfigurationSingle::Instance().templates());
    while (i.hasNext())
    {
        i.next();
        addFile(parent, i.key(), i.value());
        if (def.find(i.key()) != def.end())
            def.erase(def.find(i.key()));
    }
    TemplatesMapIterator j(def);
    while (j.hasNext())
    {
        j.next();
        addFile(parent, j.key(), j.value());
    }
}
toTemplatePrefs::toTemplatePrefs(toTool *tool, QWidget *parent, const char *name)
        : QWidget(parent), toSettingTab("template.html#setup"), Tool(tool)
{

    setupUi(this);
    TemplatesMap def = DefaultText();

    TemplatesMapIterator i(toConfigurationSingle::Instance().templates());
    while (i.hasNext())
    {
        i.next();
        new toTreeWidgetItem(FileList, i.key(), i.value());
        if (def.find(i.key()) != def.end())
            def.erase(def.find(i.key()));
    }
    TemplatesMapIterator j(def);
    while (j.hasNext())
    {
        j.next();
        new toTreeWidgetItem(FileList, j.key(), j.value());
    }
}