mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
e4c0ee32cd
commit
d586970f31
4 changed files with 2 additions and 109 deletions
|
@ -259,61 +259,6 @@ void LocationInformationWidget::resetPallete()
|
||||||
ui.diveSiteNotes->setPalette(p);
|
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()
|
void LocationInformationWidget::reverseGeocode()
|
||||||
{
|
{
|
||||||
ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
|
ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
|
||||||
|
|
|
@ -46,19 +46,6 @@ private:
|
||||||
QAction *closeAction, *acceptAction, *rejectAction;
|
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 {
|
class DiveLocationFilterProxyModel : public QSortFilterProxyModel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -96,7 +83,6 @@ public:
|
||||||
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;
|
DiveSiteType currDiveSiteType() const;
|
||||||
uint32_t currDiveSiteUuid() const;
|
uint32_t currDiveSiteUuid() const;
|
||||||
|
|
||||||
|
@ -107,6 +93,7 @@ protected:
|
||||||
void keyPressEvent(QKeyEvent *ev);
|
void keyPressEvent(QKeyEvent *ev);
|
||||||
void focusOutEvent(QFocusEvent *ev);
|
void focusOutEvent(QFocusEvent *ev);
|
||||||
void showPopup();
|
void showPopup();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DiveLocationFilterProxyModel *proxy;
|
DiveLocationFilterProxyModel *proxy;
|
||||||
DiveLocationModel *model;
|
DiveLocationModel *model;
|
||||||
|
|
|
@ -195,7 +195,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
||||||
connect(ReverseGeoLookupThread::instance(), &QThread::finished,
|
connect(ReverseGeoLookupThread::instance(), &QThread::finished,
|
||||||
this, &MainTab::setCurrentLocationIndex);
|
this, &MainTab::setCurrentLocationIndex);
|
||||||
|
|
||||||
ui.location->installEventFilter(this);
|
|
||||||
acceptingEdit = false;
|
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()
|
void MainTab::setCurrentLocationIndex()
|
||||||
{
|
{
|
||||||
if (current_dive) {
|
if (current_dive) {
|
||||||
|
@ -318,12 +290,6 @@ void MainTab::displayMessage(QString str)
|
||||||
ui.diveStatisticsMessage->setText(str);
|
ui.diveStatisticsMessage->setText(str);
|
||||||
ui.diveStatisticsMessage->animatedShow();
|
ui.diveStatisticsMessage->animatedShow();
|
||||||
updateTextLabels();
|
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)
|
void MainTab::updateTextLabels(bool showUnits)
|
||||||
|
@ -377,7 +343,6 @@ void MainTab::enableEdition(EditMode newEditMode)
|
||||||
displayMessage(tr("Multiple dives are being edited."));
|
displayMessage(tr("Multiple dives are being edited."));
|
||||||
} else {
|
} else {
|
||||||
displayMessage(tr("This dive is being edited."));
|
displayMessage(tr("This dive is being edited."));
|
||||||
//locationManagementEditHelper->resetDiveSiteUuid();
|
|
||||||
}
|
}
|
||||||
editMode = newEditMode != NONE ? newEditMode : DIVE;
|
editMode = newEditMode != NONE ? newEditMode : DIVE;
|
||||||
}
|
}
|
||||||
|
@ -844,7 +809,6 @@ void MainTab::updateDisplayedDiveSite()
|
||||||
const uint32_t orig_uuid = displayed_dive_site.uuid;
|
const uint32_t orig_uuid = displayed_dive_site.uuid;
|
||||||
//TODO: FIX THIS
|
//TODO: FIX THIS
|
||||||
const uint32_t new_uuid = orig_uuid;
|
const uint32_t new_uuid = orig_uuid;
|
||||||
// locationManagementEditHelper->diveSiteUuid();
|
|
||||||
|
|
||||||
qDebug() << "Updating Displayed Dive Site";
|
qDebug() << "Updating Displayed Dive Site";
|
||||||
|
|
||||||
|
@ -891,7 +855,7 @@ void MainTab::updateDiveSite(int divenr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const uint32_t newUuid = displayed_dive_site.uuid;
|
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 QString newName = displayed_dive_site.name;
|
||||||
const uint32_t origUuid = cd->dive_site_uuid;
|
const uint32_t origUuid = cd->dive_site_uuid;
|
||||||
struct dive_site *origDs = get_dive_site_by_uuid(origUuid);
|
struct dive_site *origDs = get_dive_site_by_uuid(origUuid);
|
||||||
|
|
|
@ -22,7 +22,6 @@ class CylindersModel;
|
||||||
class ExtraDataModel;
|
class ExtraDataModel;
|
||||||
class DivePictureModel;
|
class DivePictureModel;
|
||||||
class QCompleter;
|
class QCompleter;
|
||||||
class LocationManagementEditHelper;
|
|
||||||
|
|
||||||
struct Completers {
|
struct Completers {
|
||||||
QCompleter *divemaster;
|
QCompleter *divemaster;
|
||||||
|
@ -55,7 +54,6 @@ public:
|
||||||
void refreshDisplayedDiveSite();
|
void refreshDisplayedDiveSite();
|
||||||
void nextInputField(QKeyEvent *event);
|
void nextInputField(QKeyEvent *event);
|
||||||
void showAndTriggerEditSelective(struct dive_components what);
|
void showAndTriggerEditSelective(struct dive_components what);
|
||||||
virtual bool eventFilter(QObject*, QEvent*);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void addDiveFinished();
|
void addDiveFinished();
|
||||||
|
@ -124,7 +122,6 @@ private:
|
||||||
dive_trip_t *currentTrip;
|
dive_trip_t *currentTrip;
|
||||||
dive_trip_t displayedTrip;
|
dive_trip_t displayedTrip;
|
||||||
bool acceptingEdit;
|
bool acceptingEdit;
|
||||||
LocationManagementEditHelper *locationManagementEditHelper;
|
|
||||||
void updateDisplayedDiveSite();
|
void updateDisplayedDiveSite();
|
||||||
void updateDiveSite(int divenr);
|
void updateDiveSite(int divenr);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue