mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
PrintDialog class cleanup.
* Remove static PrintDialog::instance() method * Remove void PrintDialog::runDialog() method * construct/destruct print dialog on demand Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3086741d49
commit
02e9a6d07b
3 changed files with 5 additions and 17 deletions
|
@ -211,7 +211,9 @@ void MainWindow::on_actionExportUDDF_triggered()
|
||||||
|
|
||||||
void MainWindow::on_actionPrint_triggered()
|
void MainWindow::on_actionPrint_triggered()
|
||||||
{
|
{
|
||||||
PrintDialog::instance()->runDialog();
|
PrintDialog dlg(this);
|
||||||
|
|
||||||
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::disableDcShortcuts()
|
void MainWindow::disableDcShortcuts()
|
||||||
|
|
|
@ -11,13 +11,6 @@
|
||||||
#include <QPrintPreviewDialog>
|
#include <QPrintPreviewDialog>
|
||||||
#include <QPrintDialog>
|
#include <QPrintDialog>
|
||||||
|
|
||||||
PrintDialog *PrintDialog::instance()
|
|
||||||
{
|
|
||||||
static PrintDialog *self = new PrintDialog(mainWindow());
|
|
||||||
self->setAttribute(Qt::WA_QuitOnClose, false);
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f)
|
PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f)
|
||||||
{
|
{
|
||||||
// options template (are we storing these in the settings?)
|
// options template (are we storing these in the settings?)
|
||||||
|
@ -52,6 +45,7 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f)
|
||||||
connect(printLayout, SIGNAL(signalProgress(int)), progressBar, SLOT(setValue(int)));
|
connect(printLayout, SIGNAL(signalProgress(int)), progressBar, SLOT(setValue(int)));
|
||||||
progressBar->setMinimum(0);
|
progressBar->setMinimum(0);
|
||||||
progressBar->setMaximum(100);
|
progressBar->setMaximum(100);
|
||||||
|
progressBar->setValue(0);
|
||||||
progressBar->setTextVisible(false);
|
progressBar->setTextVisible(false);
|
||||||
layout->addWidget(progressBar);
|
layout->addWidget(progressBar);
|
||||||
|
|
||||||
|
@ -62,12 +56,6 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f)
|
||||||
setWindowIcon(QIcon(":subsurface-icon"));
|
setWindowIcon(QIcon(":subsurface-icon"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintDialog::runDialog()
|
|
||||||
{
|
|
||||||
progressBar->setValue(0);
|
|
||||||
exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrintDialog::previewClicked(void)
|
void PrintDialog::previewClicked(void)
|
||||||
{
|
{
|
||||||
QPrintPreviewDialog previewDialog(&printer, this);
|
QPrintPreviewDialog previewDialog(&printer, this);
|
||||||
|
|
|
@ -14,12 +14,10 @@ class PrintDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static PrintDialog *instance();
|
|
||||||
void runDialog();
|
|
||||||
struct options printOptions;
|
struct options printOptions;
|
||||||
|
explicit PrintDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit PrintDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
|
||||||
PrintOptions *optionsWidget;
|
PrintOptions *optionsWidget;
|
||||||
PrintLayout *printLayout;
|
PrintLayout *printLayout;
|
||||||
QProgressBar *progressBar;
|
QProgressBar *progressBar;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue