Skip to content

Commit

Permalink
fix #15 - window position in multi-screen environment
Browse files Browse the repository at this point in the history
  • Loading branch information
krzemin committed Aug 8, 2015
1 parent f6ebb09 commit de1498c
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 26 deletions.
6 changes: 3 additions & 3 deletions src/forms/frmabout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ frmAbout::frmAbout(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)
setAttribute(Qt::WA_QuitOnClose, false);
ui.lbTitle->setText(QString("QNapi ") + QNAPI_DISPLAYABLE_VERSION);

// workaround dla compiza?
move((QApplication::desktop()->width() - width()) / 2,
(QApplication::desktop()->height() - height()) / 2);
QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}
6 changes: 3 additions & 3 deletions src/forms/frmcorrect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ frmCorrect::frmCorrect(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)
connect(&postThread, SIGNAL(postFinished(bool)), this, SLOT(postFinished(bool)));
connect(&postThread, SIGNAL(invalidUserPass()), this, SLOT(invalidUserPass()));

// workaround dla compiza?
move((QApplication::desktop()->width() - width()) / 2,
(QApplication::desktop()->height() - height()) / 2);
QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}

void frmCorrect::closeEvent(QCloseEvent *event)
Expand Down
6 changes: 3 additions & 3 deletions src/forms/frmlistsubtitles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ frmListSubtitles::frmListSubtitles(QWidget *parent, Qt::WindowFlags f)
{
ui.setupUi(this);

// workaround dla compiza?
move((QApplication::desktop()->width() - width()) / 2,
(QApplication::desktop()->height() - height()) / 2);
QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}

void frmListSubtitles::setFileName(const QString & name)
Expand Down
4 changes: 4 additions & 0 deletions src/forms/frmnapiprojektconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ frmNapiProjektConfig::frmNapiProjektConfig(QWidget *parent, Qt::WindowFlags f)
load();

connect(ui.pbRegister, SIGNAL(clicked()), this, SLOT(pbRegisterClicked()));

QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}

void frmNapiProjektConfig::accept()
Expand Down
4 changes: 4 additions & 0 deletions src/forms/frmopensubtitlesconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ frmOpenSubtitlesConfig::frmOpenSubtitlesConfig(QWidget *parent, Qt::WindowFlags
load();

connect(ui.pbRegister, SIGNAL(clicked()), this, SLOT(pbRegisterClicked()));

QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}

void frmOpenSubtitlesConfig::accept()
Expand Down
6 changes: 3 additions & 3 deletions src/forms/frmoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ frmOptions::frmOptions(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)

showAllEncodings();

// workaround dla compiza?
move((QApplication::desktop()->width() - width()) / 2,
(QApplication::desktop()->height() - height()) / 2);
QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}

frmOptions::~frmOptions()
Expand Down
9 changes: 7 additions & 2 deletions src/forms/frmprogress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ frmProgress::frmProgress(QWidget * parent, Qt::WindowFlags f)
&getThread, SLOT(subtitlesSelected(int)));
connect(&getThread, SIGNAL(finished()),
this, SLOT(downloadFinished()));

QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}

void frmProgress::receiveRequest(const QString & request)
Expand Down Expand Up @@ -99,8 +103,9 @@ bool frmProgress::download()

if(!isVisible())
{
move((QApplication::desktop()->width() - width()) / 2,
(QApplication::desktop()->height() - height()) / 2);
QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
show();
}

Expand Down
6 changes: 3 additions & 3 deletions src/forms/frmreport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ frmReport::frmReport(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)
ui.cbProblem->setCurrentIndex(4);
cbProblemChanged();

// workaround dla compiza?
move((QApplication::desktop()->width() - width()) / 2,
(QApplication::desktop()->height() - height()) / 2);
QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}

void frmReport::closeEvent(QCloseEvent *event)
Expand Down
6 changes: 3 additions & 3 deletions src/forms/frmscan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ frmScan::frmScan(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)

iconFilm = QIcon(":/ui/film.png");

// workaround dla compiza?
move((QApplication::desktop()->width() - width()) / 2,
(QApplication::desktop()->height() - height()) / 2);
QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}

frmScan::~frmScan()
Expand Down
6 changes: 3 additions & 3 deletions src/forms/frmsummary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ frmSummary::frmSummary(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)

setAttribute(Qt::WA_QuitOnClose, false);

// workaround dla compiza?
move((QApplication::desktop()->width() - width()) / 2,
(QApplication::desktop()->height() - height()) / 2);
QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}

void frmSummary::setSummaryList(const QStringList & listSuccess, const QStringList & listFailures)
Expand Down
6 changes: 3 additions & 3 deletions src/forms/frmupload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ frmUpload::frmUpload(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)
if(QFileInfo(GlobalConfig().previousDialogPath()).isDir())
ui.leSelectDirectory->setText(GlobalConfig().previousDialogPath());

// workaround dla compiza?
move((QApplication::desktop()->width() - width()) / 2,
(QApplication::desktop()->height() - height()) / 2);
QRect position = frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
}

void frmUpload::closeEvent(QCloseEvent *event)
Expand Down

0 comments on commit de1498c

Please sign in to comment.