controlpanelplugins/themeplugin/src/cpthemepreview.cpp
changeset 12 624337f114fe
parent 11 10d0dd0e43f1
child 14 23411a3be0db
equal deleted inserted replaced
11:10d0dd0e43f1 12:624337f114fe
    17 
    17 
    18 #include <QString>
    18 #include <QString>
    19 #include <QGraphicsPixmapItem>
    19 #include <QGraphicsPixmapItem>
    20 #include <QGraphicsLinearLayout>
    20 #include <QGraphicsLinearLayout>
    21 
    21 
    22 #include <hbaction>
    22 #include <hbaction.h>
    23 #include <hbtoolbar>
    23 #include <hbtoolbar.h>
    24 #include <hbicon.h>
    24 #include <hbicon.h>
    25 #include <hbaction.h>
    25 #include <hbaction.h>
    26 #include <hblabel.h>
    26 #include <hblabel.h>
    27 #include <hbiconitem.h>
    27 #include <hbiconitem.h>
       
    28 #include <hbmainwindow.h>
    28 
    29 
    29 #include "cpthemepreview.h"
    30 #include "cpthemepreview.h"
    30 
    31 
    31 /*!
    32 /*!
    32     \class CpThemePreview
    33     \class CpThemePreview
    52     //TODO: translation of string  hbTrId("txt_cp_title_preview_1")
    53     //TODO: translation of string  hbTrId("txt_cp_title_preview_1")
    53     
    54     
    54     QString themeHeading = tr("Preview: ") + mTheme.name;
    55     QString themeHeading = tr("Preview: ") + mTheme.name;
    55     HbLabel* label = new HbLabel(themeHeading, this);
    56     HbLabel* label = new HbLabel(themeHeading, this);
    56     label->setFontSpec(HbFontSpec(HbFontSpec::Primary));
    57     label->setFontSpec(HbFontSpec(HbFontSpec::Primary));
    57 
    58    
       
    59     label->setPreferredHeight(5.0);
    58     layout->addItem(label);
    60     layout->addItem(label);
       
    61     
       
    62     layout->setAlignment(layout->itemAt(0), Qt::AlignTop);
    59     
    63     
    60     //Create the toolbar and "Select" and "Cancel" actions.
    64     //Create the toolbar and "Select" and "Cancel" actions.
    61     HbToolBar* mToolBar = new HbToolBar(this);
    65     HbToolBar* mToolBar = new HbToolBar(this);
    62 
    66 
    63     HbAction* selectAction = new HbAction(tr("Select"));
    67     HbAction* selectAction = new HbAction(tr("Select"));
    72                       this, SLOT(themeSelected()));
    76                       this, SLOT(themeSelected()));
    73 
    77 
    74     QObject::connect( cancelAction, SIGNAL(triggered()), 
    78     QObject::connect( cancelAction, SIGNAL(triggered()), 
    75                       this, SIGNAL(aboutToClose()));
    79                       this, SIGNAL(aboutToClose()));
    76 
    80 
       
    81     HbIconItem* layoutItem;
    77     //layout->addItem(&HbIconItem(mTheme.icon, this ));
    82     //layout->addItem(&HbIconItem(mTheme.icon, this ));
    78     HbIconItem* layoutItem = new HbIconItem(mTheme.icon, this);
    83     if(mainWindow()->orientation() == Qt::Horizontal) {
       
    84         layoutItem = new HbIconItem(mTheme.landscapePreviewIcon, this);
       
    85     }
       
    86     else {
       
    87         layoutItem = new HbIconItem(mTheme.portraitPreviewIcon, this);
       
    88     }
    79     layout->addItem(layoutItem);
    89     layout->addItem(layoutItem);
       
    90     layout->setAlignment(layout->itemAt(0), Qt::AlignTop);
       
    91     
    80     setToolBar(mToolBar);
    92     setToolBar(mToolBar);
    81     setLayout(layout);
    93     setLayout(layout);
    82 
    94 
    83     //Setup the Back button action and set softkey. Back button 
    95     //Setup the Back button action and set softkey. Back button 
    84     //takes the user to the theme list view.
    96     //takes the user to the theme list view.