Switch to unified view

a/src/qtgui/advsearch_w.cpp b/src/qtgui/advsearch_w.cpp
...
...
84
    conjunctCMB->insertItem(1, tr("All clauses"));
84
    conjunctCMB->insertItem(1, tr("All clauses"));
85
    conjunctCMB->insertItem(2, tr("Any clause"));
85
    conjunctCMB->insertItem(2, tr("Any clause"));
86
86
87
    // Create preconfigured clauses
87
    // Create preconfigured clauses
88
    for (unsigned int i = 0; i < iclausescnt; i++) {
88
    for (unsigned int i = 0; i < iclausescnt; i++) {
89
    addClause(initclausetypes[i]);
89
    addClause(initclausetypes[i], false);
90
    }
90
    }
91
    // Tune initial state according to last saved
91
    // Tune initial state according to last saved
92
    {
92
    {
93
    vector<SearchClauseW *>::iterator cit = m_clauseWins.begin();
93
    vector<SearchClauseW *>::iterator cit = m_clauseWins.begin();
94
        unsigned int existing = m_clauseWins.size();
94
        unsigned int existing = m_clauseWins.size();
95
    for (unsigned int i = 0; i < prefs.advSearchClauses.size(); i++) {
95
    for (unsigned int i = 0; i < prefs.advSearchClauses.size(); i++) {
96
        if (i < existing) {
96
        if (i < existing) {
97
        (*cit)->tpChange(prefs.advSearchClauses[i]);
97
        (*cit)->tpChange(prefs.advSearchClauses[i]);
98
        cit++;
98
        cit++;
99
        } else {
99
        } else {
100
        addClause(prefs.advSearchClauses[i]);
100
        addClause(prefs.advSearchClauses[i], false);
101
        }
101
        }
102
    }
102
    }
103
    }
103
    }
104
    (*m_clauseWins.begin())->wordsLE->setFocus();
104
    (*m_clauseWins.begin())->wordsLE->setFocus();
105
105
...
...
156
156
157
void AdvSearch::saveCnf()
157
void AdvSearch::saveCnf()
158
{
158
{
159
    // Save my state
159
    // Save my state
160
    prefs.advSearchClauses.clear(); 
160
    prefs.advSearchClauses.clear(); 
161
    for (vector<SearchClauseW *>::iterator cit = m_clauseWins.begin();
161
    for (const auto& clause : m_clauseWins) {
162
   cit != m_clauseWins.end(); cit++) {
163
    prefs.advSearchClauses.push_back((*cit)->sTpCMB->currentIndex());
162
    prefs.advSearchClauses.push_back(clause->sTpCMB->currentIndex());
164
    }
163
    }
165
}
164
}
166
165
167
void AdvSearch::addClause()
166
void AdvSearch::addClause(bool updsaved)
168
{
167
{
169
    addClause(0);
168
    addClause(0, updsaved);
170
}
169
}
171
170
172
void AdvSearch::addClause(int tp)
171
void AdvSearch::addClause(int tp, bool updsaved)
173
{
172
{
174
    SearchClauseW *w = new SearchClauseW(clauseFRM);
173
    SearchClauseW *w = new SearchClauseW(clauseFRM);
175
    m_clauseWins.push_back(w);
174
    m_clauseWins.push_back(w);
176
    ((QVBoxLayout *)(clauseFRM->layout()))->addWidget(w);
175
    ((QVBoxLayout *)(clauseFRM->layout()))->addWidget(w);
177
    w->show();
176
    w->show();
...
...
179
    if (m_clauseWins.size() > iclausescnt) {
178
    if (m_clauseWins.size() > iclausescnt) {
180
    delClausePB->setEnabled(true);
179
    delClausePB->setEnabled(true);
181
    } else {
180
    } else {
182
    delClausePB->setEnabled(false);
181
    delClausePB->setEnabled(false);
183
    }
182
    }
183
    if (updsaved) {
184
        saveCnf();
185
    }
184
}
186
}
185
187
186
void AdvSearch::delClause()
188
void AdvSearch::delClause(bool updsaved)
187
{
189
{
188
    if (m_clauseWins.size() <= iclausescnt)
190
    if (m_clauseWins.size() <= iclausescnt)
189
    return;
191
    return;
190
    delete m_clauseWins.back();
192
    delete m_clauseWins.back();
191
    m_clauseWins.pop_back();
193
    m_clauseWins.pop_back();
192
    if (m_clauseWins.size() > iclausescnt) {
194
    if (m_clauseWins.size() > iclausescnt) {
193
    delClausePB->setEnabled(true);
195
    delClausePB->setEnabled(true);
194
    } else {
196
    } else {
195
    delClausePB->setEnabled(false);
197
    delClausePB->setEnabled(false);
198
    }
199
    if (updsaved) {
200
        saveCnf();
196
    }
201
    }
197
}
202
}
198
203
199
void AdvSearch::delAFiltypPB_clicked()
204
void AdvSearch::delAFiltypPB_clicked()
200
{
205
{