diff options
Diffstat (limited to 'src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp')
-rw-r--r-- | src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp | 82 |
1 files changed, 39 insertions, 43 deletions
diff --git a/src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp b/src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp index 7ce07e8..76483de 100644 --- a/src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp +++ b/src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp @@ -23,62 +23,58 @@ namespace Search { -static const int DIALOG_HEIGHT=400; -static const int DIALOG_BORDER=30; +static const int DIALOG_HEIGHT = 400; +static const int DIALOG_BORDER = 30; CSearchAnalysisDialog::CSearchAnalysisDialog( QList<CSwordModuleInfo*> modules, QWidget* parentDialog ) - : QDialog(parentDialog) -{ - initView(); - m_analysis->reset(); - m_analysis->analyse(modules); - - // Set initial width based on the search data, but limit to the - // width of the desktop - int width = (int)( m_analysis->width()+DIALOG_BORDER ); - int desktopWidth = QApplication::desktop()->screenGeometry(this).width(); - if (width > desktopWidth) - width = desktopWidth; - resize(width, DIALOG_HEIGHT); + : QDialog(parentDialog) { + initView(); + m_analysis->reset(); + m_analysis->analyse(modules); + + // Set initial width based on the search data, but limit to the + // width of the desktop + int width = (int)( m_analysis->width() + DIALOG_BORDER ); + int desktopWidth = QApplication::desktop()->screenGeometry(this).width(); + if (width > desktopWidth) + width = desktopWidth; + resize(width, DIALOG_HEIGHT); } /** Initializes this dialog. */ -void CSearchAnalysisDialog::initView() -{ +void CSearchAnalysisDialog::initView() { - QVBoxLayout *vboxLayout = new QVBoxLayout(this); + QVBoxLayout *vboxLayout = new QVBoxLayout(this); - m_analysis = new CSearchAnalysisScene(this); - m_analysisView = new CSearchAnalysisView(m_analysis, this); + m_analysis = new CSearchAnalysisScene(this); + m_analysisView = new CSearchAnalysisView(m_analysis, this); //// m_analysisView->show(); - vboxLayout->addWidget(m_analysisView); - - m_buttonBox = new QDialogButtonBox(this); - m_buttonBox->setOrientation(Qt::Horizontal); - m_buttonBox->setStandardButtons(QDialogButtonBox::Close); - m_buttonBox->addButton(QDialogButtonBox::Save); - //tr("Save as HTML"), - util::prepareDialogBox(m_buttonBox); - vboxLayout->addWidget(m_buttonBox); - - bool ok = QObject::connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - Q_ASSERT(ok); - ok = QObject::connect(m_buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); - Q_ASSERT(ok); + vboxLayout->addWidget(m_analysisView); + + m_buttonBox = new QDialogButtonBox(this); + m_buttonBox->setOrientation(Qt::Horizontal); + m_buttonBox->setStandardButtons(QDialogButtonBox::Close); + m_buttonBox->addButton(QDialogButtonBox::Save); + //tr("Save as HTML"), + util::prepareDialogBox(m_buttonBox); + vboxLayout->addWidget(m_buttonBox); + + bool ok = QObject::connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + Q_ASSERT(ok); + ok = QObject::connect(m_buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); + Q_ASSERT(ok); } -void CSearchAnalysisDialog::buttonClicked(QAbstractButton* button) -{ - if (m_buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) { - m_analysis->saveAsHTML(); - } +void CSearchAnalysisDialog::buttonClicked(QAbstractButton* button) { + if (m_buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) { + m_analysis->saveAsHTML(); + } } -void CSearchAnalysisDialog::resizeEvent(QResizeEvent* event) -{ - QDialog::resizeEvent(event); - m_analysis->resizeHeight(height()); +void CSearchAnalysisDialog::resizeEvent(QResizeEvent* event) { + QDialog::resizeEvent(event); + m_analysis->resizeHeight(height()); } } |