example/DemoGUI/FriendView.cpp
author cgandhi
Thu, 05 Aug 2010 16:35:33 +0530
changeset 16 b78fa4cdbf2b
permissions -rw-r--r--
pushing the demo application
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     1
#include "FriendView.h"
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     2
#include "ScreenSize.h"
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     3
#include "qpushbutton.h"
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     4
#include "ToolBar.h"
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     5
#include <qmessagebox.h>
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     6
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     7
//Forward declaration
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     8
class ScreenSize;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     9
class CustomListWidget;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    10
class GridView;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    11
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    12
FriendView::FriendView(QString aHeadName):
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    13
        iHeadName(aHeadName)
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    14
{
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    15
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    16
}
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    17
FriendView::~FriendView()
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    18
{
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    19
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    20
}
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    21
void FriendView::SetupUI()
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    22
{
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    23
    //iMainwindow = Mainwindow;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    24
    QPushButton* HomeButton = new QPushButton(this);
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    25
    HomeButton->setText(iHeadName);
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    26
    HomeButton->setGeometry(0,0,ScreenSize::GetScreenRect().width(),KHeadNameHeight);
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    27
    HomeButton->setStyleSheet("background-color: rgb(0,0,0);"
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    28
                             "border-width: 2px;"
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    29
                             "font: bold 16px;"
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    30
                             "min-width: 10em;"
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    31
                             "padding: 4px;"
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    32
							 "color: white;"
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    33
                            );
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    34
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    35
    HomeButton->setDisabled(true);
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    36
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    37
    TabWidget = new QTabWidget(this);
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    38
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    39
    iPostsListWidget = new CustomListWidget();
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    40
    TabWidget->addTab(iPostsListWidget,"Posts");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    41
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    42
    AlbumView = new GridView();
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    43
    QStringList Iconpathlist;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    44
    Iconpathlist.append("E:/Images/SMF/SMF.JPG");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    45
    Iconpathlist.append("E:/Images/SMF/SMF.JPG");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    46
    Iconpathlist.append("E:/Images/SMF/SMF.JPG");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    47
    Iconpathlist.append("E:/Images/SMF/SMF.JPG");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    48
    Iconpathlist.append("E:/Images/SMF/SMF.JPG");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    49
    Iconpathlist.append("E:/Images/SMF/SMF.JPG");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    50
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    51
    TabWidget->addTab(AlbumView->CreateGridView(Iconpathlist),"Album");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    52
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    53
    TabWidget->setGeometry(0,KHeadNameHeight + KWidgetGapFactor,ScreenSize::GetScreenRect().width(),ScreenSize::GetScreenRect().height() - (ToolbarIconHeight + KWidgetGapFactor));
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    54
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    55
    connect(TabWidget,SIGNAL(currentChanged(int)),this,SLOT(Navigated2OtherTab(int)));
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    56
    //Drawing Tool bar
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    57
    ToolBar* ToolBarwidget = new ToolBar;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    58
    QStringList actionList;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    59
    actionList.append("Post");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    60
    actionList.append("Reply");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    61
    actionList.append("Add Service");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    62
    ToolBarwidget->GetToolBar(this,actionList);
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    63
    showFullScreen();
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    64
}
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    65
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    66
void FriendView::Navigated2OtherTab(int tabIndex)
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    67
{
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    68
     if(tabIndex == 0)
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    69
        iPostsListWidget->AddListItem("E:/Images/SMF/SMF.JPG","Rajat","Hello !");
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    70
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    71
}