aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-09-23 14:57:55 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-23 14:15:49 -0700
commitd586970f3145106d444af8c54651af6563b92a66 (patch)
tree9fb9f6a6f667c638421060a5335813032fd1cfb9 /qt-ui
parente4c0ee32cdcd8487dd88e40fef3ba5de6fa92704 (diff)
downloadsubsurface-d586970f3145106d444af8c54651af6563b92a66.tar.gz
Removed a ton of dead code
Unused dead code / hack for the old QCompleter Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/locationinformation.cpp55
-rw-r--r--qt-ui/locationinformation.h15
-rw-r--r--qt-ui/maintab.cpp38
-rw-r--r--qt-ui/maintab.h3
4 files changed, 2 insertions, 109 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index 77adc819b..3b3e02b12 100644
--- a/qt-ui/locationinformation.cpp
+++ b/qt-ui/locationinformation.cpp
@@ -259,61 +259,6 @@ void LocationInformationWidget::resetPallete()
ui.diveSiteNotes->setPalette(p);
}
-bool LocationManagementEditHelper::eventFilter(QObject *obj, QEvent *ev)
-{
- QListView *view = qobject_cast<QListView*>(obj);
- if(!view)
- return false;
-
- if(ev->type() == QEvent::Show) {
- last_uuid = 0;
- qDebug() << "EventFilter: " << last_uuid;
- }
-
- if(ev->type() == QEvent::KeyPress) {
- QKeyEvent *keyEv = (QKeyEvent*) ev;
- if(keyEv->key() == Qt::Key_Return) {
- handleActivation(view->currentIndex());
- view->hide();
- return true;
- }
- }
- return false;
-}
-
-void LocationManagementEditHelper::handleActivation(const QModelIndex& activated)
-{
- if (!activated.isValid())
- return;
- QModelIndex uuidIdx = activated.model()->index(
- activated.row(), LocationInformationModel::UUID);
- last_uuid = uuidIdx.data().toInt();
-
- /* if we are in 'recently added divesite mode, create a new divesite,
- * and go to dive site edit edit mode. */
- if (last_uuid == RECENTLY_ADDED_DIVESITE) {
- uint32_t ds_uuid = create_dive_site_from_current_dive(qPrintable(activated.data().toString()));
- qDebug() << "ds_uuid" << ds_uuid;
- struct dive_site *ds = get_dive_site_by_uuid(ds_uuid);
- copy_dive_site(ds, &displayed_dive_site);
- displayed_dive.dive_site_uuid = ds->uuid;
- last_uuid = ds->uuid;
- // Move this out of here later.
- MainWindow::instance()->startDiveSiteEdit();
- }
-
- qDebug() << "Selected dive_site: " << last_uuid;
-}
-
-void LocationManagementEditHelper::resetDiveSiteUuid() {
- last_uuid = 0;
- qDebug() << "Reset: " << last_uuid;
-}
-
-uint32_t LocationManagementEditHelper::diveSiteUuid() const {
- return last_uuid;
-}
-
void LocationInformationWidget::reverseGeocode()
{
ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h
index db0d286ac..db6809015 100644
--- a/qt-ui/locationinformation.h
+++ b/qt-ui/locationinformation.h
@@ -46,19 +46,6 @@ private:
QAction *closeAction, *acceptAction, *rejectAction;
};
-class LocationManagementEditHelper : public QObject {
-Q_OBJECT
-public:
- bool eventFilter(QObject *obj, QEvent *ev);
- void handleActivation(const QModelIndex& activated);
- void resetDiveSiteUuid();
- uint32_t diveSiteUuid() const;
-signals:
- void setLineEditText(const QString& text);
-private:
- uint32_t last_uuid;
-};
-
class DiveLocationFilterProxyModel : public QSortFilterProxyModel {
Q_OBJECT
public:
@@ -96,7 +83,6 @@ public:
void setTemporaryDiveSiteName(const QString& s);
bool eventFilter(QObject*, QEvent*);
void itemActivated(const QModelIndex& index);
-
DiveSiteType currDiveSiteType() const;
uint32_t currDiveSiteUuid() const;
@@ -107,6 +93,7 @@ protected:
void keyPressEvent(QKeyEvent *ev);
void focusOutEvent(QFocusEvent *ev);
void showPopup();
+
private:
DiveLocationFilterProxyModel *proxy;
DiveLocationModel *model;
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index a68adb5bf..8dca49eee 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -195,7 +195,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
connect(ReverseGeoLookupThread::instance(), &QThread::finished,
this, &MainTab::setCurrentLocationIndex);
- ui.location->installEventFilter(this);
acceptingEdit = false;
}
@@ -210,33 +209,6 @@ MainTab::~MainTab()
}
}
-bool MainTab::eventFilter(QObject *obj, QEvent *ev)
-{
- QMoveEvent *mEv;
- QResizeEvent *rEv;
- QLineEdit *line = qobject_cast<QLineEdit*>(obj);
-
- if (ev->type() == QEvent::MouseMove || ev->type() == QEvent::HoverMove || ev->type() == QEvent::Paint)
- return false;
-
- if (line) {
- if (ev->type() == QEvent::Resize) {
- /*if (line->completer()->popup()->isVisible()) {
- QListView *choices = qobject_cast<QListView*>(line->completer()->popup());
- QPoint p = ui.location->mapToGlobal(ui.location->pos());
- choices->setGeometry(
- choices->geometry().x(),
- p.y() + 3,
- choices->geometry().width(),
- choices->geometry().height());
-
- }
- */
- }
- }
- return false;
-}
-
void MainTab::setCurrentLocationIndex()
{
if (current_dive) {
@@ -318,12 +290,6 @@ void MainTab::displayMessage(QString str)
ui.diveStatisticsMessage->setText(str);
ui.diveStatisticsMessage->animatedShow();
updateTextLabels();
-
-// TODO: this doesn't exists anymore. Find out why it was removed from
-// the KMessageWidget and try to see if this is still needed.
-// ui.tagWidget->fixPopupPosition(ui.diveNotesMessage->bestContentHeight());
-// ui.buddy->fixPopupPosition(ui.diveNotesMessage->bestContentHeight());
-// ui.divemaster->fixPopupPosition(ui.diveNotesMessage->bestContentHeight());
}
void MainTab::updateTextLabels(bool showUnits)
@@ -377,7 +343,6 @@ void MainTab::enableEdition(EditMode newEditMode)
displayMessage(tr("Multiple dives are being edited."));
} else {
displayMessage(tr("This dive is being edited."));
- //locationManagementEditHelper->resetDiveSiteUuid();
}
editMode = newEditMode != NONE ? newEditMode : DIVE;
}
@@ -844,7 +809,6 @@ void MainTab::updateDisplayedDiveSite()
const uint32_t orig_uuid = displayed_dive_site.uuid;
//TODO: FIX THIS
const uint32_t new_uuid = orig_uuid;
- // locationManagementEditHelper->diveSiteUuid();
qDebug() << "Updating Displayed Dive Site";
@@ -891,7 +855,7 @@ void MainTab::updateDiveSite(int divenr)
return;
const uint32_t newUuid = displayed_dive_site.uuid;
- const uint32_t pickedUuid = locationManagementEditHelper->diveSiteUuid();
+ const uint32_t pickedUuid = ui.location->currDiveSiteUuid();
const QString newName = displayed_dive_site.name;
const uint32_t origUuid = cd->dive_site_uuid;
struct dive_site *origDs = get_dive_site_by_uuid(origUuid);
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index a071e6c88..502ea6910 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -22,7 +22,6 @@ class CylindersModel;
class ExtraDataModel;
class DivePictureModel;
class QCompleter;
-class LocationManagementEditHelper;
struct Completers {
QCompleter *divemaster;
@@ -55,7 +54,6 @@ public:
void refreshDisplayedDiveSite();
void nextInputField(QKeyEvent *event);
void showAndTriggerEditSelective(struct dive_components what);
- virtual bool eventFilter(QObject*, QEvent*);
signals:
void addDiveFinished();
@@ -124,7 +122,6 @@ private:
dive_trip_t *currentTrip;
dive_trip_t displayedTrip;
bool acceptingEdit;
- LocationManagementEditHelper *locationManagementEditHelper;
void updateDisplayedDiveSite();
void updateDiveSite(int divenr);
};