mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-02 23:20:20 +00:00
ShiftImageTimesDialog class cleanup.
* Remove static ShiftImageTimesDialog::instance() method * Add ShiftImageTimesDialog::amount() member Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
449c6fc6f2
commit
aeaa050306
3 changed files with 14 additions and 14 deletions
|
@ -813,8 +813,8 @@ void DiveListView::loadImages()
|
||||||
|
|
||||||
updateLastUsedImageDir(QFileInfo(fileNames[0]).dir().path());
|
updateLastUsedImageDir(QFileInfo(fileNames[0]).dir().path());
|
||||||
|
|
||||||
ShiftImageTimesDialog* shiftDialog = ShiftImageTimesDialog::instance();
|
ShiftImageTimesDialog shiftDialog(this);
|
||||||
shiftDialog->exec();
|
shiftDialog.exec();
|
||||||
|
|
||||||
for (int i = 0; i < fileNames.size(); ++i) {
|
for (int i = 0; i < fileNames.size(); ++i) {
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
@ -829,7 +829,7 @@ void DiveListView::loadImages()
|
||||||
tm.tm_hour = hour;
|
tm.tm_hour = hour;
|
||||||
tm.tm_min = min;
|
tm.tm_min = min;
|
||||||
tm.tm_sec = sec;
|
tm.tm_sec = sec;
|
||||||
imagetime = utc_mktime(&tm) + shiftDialog->amount;
|
imagetime = utc_mktime(&tm) + shiftDialog.amount();
|
||||||
int j = 0;
|
int j = 0;
|
||||||
struct dive *dive;
|
struct dive *dive;
|
||||||
for_each_dive(j, dive){
|
for_each_dive(j, dive){
|
||||||
|
|
|
@ -156,27 +156,27 @@ ShiftTimesDialog::ShiftTimesDialog(QWidget *parent): QDialog(parent)
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
|
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
|
||||||
}
|
}
|
||||||
ShiftImageTimesDialog* ShiftImageTimesDialog::instance()
|
|
||||||
{
|
|
||||||
static ShiftImageTimesDialog* self = new ShiftImageTimesDialog(mainWindow());
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShiftImageTimesDialog::buttonClicked(QAbstractButton* button)
|
void ShiftImageTimesDialog::buttonClicked(QAbstractButton* button)
|
||||||
{
|
{
|
||||||
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
||||||
amount = ui.timeEdit->time().hour() * 3600 + ui.timeEdit->time().minute() * 60;
|
m_amount = ui.timeEdit->time().hour() * 3600 + ui.timeEdit->time().minute() * 60;
|
||||||
if (ui.backwards->isChecked())
|
if (ui.backwards->isChecked())
|
||||||
amount *= -1;
|
m_amount *= -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShiftImageTimesDialog::ShiftImageTimesDialog(QWidget *parent): QDialog(parent)
|
ShiftImageTimesDialog::ShiftImageTimesDialog(QWidget *parent): QDialog(parent), m_amount(0)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
|
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ShiftImageTimesDialog::amount() const
|
||||||
|
{
|
||||||
|
return m_amount;
|
||||||
|
}
|
||||||
|
|
||||||
bool isGnome3Session()
|
bool isGnome3Session()
|
||||||
{
|
{
|
||||||
#if defined(QT_OS_WIW) || defined(QT_OS_MAC)
|
#if defined(QT_OS_WIW) || defined(QT_OS_MAC)
|
||||||
|
|
|
@ -58,13 +58,13 @@ private:
|
||||||
class ShiftImageTimesDialog : public QDialog {
|
class ShiftImageTimesDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static ShiftImageTimesDialog *instance();
|
explicit ShiftImageTimesDialog(QWidget *parent);
|
||||||
int amount;
|
int amount() const;
|
||||||
private slots:
|
private slots:
|
||||||
void buttonClicked(QAbstractButton *button);
|
void buttonClicked(QAbstractButton *button);
|
||||||
private:
|
private:
|
||||||
explicit ShiftImageTimesDialog(QWidget *parent);
|
|
||||||
Ui::ShiftImageTimesDialog ui;
|
Ui::ShiftImageTimesDialog ui;
|
||||||
|
int m_amount;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool isGnome3Session();
|
bool isGnome3Session();
|
||||||
|
|
Loading…
Reference in a new issue