[PATCH setup libsolv, v2] Let the user review added dependencies
Jon Turney
jon.turney@dronecode.org.uk
Wed Jan 24 20:30:00 GMT 2018
On 22/01/2018 17:37, Ken Brown wrote:
> If the solver found no problems but added packages to resolve
> dependencies, ask the user whether they want to review the added
> packages before proceeding.
>
> If they answer Yes, go back to the chooser with the 'Pending' view
> selected. The implementation adds several new members to the
> PrereqChecker class so that the latter can communicate with the
> chooser page.
As discussed, this approach could be confusing.
Attached is a slightly different approach, which adds a new page to
review and confirm what actions we're going to take.
For the moment, this just contains a simple text report, but I guess
this could be extended e.g. to use a grid control, or give reasons for
why packages are being installed.
-------------- next part --------------
From f73030816b16d9dbcb0ed13ce84ee6c7914d8c3e Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Tue, 23 Jan 2018 17:50:13 +0000
Subject: [PATCH setup] Add a new page to let the user review and confirm
actions
Add a new page to let the user review and confirm actions, after
dependencies have been added and problems solved.
Ideally, this would re-use the picker-page grid to present these actions,
but for the moment just write it as text (as we did before in the prereq
page) (This is still a slight improvement as it shows all actions for
review, not just the ones added by the solver)
---
Makefile.am | 2 +
confirm.cc | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
confirm.h | 34 +++++++++++++++
main.cc | 4 ++
prereq.cc | 41 ++----------------
prereq.h | 2 -
res.rc | 16 +++++++
resource.h | 2 +
8 files changed, 199 insertions(+), 39 deletions(-)
create mode 100644 confirm.cc
create mode 100644 confirm.h
diff --git a/Makefile.am b/Makefile.am
index db8d070..37341b9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -119,6 +119,8 @@ inilint_SOURCES = \
compress_gz.h \
compress_xz.cc \
compress_xz.h \
+ confirm.cc \
+ confirm.h \
ConnectionSetting.cc \
ConnectionSetting.h \
ControlAdjuster.cc \
diff --git a/confirm.cc b/confirm.cc
new file mode 100644
index 0000000..7f8f5da
--- /dev/null
+++ b/confirm.cc
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2018
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * A copy of the GNU General Public License can be found at
+ * http://www.gnu.org/
+ *
+ */
+
+#include "confirm.h"
+#include "threebar.h"
+#include "resource.h"
+#include "state.h"
+#include "ControlAdjuster.h"
+#include "package_db.h"
+#include "package_meta.h"
+
+extern ThreeBarProgressPage Progress;
+
+// Sizing information.
+static ControlAdjuster::ControlInfo ConfirmControlsInfo[] = {
+ {IDC_CONFIRM_EDIT, CP_STRETCH, CP_STRETCH},
+ {0, CP_LEFT, CP_TOP}
+};
+
+// ---------------------------------------------------------------------------
+// implements class ConfirmPage
+// ---------------------------------------------------------------------------
+
+ConfirmPage::ConfirmPage ()
+{
+ sizeProcessor.AddControlInfo (ConfirmControlsInfo);
+}
+
+bool
+ConfirmPage::Create ()
+{
+ return PropertyPage::Create (IDD_CONFIRM);
+}
+
+void
+ConfirmPage::OnInit ()
+{
+ // set the edit-area to a larger font
+ SetDlgItemFont(IDC_CONFIRM_EDIT, "MS Shell Dlg", 10);
+}
+
+void
+ConfirmPage::OnActivate()
+{
+ // generate a report on actions we're going to take
+ std::string s = "";
+
+ // first list things we will erase
+ packagedb db;
+ const SolverTransactionList & trans = db.solution.transactions ();
+ for (SolverTransactionList::const_iterator i = trans.begin ();
+ i != trans.end (); i++)
+ {
+ if (i->type == SolverTransaction::transErase)
+ {
+ packageversion pv = i->version;
+ packagemeta *pkg = db.findBinary (PackageSpecification (pv.Name ()));
+
+ s += "Uninstall ";
+ s += i->version.Name();
+ s += " ";
+ s += i->version.Canonical_version();
+ if (pkg->desired)
+ s += " (automatically added)";
+ s += "\r\n";
+ }
+ }
+
+ // then list things installed
+ for (SolverTransactionList::const_iterator i = trans.begin ();
+ i != trans.end (); i++)
+ {
+ packageversion pv = i->version;
+ packagemeta *pkg = db.findBinary (PackageSpecification (pv.Name ()));
+
+ if (i->type == SolverTransaction::transInstall)
+ {
+ s += "Install ";
+ s += i->version.Name();
+ s += " ";
+ s += i->version.Canonical_version();
+ if (!pkg->desired)
+ s += " (automatically added)";
+ s += "\r\n";
+ }
+ }
+
+ SetDlgItemText (GetHWND (), IDC_CONFIRM_EDIT, s.c_str ());
+
+ // move focus to 'next' button, so enter doesn't get eaten by edit control
+ HWND nextButton = ::GetDlgItem(::GetParent(GetHWND()), 0x3024 /* ID_WIZNEXT */);
+ PostMessage (GetHWND (), WM_NEXTDLGCTL, (WPARAM)nextButton, TRUE);
+}
+
+long
+ConfirmPage::OnNext ()
+{
+ return whatNext();
+}
+
+long
+ConfirmPage::whatNext ()
+{
+ if (source == IDC_SOURCE_LOCALDIR)
+ {
+ // Next, install
+ Progress.SetActivateTask (WM_APP_START_INSTALL);
+ }
+ else
+ {
+ // Next, start download from internet
+ Progress.SetActivateTask (WM_APP_START_DOWNLOAD);
+ }
+ return IDD_INSTATUS;
+}
+
+long
+ConfirmPage::OnBack ()
+{
+ return IDD_CHOOSE;
+}
+
+long
+ConfirmPage::OnUnattended ()
+{
+ return whatNext();
+}
diff --git a/confirm.h b/confirm.h
new file mode 100644
index 0000000..fe11ee0
--- /dev/null
+++ b/confirm.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * A copy of the GNU General Public License can be found at
+ * http://www.gnu.org/
+ *
+ */
+
+#ifndef SETUP_CONFIRM_H
+#define SETUP_CONFIRM_H
+
+#include "proppage.h"
+
+class ConfirmPage:public PropertyPage
+{
+public:
+ ConfirmPage ();
+ virtual ~ConfirmPage () { };
+ bool Create ();
+ virtual void OnInit ();
+ virtual void OnActivate ();
+ virtual long OnNext ();
+ virtual long OnBack ();
+ virtual long OnUnattended ();
+private:
+ long whatNext ();
+};
+
+#endif /* SETUP_CONFIRM_H */
diff --git a/main.cc b/main.cc
index 028f8de..2e57f94 100644
--- a/main.cc
+++ b/main.cc
@@ -55,6 +55,7 @@
#include "site.h"
#include "choose.h"
#include "prereq.h"
+#include "confirm.h"
#include "threebar.h"
#include "desktop.h"
#include "postinstallresults.h"
@@ -135,6 +136,7 @@ main_display ()
SitePage Site;
ChooserPage Chooser;
PrereqPage Prereq;
+ ConfirmPage Confirm;
DesktopSetupPage Desktop;
PropSheet MainWindow;
@@ -175,6 +177,7 @@ main_display ()
Site.Create ();
Chooser.Create ();
Prereq.Create ();
+ Confirm.Create ();
Progress.Create ();
PostInstallResults.Create ();
Desktop.Create ();
@@ -189,6 +192,7 @@ main_display ()
MainWindow.AddPage (&Site);
MainWindow.AddPage (&Chooser);
MainWindow.AddPage (&Prereq);
+ MainWindow.AddPage (&Confirm);
MainWindow.AddPage (&Progress);
MainWindow.AddPage (&PostInstallResults);
MainWindow.AddPage (&Desktop);
diff --git a/prereq.cc b/prereq.cc
index effa7cc..8fcd3ba 100644
--- a/prereq.cc
+++ b/prereq.cc
@@ -13,26 +13,14 @@
*
*/
-#include "win32.h"
-#include <commctrl.h>
-#include <stdio.h>
-#include <io.h>
-#include <ctype.h>
-#include <process.h>
-#include <queue>
-
#include "prereq.h"
-#include "dialog.h"
#include "resource.h"
#include "state.h"
-#include "propsheet.h"
#include "threebar.h"
-#include "Generic.h"
#include "LogSingleton.h"
#include "ControlAdjuster.h"
#include "package_db.h"
-#include "package_meta.h"
-#include "msg.h"
+
#include "Exception.h"
#include "getopt++/BoolOption.h"
@@ -120,23 +108,7 @@ PrereqPage::OnNext ()
PrereqChecker p;
p.finalize();
- return whatNext();
-}
-
-long
-PrereqPage::whatNext ()
-{
- if (source == IDC_SOURCE_LOCALDIR)
- {
- // Next, install
- Progress.SetActivateTask (WM_APP_START_INSTALL);
- }
- else
- {
- // Next, start download from internet
- Progress.SetActivateTask (WM_APP_START_DOWNLOAD);
- }
- return IDD_INSTATUS;
+ return IDD_CONFIRM;
}
long
@@ -160,7 +132,7 @@ PrereqPage::OnUnattended ()
if (unattended_mode == chooseronly)
return -1;
- return whatNext();
+ return IDD_CONFIRM;
}
// ---------------------------------------------------------------------------
@@ -233,12 +205,7 @@ do_prereq_check_thread(HINSTANCE h, HWND owner)
if (p.isMet ())
{
p.finalize();
-
- if (source == IDC_SOURCE_LOCALDIR)
- Progress.SetActivateTask (WM_APP_START_INSTALL); // install
- else
- Progress.SetActivateTask (WM_APP_START_DOWNLOAD); // start download
- retval = IDD_INSTATUS;
+ retval = IDD_CONFIRM;
}
else
{
diff --git a/prereq.h b/prereq.h
index 24e6de5..749d3eb 100644
--- a/prereq.h
+++ b/prereq.h
@@ -27,8 +27,6 @@ public:
virtual long OnNext ();
virtual long OnBack ();
virtual long OnUnattended ();
-private:
- long whatNext ();
};
class PrereqChecker
diff --git a/res.rc b/res.rc
index 3881f14..745b396 100644
--- a/res.rc
+++ b/res.rc
@@ -392,6 +392,22 @@ BEGIN
END
+IDD_CONFIRM DIALOG DISCARDABLE 0, 0, SETUP_STANDARD_DIALOG_DIMS
+STYLE DS_MODALFRAME | DS_3DLOOK | WS_CHILD | WS_VISIBLE | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Cygwin Setup - Review and confirm changes"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ CONTROL "",IDC_HEADSEPARATOR,"Static",SS_BLACKFRAME | SS_SUNKEN,
+ 0,28,SETUP_STANDARD_DIALOG_W,1
+ ICON IDI_CYGWIN,IDC_HEADICON,SETUP_HEADICON_X,0,21,20
+ LTEXT "Review and confirm changes",IDC_STATIC_HEADER_TITLE
+ ,7,0,258,8,NOT WS_GROUP
+ EDITTEXT IDC_CONFIRM_EDIT,7,41,325,131,WS_VSCROLL | WS_HSCROLL |
+ ES_LEFT | ES_MULTILINE | ES_READONLY | ES_AUTOHSCROLL |
+ ES_AUTOVSCROLL
+END
+
IDD_DROPPED DIALOG DISCARDABLE 0, 0, SETUP_STANDARD_DIALOG_W, 142
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cygwin Setup - Use dropped mirrors?"
diff --git a/resource.h b/resource.h
index 5294e38..31e080f 100644
--- a/resource.h
+++ b/resource.h
@@ -69,6 +69,7 @@
#define IDD_POSTINSTALL 222
#define IDD_FILE_INUSE 223
#define IDD_DOWNLOAD_ERROR 224
+#define IDD_CONFIRM 225
// Bitmaps
@@ -181,3 +182,4 @@
#define IDC_DOWNLOAD_EDIT 594
#define IDC_CHOOSE_DO_SEARCH 595
#define IDC_CHOOSE_SYNC 596
+#define IDC_CONFIRM_EDIT 597
--
2.15.1
More information about the Cygwin-apps
mailing list