Example #1
0
Tpreset* Tpresets::getAutoPreset0(TautoPresetProps &aprops,bool filefirst)
{
    if (filefirst) {
        const char_t *AVIname=aprops.getSourceFullFlnm();
        ffstring presetFlnm;
        changepathext(AVIname, presetext, presetFlnm);
        if (fileexists(presetFlnm.c_str())) {
            Tpreset *preset=newPreset(AVIname);
            preset->loadFile(presetFlnm.c_str());
            Tpreset::normalizePresetName(preset->presetName, AVIname, countof(preset->presetName));
            preset->autoLoadedFromFile=true;
            iterator i=findPreset(preset->presetName);
            if (i!=end() && (*i)->autoLoadedFromFile) {
                removePreset(preset->presetName);
            }
            nextUniqueName(preset);
            push_back(preset);
            return preset;
        }
    }
    for (iterator i=begin(); i!=end(); i++)
        if ((*i)->isAutoPreset(aprops)) {
            return *i;
        }
    return NULL;
}
QmitkLevelWindowPresetDefinitionDialog::QmitkLevelWindowPresetDefinitionDialog(QWidget *parent, Qt::WindowFlags f)
  : QDialog(parent, f), m_TableModel(nullptr), m_SortModel(this)
{
  this->setupUi(this);

  QObject::connect(addButton, SIGNAL(clicked()), this, SLOT(addPreset()));
  QObject::connect(removeButton, SIGNAL(clicked()), this, SLOT(removePreset()));
  QObject::connect(changeButton, SIGNAL(clicked()), this, SLOT(changePreset()));

  QObject::connect(presetView->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(sortPresets(int)));

  presetView->verticalHeader()->setVisible(false);
  presetView->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);

  presetView->setModel(&m_SortModel);
}