mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Change taglist_get_tagstring to support 'unlimited' tag list size
Previous taglist_get_tagstring signature/implementation did not allow handling of cases where inputted buffer could not contain all tags. New implementation allocates buffer based on pre-computed size allowing to insert all tags in the returned string. Added get_taglist_string in qthelper to handle conversion to QString Added TestTagList with tests for taglist_get_tagstring Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
This commit is contained in:
parent
f1830cd44e
commit
7753352e62
10 changed files with 140 additions and 39 deletions
|
@ -417,7 +417,6 @@ void MainTab::updateDiveInfo(bool clear)
|
|||
// for the trip in the Info tab, otherwise we show the info of the
|
||||
// selected_dive
|
||||
struct dive *prevd;
|
||||
char buf[1024];
|
||||
|
||||
process_selected_dives();
|
||||
process_all_dives(&displayed_dive, &prevd);
|
||||
|
@ -570,8 +569,7 @@ void MainTab::updateDiveInfo(bool clear)
|
|||
ui.equipmentTab->setEnabled(true);
|
||||
cylindersModel->updateDive();
|
||||
weightModel->updateDive();
|
||||
taglist_get_tagstring(displayed_dive.tag_list, buf, 1024);
|
||||
ui.tagWidget->setText(QString(buf));
|
||||
ui.tagWidget->setText(get_taglist_string(displayed_dive.tag_list));
|
||||
if (current_dive) {
|
||||
bool isManual = same_string(current_dive->dc.model, "manually added dive");
|
||||
ui.depth->setVisible(isManual);
|
||||
|
@ -1347,13 +1345,10 @@ void MainTab::diffTaggedStrings(QString currentString, QString displayedString,
|
|||
|
||||
void MainTab::on_tagWidget_textChanged()
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
if (editMode == IGNORE || acceptingEdit == true)
|
||||
return;
|
||||
|
||||
taglist_get_tagstring(displayed_dive.tag_list, buf, 1024);
|
||||
if (same_string(buf, qPrintable(ui.tagWidget->toPlainText())))
|
||||
if (get_taglist_string(displayed_dive.tag_list) == ui.tagWidget->toPlainText())
|
||||
return;
|
||||
|
||||
markChangedWidget(ui.tagWidget);
|
||||
|
@ -1524,9 +1519,7 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what)
|
|||
if (what.divesite)
|
||||
ui.location->setCurrentDiveSiteUuid(displayed_dive.dive_site_uuid);
|
||||
if (what.tags) {
|
||||
char buf[1024];
|
||||
taglist_get_tagstring(displayed_dive.tag_list, buf, 1024);
|
||||
ui.tagWidget->setText(QString(buf));
|
||||
ui.tagWidget->setText(get_taglist_string(displayed_dive.tag_list));
|
||||
}
|
||||
if (what.cylinders) {
|
||||
cylindersModel->updateDive();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue