Merge lp:~jimmy-jonsson-hiq/forssim/Bug_423041_3 into lp:forssim

Proposed by Jimmy Jonsson
Status: Needs review
Proposed branch: lp:~jimmy-jonsson-hiq/forssim/Bug_423041_3
Merge into: lp:forssim
Diff against target: 163 lines
5 files modified
FsWisdom/ApplicationNode.cpp (+16/-2)
FsWisdom/ApplicationNode.h (+5/-1)
FsWisdom/LocalCaseList.cpp (+3/-0)
FsWisdom/ProgressDialog.cpp (+7/-5)
FsWisdom/ProgressDialog.h (+1/-0)
To merge this branch: bzr merge lp:~jimmy-jonsson-hiq/forssim/Bug_423041_3
Reviewer Review Type Date Requested Status
Martin Flodin Approve
Review via email: mp+12664@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jimmy Jonsson (jimmy-jonsson-hiq) wrote :

Bug 423041_3 fixed and ready to merge

Revision history for this message
Martin Flodin (mflodin) wrote :

The "wait cursor" is still showing even after the dialog has been closed which leads the user to believe the program is still waiting for something. Please see to it that the cursor returns to its normal state when the dialog is closed.

Is it possible to add a cancel button to the dialog? It was not that intuitive to press the window closing button to cancel.

maxValue(-1) has been removed from the constructor in FsWisdom/ProgressDialog.cpp. Why is that?

review: Needs Fixing
346. By Jimmy <jimmy@ubuntu>

Bug_423041_3

Revision history for this message
Jimmy Jonsson (jimmy-jonsson-hiq) wrote :

> The "wait cursor" is still showing even after the dialog has been closed which
> leads the user to believe the program is still waiting for something. Please
> see to it that the cursor returns to its normal state when the dialog is
> closed.
>
> Is it possible to add a cancel button to the dialog? It was not that intuitive
> to press the window closing button to cancel.
>
> maxValue(-1) has been removed from the constructor in
> FsWisdom/ProgressDialog.cpp. Why is that?

Wait cursor set to normal state. Adding cancel button was not as easy as I thought. We might put some more effort on the issue next week. maxValue(-1) does not make any sense and I think it is better if it is removed to avoid confusion.

347. By Jimmy <jimmy@ubuntu>

Bug_423041_3

Revision history for this message
Martin Flodin (mflodin) wrote :

Review: Approve
Looks good now. Tested on Ubuntu.

Revision history for this message
Martin Flodin (mflodin) :
review: Approve

Unmerged revisions

347. By Jimmy <jimmy@ubuntu>

Bug_423041_3

346. By Jimmy <jimmy@ubuntu>

Bug_423041_3

345. By Jimmy <jimmy@ubuntu>

Bug_423041_3

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'FsWisdom/ApplicationNode.cpp'
2--- FsWisdom/ApplicationNode.cpp 2009-09-18 14:43:43 +0000
3+++ FsWisdom/ApplicationNode.cpp 2009-10-02 08:28:11 +0000
4@@ -42,6 +42,7 @@
5 forsCaseVersionId(-1),
6 myCDcommand(-1),
7 ftpAborted(false),
8+ftpFinished(true),
9 isMirrored(false),
10 isStereo(false),
11 isPlayback(false),
12@@ -608,8 +609,10 @@
13 std::cout << "ApplicationNode CommandFinished CD" << std::endl;
14 if (commandID == myCDcommand)
15 {
16- progressDialog.reset(new ProgressDialog(this,"-Welcome to FsWisdom-\n Downloading and installing cases!",0,0,5));
17+ progressDialog.reset(new ProgressDialog(this,"-Welcome to FsWisdom-\n Downloading and installing cases!","Cancel",0,5));
18+ QObject::connect(this->getProgressDialog(),SIGNAL(canceled()),this,SLOT(cancelFtp()));
19 progressDialog->show();
20+ ftpFinished = false;
21
22 /*Create localCaselist and serverCaseList and download cases over ftp if not already downloaded.*/
23 localCaseList.reset(new LocalCaseList(this,this->getCaseDirectory(), this->getFtp()));
24@@ -634,7 +637,7 @@
25 /*registerUserWindow.reset(new RegisterUserWindow(this));
26 registerUserWindow->setGeometry(QApplication::desktop()->availableGeometry(0));
27 registerUserWindow->showMaximized();*/
28-
29+ ftpFinished = true;
30 ftp->close();
31 if (progressDialog.get() != NULL)
32 progressDialog->reset();
33@@ -673,5 +676,16 @@
34 void ApplicationNode::setFtpAborted(bool a_aborted)
35 {
36 ftpAborted = a_aborted;
37+ if(a_aborted)
38+ ftpFinished = true;
39+}
40+bool ApplicationNode::getFtpAborted()
41+{
42+ return ftpAborted;
43+}
44+
45+void ApplicationNode::cancelFtp()
46+{
47+ this->getProgressDialog()->cancelFtpDownloading();
48 }
49
50
51=== modified file 'FsWisdom/ApplicationNode.h'
52--- FsWisdom/ApplicationNode.h 2009-09-18 14:43:43 +0000
53+++ FsWisdom/ApplicationNode.h 2009-10-02 08:28:11 +0000
54@@ -180,13 +180,15 @@
55 LocalCaseList* getLocalCaseList();
56 ProgressDialog* getProgressDialog();
57 void setFtpAborted(bool aborted);
58+ bool getFtpAborted();
59
60 public slots:
61
62 /// Quit the application
63 void Quit()
64 {
65- quit();
66+ if(ftpFinished)
67+ quit();
68 }
69
70 /// Returns to the Register User Screen
71@@ -202,6 +204,7 @@
72 void ftpCommandFinished(int commandID, bool error);
73 void ftpCommandStarted(int id);
74 void ftpDownloadComplete();
75+ void cancelFtp();
76
77 private:
78
79@@ -295,6 +298,7 @@
80 auto_ptr<QFtp> ftp;
81 int myCDcommand;
82 bool ftpAborted;
83+ bool ftpFinished;
84 };
85
86 }
87
88=== modified file 'FsWisdom/LocalCaseList.cpp'
89--- FsWisdom/LocalCaseList.cpp 2009-09-15 12:03:38 +0000
90+++ FsWisdom/LocalCaseList.cpp 2009-10-02 08:28:11 +0000
91@@ -49,6 +49,8 @@
92
93 void LocalCaseList::ftpCommandFinished(int, bool error)
94 {
95+ if(!applicationNode->getFtpAborted())
96+ {
97 cout << "LocalCaseList ftpCommandFinished: " << endl;
98
99 if (ftp->currentCommand() == QFtp::ConnectToHost) {
100@@ -110,6 +112,7 @@
101 }
102 }
103 }
104+ }
105 }
106
107 void LocalCaseList::addLocally(const Case& newCase, QSqlDatabase& forsDatabase)
108
109=== modified file 'FsWisdom/ProgressDialog.cpp'
110--- FsWisdom/ProgressDialog.cpp 2009-09-15 12:03:38 +0000
111+++ FsWisdom/ProgressDialog.cpp 2009-10-02 08:28:11 +0000
112@@ -17,8 +17,7 @@
113 using namespace FS;
114
115 ProgressDialog::ProgressDialog(ApplicationNode *a_applicationNode, const QString & labelText, const QString & cancelButtonText, int minimum, int maximum, QWidget *parent)
116-:QProgressDialog(labelText,cancelButtonText,minimum,maximum,parent),
117-maxValue(-1)
118+:QProgressDialog(labelText,cancelButtonText,minimum,maximum,parent)
119 {
120 applicationNode = a_applicationNode;
121 aborted = false;
122@@ -51,15 +50,18 @@
123
124 void ProgressDialog::closeEvent(QCloseEvent *event)
125 {
126-
127 if(applicationNode == NULL)
128 {
129 event->ignore();
130 return;
131 }
132-
133 std::cout << "Progress dialog closed" << std::endl;
134+ cancelFtpDownloading();
135+ event->accept();
136+}
137
138+void ProgressDialog::cancelFtpDownloading()
139+{
140 // Stop ftp transfer
141 QFtp* ftp = applicationNode->getFtp();
142 ftp->abort();
143@@ -70,7 +72,7 @@
144 if(!removeDirectories())
145 std::cout << "Not able to remove empty case directories" << std::endl;
146
147- event->accept();
148+ applicationNode->restoreNormalCursor();
149 }
150
151 bool ProgressDialog::getAborted()
152
153=== modified file 'FsWisdom/ProgressDialog.h'
154--- FsWisdom/ProgressDialog.h 2009-09-09 12:22:21 +0000
155+++ FsWisdom/ProgressDialog.h 2009-10-02 08:28:11 +0000
156@@ -29,6 +29,7 @@
157 void setNewText(QString text);
158 virtual void closeEvent(QCloseEvent *event);
159 bool getAborted();
160+ void cancelFtpDownloading();
161 private:
162 int maxValue;
163 ApplicationNode *applicationNode;

Subscribers

People subscribed via source and target branches