[PATCH 2/3] Extend tags model to Buddy field

Dirk Hohndel dirk at hohndel.org
Wed Jan 15 18:22:32 UTC 2014


This is really cool Sergey. Thanks

I wonder if we should do the same for divemaster as well. Granted, most
of the time there will be only one (I have a few exceptions in my data),
but I mostly think that this would make things visually more
consistent...

Thoughts, comments?

/D

On Wed, 2014-01-15 at 22:35 +0200, Sergey Starosek wrote:
> This doesn't change storage format. Instead it  parses buddy strings and
> converts them to string list which is supplied to tags widget.
> 
> This feature  was requested in ticket #311
> 
> Signed-off-by: Sergey Starosek <sergey.starosek at gmail.com>
> ---
>  qt-ui/maintab.cpp | 3 ++-
>  qt-ui/maintab.h   | 2 +-
>  qt-ui/maintab.ui  | 2 +-
>  3 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
> index 9fa94c8..81e820a 100644
> --- a/qt-ui/maintab.cpp
> +++ b/qt-ui/maintab.cpp
> @@ -834,8 +834,9 @@ void markChangedWidget(QWidget *w){
>  	w->setPalette(p);
>  }
>  
> -void MainTab::on_buddy_textChanged(const QString& text)
> +void MainTab::on_buddy_textChanged()
>  {
> +	QString text = ui.buddy->toPlainText().split(",", QString::SkipEmptyParts).join(", ");
>  	EDIT_SELECTED_DIVES( EDIT_TEXT(mydive->buddy, text) );
>  	markChangedWidget(ui.buddy);
>  }
> diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
> index ec2140b..313149f 100644
> --- a/qt-ui/maintab.h
> +++ b/qt-ui/maintab.h
> @@ -69,7 +69,7 @@ public slots:
>  	void on_location_textChanged(const QString& text);
>  	void on_coordinates_textChanged(const QString& text);
>  	void on_divemaster_textChanged(const QString& text);
> -	void on_buddy_textChanged(const QString& text);
> +	void on_buddy_textChanged();
>  	void on_suit_textChanged(const QString& text);
>  	void on_notes_textChanged();
>  	void on_airtemp_textChanged(const QString& text);
> diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui
> index 846fb4f..b2ab316 100644
> --- a/qt-ui/maintab.ui
> +++ b/qt-ui/maintab.ui
> @@ -157,7 +157,7 @@
>           </widget>
>          </item>
>          <item row="8" column="1">
> -         <widget class="QLineEdit" name="buddy">
> +		 <widget class="TagWidget" name="buddy">
>            <property name="readOnly">
>             <bool>false</bool>
>            </property>




More information about the subsurface mailing list