mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Merge branch 'chooseEditMode' of https://github.com/tcanabrava/subsurface
This commit is contained in:
commit
ae05498d94
2 changed files with 51 additions and 0 deletions
|
@ -27,7 +27,26 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
||||||
ui->weights->setModel(weightModel);
|
ui->weights->setModel(weightModel);
|
||||||
ui->diveNotesMessage->hide();
|
ui->diveNotesMessage->hide();
|
||||||
ui->diveNotesMessage->setCloseButtonVisible(false);
|
ui->diveNotesMessage->setCloseButtonVisible(false);
|
||||||
|
|
||||||
|
#if EDIT_STYLE
|
||||||
ui->rating->setReadOnly(true);
|
ui->rating->setReadOnly(true);
|
||||||
|
#else
|
||||||
|
ui->location->setReadOnly(false);
|
||||||
|
ui->divemaster->setReadOnly(false);
|
||||||
|
ui->buddy->setReadOnly(false);
|
||||||
|
ui->suit->setReadOnly(false);
|
||||||
|
ui->notes->setReadOnly(false);
|
||||||
|
ui->rating->setReadOnly(false);
|
||||||
|
ui->editNotes->hide();
|
||||||
|
ui->resetNotes->hide();
|
||||||
|
|
||||||
|
ui->location->installEventFilter(this);
|
||||||
|
ui->divemaster->installEventFilter(this);
|
||||||
|
ui->buddy->installEventFilter(this);
|
||||||
|
ui->suit->installEventFilter(this);
|
||||||
|
ui->notes->installEventFilter(this);
|
||||||
|
ui->rating->installEventFilter(this);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* example of where code is more concise than Qt designer */
|
/* example of where code is more concise than Qt designer */
|
||||||
QList<QObject *> infoTabWidgets = ui->infoTab->children();
|
QList<QObject *> infoTabWidgets = ui->infoTab->children();
|
||||||
|
@ -44,6 +63,20 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainTab::eventFilter(QObject* object, QEvent* event)
|
||||||
|
{
|
||||||
|
if(event->type() == QEvent::FocusIn){
|
||||||
|
if (ui->editNotes->isVisible()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ui->editNotes->setChecked(true);
|
||||||
|
ui->editNotes->show();
|
||||||
|
ui->resetNotes->show();
|
||||||
|
on_editNotes_clicked(true);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void MainTab::clearEquipment()
|
void MainTab::clearEquipment()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -245,6 +278,13 @@ void MainTab::on_editNotes_clicked(bool edit)
|
||||||
ui->diveNotesMessage->animatedHide();
|
ui->diveNotesMessage->animatedHide();
|
||||||
ui->editNotes->setText(tr("edit"));
|
ui->editNotes->setText(tr("edit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !EDIT_STYLE
|
||||||
|
if(!edit){
|
||||||
|
ui->editNotes->hide();
|
||||||
|
ui->resetNotes->hide();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTab::on_resetNotes_clicked()
|
void MainTab::on_resetNotes_clicked()
|
||||||
|
@ -269,6 +309,11 @@ void MainTab::on_resetNotes_clicked()
|
||||||
ui->notes->setReadOnly(true);
|
ui->notes->setReadOnly(true);
|
||||||
ui->rating->setReadOnly(true);
|
ui->rating->setReadOnly(true);
|
||||||
mainWindow()->dive_list()->setEnabled(true);
|
mainWindow()->dive_list()->setEnabled(true);
|
||||||
|
|
||||||
|
#if !EDIT_STYLE
|
||||||
|
ui->editCylinder->hide();
|
||||||
|
ui->resetNotes->hide();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EDIT_NOTES(what, text) \
|
#define EDIT_NOTES(what, text) \
|
||||||
|
|
|
@ -26,6 +26,10 @@ struct NotesBackup{
|
||||||
QString divemaster;
|
QString divemaster;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DIRK_EDIT_STYLE 0
|
||||||
|
#define TEST_EDIT_STYLE 1
|
||||||
|
#define EDIT_STYLE DIRK_EDIT_STYLE
|
||||||
|
|
||||||
class MainTab : public QTabWidget
|
class MainTab : public QTabWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -36,6 +40,8 @@ public:
|
||||||
void clearEquipment();
|
void clearEquipment();
|
||||||
void reload();
|
void reload();
|
||||||
|
|
||||||
|
bool eventFilter(QObject* , QEvent*);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void on_addCylinder_clicked();
|
void on_addCylinder_clicked();
|
||||||
void on_editCylinder_clicked();
|
void on_editCylinder_clicked();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue