Created implemented resize slots for the panels
authorKaj Wallin <kaj.wallin@ixonos.com>
Fri, 7 May 2010 05:53:07 +0000 (08:53 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Fri, 7 May 2010 05:53:07 +0000 (08:53 +0300)
Reviewed by:

src/src.pro
src/ui/friendlistpanel.cpp
src/ui/mapviewscreen.cpp
src/ui/userpanel.cpp

index f08a969..1af667f 100644 (file)
@@ -77,7 +77,7 @@ HEADERS += ui/mainwindow.h \
 QT += network \
     webkit
 
-# DEFINES += QT_NO_DEBUG_OUTPUT
+DEFINES += QT_NO_DEBUG_OUTPUT
 !maemo5 { 
     message(QJson built in)
     message(Make sure you have QJson development headers installed)
index b3b06e9..a35321d 100644 (file)
@@ -38,17 +38,17 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     friendListScroll->setWidgetResizable(true);
     friendListScroll->viewport()->setAutoFillBackground(false);
 
-    m_friendsPanelVBox->addWidget(friendListScroll);
+//    this->setAutoFillBackground(true);
 
-    this->resize(420,600);
+    m_friendsPanelVBox->addWidget(friendListScroll);
 
     m_friendsPanelStateMachine = new QStateMachine(this);
     m_friendsPanelStateClosed = new QState(m_friendsPanelStateMachine);
-    m_friendsPanelStateClosed->assignProperty(this, "pos", QPoint(800,0));
+    m_friendsPanelStateClosed->assignProperty(this, "pos", QPoint(800, 0));
     m_friendsPanelStateMachine->setInitialState(m_friendsPanelStateClosed);
 
     m_friendsPanelStateOpened = new QState(m_friendsPanelStateMachine);
-    m_friendsPanelStateOpened->assignProperty(this, "pos", QPoint(400,0));
+    m_friendsPanelStateOpened->assignProperty(this, "pos", QPoint(400, 0));
 
     m_friendsPanelTransitionOpen = m_friendsPanelStateClosed->addTransition(
             m_friendsPanelExpandButton, SIGNAL(clicked()), m_friendsPanelStateOpened);
@@ -77,4 +77,8 @@ void FriendListPanel::friendInfoReceived(QList<User *> &friendList)
 void FriendListPanel::reDrawFriendsPanel(int width, int height)
 {
     qDebug() << __PRETTY_FUNCTION__;
+    this->resize(420,height+1);
+    m_friendsPanelStateClosed->assignProperty(this, "pos", QPoint(width-50, 0));
+    m_friendsPanelStateOpened->assignProperty(this, "pos", QPoint(width-419, 0));
+    this->move(width-50,0);
 }
index c02615f..7508e62 100644 (file)
@@ -34,6 +34,9 @@ MapViewScreen::MapViewScreen(QWidget *parent)
     mapEngine = new MapEngine(this);
     mapView->setScene(mapEngine->scene());
 
+    FriendListPanel *friendsListPanel = new FriendListPanel(this);
+    UserInfoPanel *userPanel = new UserInfoPanel(this);
+
     connect(mapView, SIGNAL(viewScrolled(QPoint)),
             mapEngine, SLOT(setLocation(QPoint)));
     connect(mapEngine, SIGNAL(locationChanged(QPoint)),
@@ -46,9 +49,18 @@ MapViewScreen::MapViewScreen(QWidget *parent)
             mapEngine, SLOT(alignImmovableItems(QPoint)));
     connect(mapView, SIGNAL(viewZoomFinished()),
             mapEngine, SLOT(viewZoomFinished()));
+
     connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
             this, SLOT(drawOsmLicense(int, int)));
 
+    connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
+            friendsListPanel, SLOT(reDrawFriendsPanel(int,int)));
+    connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
+            userPanel, SLOT(reDrawUserPanel(int,int)));
+
+    connect(this, SIGNAL(SIG_friendsLocationsReady(QList<User*>&)),
+            friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
+
 
     QHBoxLayout *mapViewLayout = new QHBoxLayout;
     //DEBUG
@@ -69,12 +81,6 @@ MapViewScreen::MapViewScreen(QWidget *parent)
 //    connect(zoomOut, SIGNAL(clicked()), mapEngine, SLOT(zoomOut()));
     //DEBUG
 
-    FriendListPanel *friendsListPanel = new FriendListPanel(this);
-    UserInfoPanel *userPanel = new UserInfoPanel(this);
-
-    connect(this, SIGNAL(SIG_friendsLocationsReady(QList<User*>&)),
-            friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
-
     osmLicense = new QLabel(this);
     osmLicense->setAttribute(Qt::WA_TranslucentBackground, true);
     osmLicense->setAttribute(Qt::WA_TransparentForMouseEvents, true);
@@ -83,7 +89,8 @@ MapViewScreen::MapViewScreen(QWidget *parent)
     osmLicense->resize(osmLicense->fontMetrics().width(OSM_LICENSE),
                        osmLicense->fontMetrics().height());
 
-    osmLicense->stackUnder(friendsListPanel);
+    userPanel->stackUnder(friendsListPanel);
+    osmLicense->stackUnder(userPanel);
     mapView->stackUnder(osmLicense);
 
     mapViewLayout->addWidget(mapView);
@@ -120,7 +127,7 @@ void MapViewScreen::friendsLocationsReady(QList<User *> &friendsList)
 
 void MapViewScreen::drawOsmLicense(int width, int height)
 {
-    qDebug() << __PRETTY_FUNCTION__ << width << "x" << height;
+    qWarning() << __PRETTY_FUNCTION__ << width << "x" << height;
     osmLicense->move(width-osmLicense->fontMetrics().width(OSM_LICENSE),
                      height-osmLicense->fontMetrics().height());
 }
index de58934..863cfcf 100644 (file)
@@ -32,11 +32,9 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
     m_userPanelVBox->addWidget(m_userPanelExpandButton);
     m_userPanelVBox->addWidget(m_userPanelLabel);
 
-//    m_userPanelSize = new QSize(300,600);
-//    m_userPanelCoordinatesClosed = new QPoint(-250,0);
-//    m_userPanelCoordinatesOpen = new QPoint(0,0);
-
-    this->resize(300,600);
+    this->setAutoFillBackground(true);
+//    this->setAttribute(Qt::WA_TranslucentBackground);
+//    this->setWindowOpacity(0.5); //DEFUNCT
 
     m_userPanelStateMachine = new QStateMachine(this);
     m_userPanelStateClosed = new QState(m_userPanelStateMachine);
@@ -60,4 +58,6 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
 void UserInfoPanel::reDrawUserPanel(int width, int height)
 {
     qDebug() << __PRETTY_FUNCTION__;
+    Q_UNUSED(width);
+    this->resize(300,height+1);
 }