[Libreoffice-commits] core.git: sc/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 1 15:46:59 UTC 2019
sc/source/ui/inc/optsolver.hxx | 7 ++----
sc/source/ui/miscdlgs/optsolver.cxx | 37 ++++++++++++++----------------------
2 files changed, 18 insertions(+), 26 deletions(-)
New commits:
commit 7de7e8ecb5d53d219e47dccf9b1b767852b215e2
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Apr 1 14:57:37 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Apr 1 17:46:33 2019 +0200
weld ScSolverProgressDialog
Change-Id: I5ee081b1c9e542a2b717b4eb27ee0aba7331d57d
Reviewed-on: https://gerrit.libreoffice.org/70071
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/ui/inc/optsolver.hxx b/sc/source/ui/inc/optsolver.hxx
index eae17564ada3..21b2b5c3ba6e 100644
--- a/sc/source/ui/inc/optsolver.hxx
+++ b/sc/source/ui/inc/optsolver.hxx
@@ -199,14 +199,13 @@ private:
DECL_LINK( SelectHdl, ListBox&, void );
};
-class ScSolverProgressDialog : public ModelessDialog
+class ScSolverProgressDialog : public weld::GenericDialogController
{
- VclPtr<FixedText> m_pFtTime;
+ std::unique_ptr<weld::Label> m_xFtTime;
public:
- ScSolverProgressDialog( vcl::Window* pParent );
+ ScSolverProgressDialog(weld::Window* pParent);
virtual ~ScSolverProgressDialog() override;
- virtual void dispose() override;
void HideTimeLimit();
void SetTimeLimit( sal_Int32 nSeconds );
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index 239591ac28ba..4fd377d87b47 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -45,35 +45,27 @@
using namespace com::sun::star;
-ScSolverProgressDialog::ScSolverProgressDialog(vcl::Window* pParent)
- : ModelessDialog(pParent, "SolverProgressDialog",
- "modules/scalc/ui/solverprogressdialog.ui")
+ScSolverProgressDialog::ScSolverProgressDialog(weld::Window* pParent)
+ : GenericDialogController(pParent, "modules/scalc/ui/solverprogressdialog.ui",
+ "SolverProgressDialog")
+ , m_xFtTime(m_xBuilder->weld_label("progress"))
{
- get(m_pFtTime, "progress");
}
ScSolverProgressDialog::~ScSolverProgressDialog()
{
- disposeOnce();
-}
-
-void ScSolverProgressDialog::dispose()
-{
- m_pFtTime.clear();
- ModelessDialog::dispose();
}
-
void ScSolverProgressDialog::HideTimeLimit()
{
- m_pFtTime->Hide();
+ m_xFtTime->hide();
}
void ScSolverProgressDialog::SetTimeLimit( sal_Int32 nSeconds )
{
- OUString aOld = m_pFtTime->GetText();
+ OUString aOld = m_xFtTime->get_label();
OUString aNew = aOld.replaceFirst("#", OUString::number(nSeconds));
- m_pFtTime->SetText( aNew );
+ m_xFtTime->set_label(aNew);
}
ScSolverNoSolutionDialog::ScSolverNoSolutionDialog(weld::Window* pParent, const OUString& rErrorText)
@@ -811,15 +803,15 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
{
// show progress dialog
- ScopedVclPtrInstance< ScSolverProgressDialog > aProgress( this );
+ std::shared_ptr<ScSolverProgressDialog> xProgress(new ScSolverProgressDialog(GetFrameWeld()));
sal_Int32 nTimeout = 0;
if ( FindTimeout( nTimeout ) )
- aProgress->SetTimeLimit( nTimeout );
+ xProgress->SetTimeLimit( nTimeout );
else
- aProgress->HideTimeLimit();
- aProgress->Show();
- aProgress->Update();
- aProgress->Flush();
+ xProgress->HideTimeLimit();
+
+ weld::DialogController::runAsync(xProgress, [](sal_Int32 /*nResult*/){});
+
// try to make sure the progress dialog is painted before continuing
Application::Reschedule(true);
@@ -1009,7 +1001,8 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
xSolver->solve();
bool bSuccess = xSolver->getSuccess();
- aProgress->Hide();
+ xProgress->response(RET_CLOSE);
+
bool bClose = false;
bool bRestore = true; // restore old values unless a solution is accepted
if ( bSuccess )
More information about the Libreoffice-commits
mailing list