Cleanup: remove DiveLocationLineEdit::currType

Apparently this field was never used...?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-06-30 23:18:12 +02:00 committed by Dirk Hohndel
parent 02e94de062
commit 09163c1ee7
2 changed files with 4 additions and 22 deletions

View file

@ -364,7 +364,6 @@ DiveLocationLineEdit::DiveLocationLineEdit(QWidget *parent) : QLineEdit(parent),
proxy(new DiveLocationFilterProxyModel()), proxy(new DiveLocationFilterProxyModel()),
model(new DiveLocationModel()), model(new DiveLocationModel()),
view(new DiveLocationListView()), view(new DiveLocationListView()),
currType(NO_DIVE_SITE),
currDs(nullptr) currDs(nullptr)
{ {
proxy->setSourceModel(model); proxy->setSourceModel(model);
@ -443,13 +442,8 @@ void DiveLocationLineEdit::itemActivated(const QModelIndex &index)
idx = index.model()->index(index.row(), LocationInformationModel::NAME); idx = index.model()->index(index.row(), LocationInformationModel::NAME);
dive_site *ds = index.model()->index(index.row(), LocationInformationModel::DIVESITE).data().value<dive_site *>(); dive_site *ds = index.model()->index(index.row(), LocationInformationModel::DIVESITE).data().value<dive_site *>();
currType = ds == RECENTLY_ADDED_DIVESITE ? NEW_DIVE_SITE : EXISTING_DIVE_SITE;
currDs = ds; currDs = ds;
setText(idx.data().toString()); setText(idx.data().toString());
if (currType == NEW_DIVE_SITE)
qDebug() << "Setting a New dive site";
else
qDebug() << "Setting a Existing dive site";
if (view->isVisible()) if (view->isVisible())
view->hide(); view->hide();
emit diveSiteSelected(); emit diveSiteSelected();
@ -509,12 +503,10 @@ void DiveLocationLineEdit::keyPressEvent(QKeyEvent *ev)
ev->key() != Qt::Key_Escape && ev->key() != Qt::Key_Escape &&
ev->key() != Qt::Key_Return) { ev->key() != Qt::Key_Return) {
if (ev->key() != Qt::Key_Up && ev->key() != Qt::Key_Down) { if (ev->key() != Qt::Key_Up && ev->key() != Qt::Key_Down)
currType = NEW_DIVE_SITE;
currDs = RECENTLY_ADDED_DIVESITE; currDs = RECENTLY_ADDED_DIVESITE;
} else { else
showPopup(); showPopup();
}
} else if (ev->key() == Qt::Key_Escape) { } else if (ev->key() == Qt::Key_Escape) {
view->hide(); view->hide();
} }
@ -561,12 +553,10 @@ void DiveLocationLineEdit::setCurrentDiveSite(struct dive *d)
{ {
struct dive_site *ds = get_dive_site_for_dive(d); struct dive_site *ds = get_dive_site_for_dive(d);
currDs = ds; currDs = ds;
if (!currDs) { if (!currDs)
currType = NO_DIVE_SITE;
clear(); clear();
} else { else
setText(ds->name); setText(ds->name);
}
location_t currentLocation = d ? dive_get_gps_location(d) : location_t{0, 0}; location_t currentLocation = d ? dive_get_gps_location(d) : location_t{0, 0};
proxy->setCurrentLocation(currentLocation); proxy->setCurrentLocation(currentLocation);
@ -593,11 +583,6 @@ void DiveLocationLineEdit::showAllSites()
} }
} }
DiveLocationLineEdit::DiveSiteType DiveLocationLineEdit::currDiveSiteType() const
{
return currType;
}
struct dive_site *DiveLocationLineEdit::currDiveSite() const struct dive_site *DiveLocationLineEdit::currDiveSite() const
{ {
// If there is no text, this corresponds to the empty dive site // If there is no text, this corresponds to the empty dive site

View file

@ -83,13 +83,11 @@ signals:
class DiveLocationLineEdit : public QLineEdit { class DiveLocationLineEdit : public QLineEdit {
Q_OBJECT Q_OBJECT
public: public:
enum DiveSiteType { NO_DIVE_SITE, NEW_DIVE_SITE, EXISTING_DIVE_SITE };
DiveLocationLineEdit(QWidget *parent =0 ); DiveLocationLineEdit(QWidget *parent =0 );
void refreshDiveSiteCache(); void refreshDiveSiteCache();
void setTemporaryDiveSiteName(const QString& s); void setTemporaryDiveSiteName(const QString& s);
bool eventFilter(QObject*, QEvent*); bool eventFilter(QObject*, QEvent*);
void itemActivated(const QModelIndex& index); void itemActivated(const QModelIndex& index);
DiveSiteType currDiveSiteType() const;
struct dive_site *currDiveSite() const; struct dive_site *currDiveSite() const;
void fixPopupPosition(); void fixPopupPosition();
void setCurrentDiveSite(struct dive *d); void setCurrentDiveSite(struct dive *d);
@ -111,7 +109,6 @@ private:
DiveLocationModel *model; DiveLocationModel *model;
DiveLocationListView *view; DiveLocationListView *view;
LocationFilterDelegate delegate; LocationFilterDelegate delegate;
DiveSiteType currType;
struct dive_site *currDs; struct dive_site *currDs;
}; };