summaryrefslogtreecommitdiffstats
path: root/InfoPanel.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2020-01-03 17:41:32 -0500
committerScott Murray <scott.murray@konsulko.com>2020-01-03 17:41:32 -0500
commitbb3e1b096d692d2d1994699f16adbdc02d7ab7f8 (patch)
tree3abe6a34a8fcfe50b8a138a76c06e515361c44de /InfoPanel.cpp
parenta9cf6b325c2d91e03a887b84c134249395854cd2 (diff)
Rework to raise navigation app and improve behaviorhalibut_8.0.6halibut_8.0.5halibut/8.0.6halibut/8.0.58.0.68.0.5halibut
Add callback to raise navigation app via homescreen and hook it up to the "Go" button handling. Additionally, testing of this addition revealed that the result list and information panel state is fragile and easily gotten into a bad state with respect to repaints when raising the navigation app. To fix this, the code has been reworked to change InfoPanel into an actual widget and keep it and the result list widget around; manipulating their visibilty rather than recreating them and forcing whole-window repaints. As well, a slight delay is used before raising the navigation app to let all repaints finish. Ideally this would not be required, but the app likely needs a more significant rewrite to fix it. Bug-AGL: SPEC-3079 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I599edd3030ff0852b80e418181990dd415a0bda2
Diffstat (limited to 'InfoPanel.cpp')
-rw-r--r--InfoPanel.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/InfoPanel.cpp b/InfoPanel.cpp
index bc57e34..81cf317 100644
--- a/InfoPanel.cpp
+++ b/InfoPanel.cpp
@@ -22,22 +22,30 @@
#define LABEL_IMG_HEIGHT 220
#define LABEL_REVIEWS_HEIGHT 24
-InfoPanel::InfoPanel(QWidget *parent, Business & business, QRect rect):
- nameLabel(parent, rect),
- imageLabel(parent, rect),
- addressLabel(parent, rect),
- phoneLabel(parent, rect),
- imgRatingLabel(parent, rect),
- nbReviewsLabel(parent, rect),
- btnsBackground(parent, rect),
- cancelButton("Cancel", parent),
- goButton("Go !", parent),
+InfoPanel::InfoPanel(QWidget *parent, QRect rect):
+ QWidget(parent),
+ nameLabel(this, rect),
+ imageLabel(this, rect),
+ addressLabel(this, rect),
+ phoneLabel(this, rect),
+ imgRatingLabel(this, rect),
+ nbReviewsLabel(this, rect),
+ btnsBackground(this, rect),
+ cancelButton("Cancel", this),
+ goButton("Go !", this),
networkManager(parent)
{
+ setGeometry(rect);
+ setVisible(false);
+}
+
+void InfoPanel::populateInfo(Business & business)
+{
int y = 0;
QPixmap pixmap;
bool isImageDownloaded = false;
QFont font, fontBold;
+ QRect rect = this->geometry();
font = nameLabel.font();
font.setPointSize(FONT_SIZE);
@@ -110,12 +118,11 @@ InfoPanel::InfoPanel(QWidget *parent, Business & business, QRect rect):
cancelButton.setStyleSheet(BTN_STYLE);
cancelButton.setFont(font);
cancelButton.setMinimumSize(QSize(rect.width()/4, 50));
- cancelButton.setGeometry(QRect(rect.x()+rect.width()/8, rect.y()+y-60, rect.width()/4, 50));
- cancelButton.setVisible(true);
+ //cancelButton.setGeometry(QRect(rect.x()+rect.width()/8, rect.y()+y-60, rect.width()/4, 50));
+ cancelButton.setGeometry(QRect(rect.width()/8, y-60, rect.width()/4, 50));
goButton.setStyleSheet(BTN_STYLE);
goButton.setFont(font);
goButton.setMinimumSize(QSize(rect.width()/4, 50));
- goButton.setGeometry(QRect(rect.x()+rect.width()*5/8, rect.y()+y-60, rect.width()/4, 50));
- goButton.setVisible(true);
+ goButton.setGeometry(QRect(rect.width()*5/8, y-60, rect.width()/4, 50));
}