[Libreoffice-commits] core.git: sc/source sc/uiconfig
Caolán McNamara
caolanm at redhat.com
Tue May 15 11:25:52 UTC 2018
sc/source/ui/inc/optsolver.hxx | 13 +--
sc/source/ui/miscdlgs/optsolver.cxx | 39 ++++-------
sc/uiconfig/scalc/ui/solversuccessdialog.ui | 98 ++++++++++++++--------------
3 files changed, 73 insertions(+), 77 deletions(-)
New commits:
commit 932c96e158517bc1369d78e8180da4c04c214cff
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 15 09:22:13 2018 +0100
weld ScSolverSuccessDialog
Change-Id: I29bf7b59fbac8f969e5a61963d65b626ac03b0fa
Reviewed-on: https://gerrit.libreoffice.org/54355
Tested-by: Jenkins <ci at libreoffice.org>
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 4b7aabc6a56d..66b7132440dc 100644
--- a/sc/source/ui/inc/optsolver.hxx
+++ b/sc/source/ui/inc/optsolver.hxx
@@ -224,18 +224,17 @@ public:
virtual void dispose() override;
};
-class ScSolverSuccessDialog : public ModalDialog
+class ScSolverSuccessDialog : public weld::GenericDialogController
{
- VclPtr<FixedText> m_pFtResult;
- VclPtr<PushButton> m_pBtnOk;
- VclPtr<PushButton> m_pBtnCancel;
+ std::unique_ptr<weld::Label> m_xFtResult;
+ std::unique_ptr<weld::Button> m_xBtnOk;
+ std::unique_ptr<weld::Button> m_xBtnCancel;
- DECL_LINK(ClickHdl, Button*, void);
+ DECL_LINK(ClickHdl, weld::Button&, void);
public:
- ScSolverSuccessDialog( vcl::Window* pParent, const OUString& rSolution );
+ ScSolverSuccessDialog(weld::Window* pParent, const OUString& rSolution);
virtual ~ScSolverSuccessDialog() override;
- virtual void dispose() override;
};
#endif
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index 479262509a71..96eaf1fd8ccb 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -95,37 +95,28 @@ void ScSolverNoSolutionDialog::dispose()
ModalDialog::dispose();
}
-ScSolverSuccessDialog::ScSolverSuccessDialog( vcl::Window* pParent, const OUString& rSolution )
- : ModalDialog(pParent, "SolverSuccessDialog", "modules/scalc/ui/solversuccessdialog.ui")
+ScSolverSuccessDialog::ScSolverSuccessDialog(weld::Window* pParent, const OUString& rSolution)
+ : GenericDialogController(pParent, "modules/scalc/ui/solversuccessdialog.ui", "SolverSuccessDialog")
+ , m_xFtResult(m_xBuilder->weld_label("result"))
+ , m_xBtnOk(m_xBuilder->weld_button("ok"))
+ , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
{
- get(m_pFtResult, "result");
- get(m_pBtnOk, "ok");
- m_pBtnOk->SetClickHdl(LINK(this, ScSolverSuccessDialog, ClickHdl));
- get(m_pBtnCancel, "cancel");
- m_pBtnCancel->SetClickHdl(LINK(this, ScSolverSuccessDialog, ClickHdl));
- OUString aMessage = m_pFtResult->GetText() + " " + rSolution;
- m_pFtResult->SetText(aMessage);
+ m_xBtnOk->connect_clicked(LINK(this, ScSolverSuccessDialog, ClickHdl));
+ m_xBtnCancel->connect_clicked(LINK(this, ScSolverSuccessDialog, ClickHdl));
+ OUString aMessage = m_xFtResult->get_label() + " " + rSolution;
+ m_xFtResult->set_label(aMessage);
}
ScSolverSuccessDialog::~ScSolverSuccessDialog()
{
- disposeOnce();
-}
-
-void ScSolverSuccessDialog::dispose()
-{
- m_pFtResult.clear();
- m_pBtnOk.clear();
- m_pBtnCancel.clear();
- ModalDialog::dispose();
}
-IMPL_LINK( ScSolverSuccessDialog, ClickHdl, Button*, pBtn, void )
+IMPL_LINK(ScSolverSuccessDialog, ClickHdl, weld::Button&, rBtn, void)
{
- if (pBtn == m_pBtnOk)
- EndDialog(RET_OK);
+ if (&rBtn == m_xBtnOk.get())
+ m_xDialog->response(RET_OK);
else
- EndDialog();
+ m_xDialog->response(RET_CANCEL);
}
ScCursorRefEdit::ScCursorRefEdit( vcl::Window* pParent, vcl::Window *pLabel )
@@ -1054,8 +1045,8 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
static_cast<SCCOL>(aObjective.Column), static_cast<SCROW>(aObjective.Row),
static_cast<SCTAB>(aObjective.Sheet));
- ScopedVclPtrInstance< ScSolverSuccessDialog > aDialog( this, aResultStr );
- if ( aDialog->Execute() == RET_OK )
+ ScSolverSuccessDialog aDialog(GetFrameWeld(), aResultStr);
+ if (aDialog.run() == RET_OK)
{
// keep results and close dialog
bRestore = false;
diff --git a/sc/uiconfig/scalc/ui/solversuccessdialog.ui b/sc/uiconfig/scalc/ui/solversuccessdialog.ui
index 8939a2924ba5..3ab6093422fe 100644
--- a/sc/uiconfig/scalc/ui/solversuccessdialog.ui
+++ b/sc/uiconfig/scalc/ui/solversuccessdialog.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="SolverSuccessDialog">
@@ -7,12 +7,60 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="solversuccessdialog|SolverSuccessDialog">Solving Result</property>
<property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="default_width">0</property>
+ <property name="default_height">0</property>
<property name="type_hint">dialog</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="ok">
+ <property name="label" translatable="yes" context="solversuccessdialog|ok">Keep Result</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="cancel">
+ <property name="label" translatable="yes" context="solversuccessdialog|cancel">Restore Previous</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
@@ -22,10 +70,10 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="solversuccessdialog|label1">Do you want to keep the result or do you want to restore previous values?</property>
<property name="wrap">True</property>
<property name="max_width_chars">40</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -36,8 +84,8 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="solversuccessdialog|label2">Solving successfully finished.</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -48,8 +96,8 @@
<object class="GtkLabel" id="result">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="solversuccessdialog|result">Result:</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -63,48 +111,6 @@
<property name="position">0</property>
</packing>
</child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="ok">
- <property name="label" translatable="yes" context="solversuccessdialog|ok">Keep Result</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="cancel">
- <property name="label" translatable="yes" context="solversuccessdialog|cancel">Restore Previous</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">2</property>
- </packing>
- </child>
</object>
</child>
<action-widgets>
More information about the Libreoffice-commits
mailing list