connectionmonitoring/connectionview/src/connectionview.cpp
changeset 73 70ee5458c95d
parent 44 a0c4ceac30d0
equal deleted inserted replaced
72:0c32cf868819 73:70ee5458c95d
    38 #include "OstTraceDefinitions.h"
    38 #include "OstTraceDefinitions.h"
    39 #ifdef OST_TRACE_COMPILER_IN_USE
    39 #ifdef OST_TRACE_COMPILER_IN_USE
    40 #include "connectionviewTraces.h"
    40 #include "connectionviewTraces.h"
    41 #endif
    41 #endif
    42 
    42 
    43 
       
    44 QTM_USE_NAMESPACE
       
    45 
       
    46 const qreal typeLabelWidth = 18.0;
    43 const qreal typeLabelWidth = 18.0;
    47 const QString iapIdentifierPrefix = "I_";
    44 const QString iapIdentifierPrefix = "I_";
       
    45 
    48 
    46 
    49 ConnectionView::ConnectionView():
    47 ConnectionView::ConnectionView():
    50     mNetConfigurationManager(new QNetworkConfigurationManager(this)),
    48     mNetConfigurationManager(new QNetworkConfigurationManager(this)),
    51     mSignalMapper(new QSignalMapper(this)),
    49     mSignalMapper(new QSignalMapper(this)),
    52     mConnectionCount(0),
    50     mConnectionCount(0),
    55     OstTraceFunctionEntry0( CONNECTIONVIEW_CONNECTIONVIEW_ENTRY );
    53     OstTraceFunctionEntry0( CONNECTIONVIEW_CONNECTIONVIEW_ENTRY );
    56     // Install localization
    54     // Install localization
    57     mTranslator = QSharedPointer<HbTranslator>(new HbTranslator("connectionview"));
    55     mTranslator = QSharedPointer<HbTranslator>(new HbTranslator("connectionview"));
    58    
    56    
    59     // Register custom layout location
    57     // Register custom layout location
    60     bool registerStatus = HbStyleLoader::registerFilePath(":/layout/");
    58     bool registerStatus = HbStyleLoader::registerFilePath(":connectionview.css");
    61     Q_ASSERT(registerStatus);
    59     Q_ASSERT(registerStatus);
    62     
    60     
    63     // Map the configurationChanged signal to a slot in order to get
    61     // Map the configurationChanged signal to a slot in order to get
    64     // information about the changes in the connections
    62     // information about the changes in the connections
    65     bool connectStatus = connect(
    63     bool connectStatus = connect(
    67             SIGNAL(configurationChanged(const QNetworkConfiguration&)),
    65             SIGNAL(configurationChanged(const QNetworkConfiguration&)),
    68             this,
    66             this,
    69             SLOT(handleConfigurationChanged(const QNetworkConfiguration&)));
    67             SLOT(handleConfigurationChanged(const QNetworkConfiguration&)));
    70     
    68     
    71     // Create the view and show it
    69     // Create the view and show it
       
    70     setContentsMargins( 0, 0, 0, 0 );
    72     createView();
    71     createView();
    73     OstTraceFunctionExit0( CONNECTIONVIEW_CONNECTIONVIEW_EXIT );
    72     OstTraceFunctionExit0( CONNECTIONVIEW_CONNECTIONVIEW_EXIT );
    74 }
    73 }
    75 
    74 
    76 
    75 
   121     mMainLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   120     mMainLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   122     mScrollArea = new HbScrollArea();
   121     mScrollArea = new HbScrollArea();
   123     mScrollArea->setScrollDirections(Qt::Vertical);
   122     mScrollArea->setScrollDirections(Qt::Vertical);
   124     mScrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   123     mScrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   125     mMainLayout->addItem(mScrollArea);
   124     mMainLayout->addItem(mScrollArea);
       
   125     mMainLayout->setContentsMargins( 0, 0, 0, 0 );
   126 
   126 
   127     // Create the mainView and the layout for the window
   127     // Create the mainView and the layout for the window
   128     mMainView = new HbView();
   128     mMainView = new HbView();
   129     addView(mMainView);
   129     addView(mMainView);
   130     ScrollAreaWidget *scrollContent = new ScrollAreaWidget();
   130     ScrollAreaWidget *scrollContent = new ScrollAreaWidget();
   131     scrollContent->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   131     scrollContent->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   132     mScrollArea->installEventFilter(scrollContent);
   132     mScrollArea->installEventFilter(scrollContent);
       
   133     mMainView->setContentsMargins( 0, 0, 0, 0 );
   133     
   134     
   134     mBoxLayout = new QGraphicsLinearLayout(Qt::Vertical);
   135     mBoxLayout = new QGraphicsLinearLayout(Qt::Vertical);
   135     mBoxLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   136     mBoxLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   136     scrollContent->setLayout(mBoxLayout);
   137     scrollContent->setLayout(mBoxLayout);
   137     mMainView->setLayout(mMainLayout);
   138     mMainView->setLayout(mMainLayout);
   138     mScrollArea->setContentWidget(scrollContent);
   139     mScrollArea->setContentWidget(scrollContent);
       
   140     mBoxLayout->setContentsMargins( 0, 0, 0, 0 );
   139     
   141     
   140     // Create the toolbar and the disconnection action
   142     // Create the toolbar and the disconnection action
   141     mToolBar = new HbToolBar();    
   143     mToolBar = new HbToolBar();    
   142     HbIcon icon("qtg_mono_disconnect");
   144     HbIcon icon("qtg_mono_disconnect");
   143     HbAction *disconnectAction = new HbAction(mToolBar);
   145     HbAction *disconnectAction = new HbAction(mToolBar);
   298     HbGroupBox *groupBox = new HbGroupBox();
   300     HbGroupBox *groupBox = new HbGroupBox();
   299     groupBox->setObjectName("groupBox");
   301     groupBox->setObjectName("groupBox");
   300     groupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
   302     groupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
   301     groupBox->setHeading(hbTrId("txt_occ_subhead_connection_details"));
   303     groupBox->setHeading(hbTrId("txt_occ_subhead_connection_details"));
   302     groupBox->setCollapsable(true);
   304     groupBox->setCollapsable(true);
       
   305   	mMainLayout->addItem( groupBox );
       
   306     groupBox->setContentsMargins( 0, 0, 0, 0 );
   303     
   307     
   304     // Create the disconnection button
   308     // Create the disconnection button
   305     HbPushButton* button = new HbPushButton(
   309     HbPushButton* button = new HbPushButton(
   306             hbTrId("txt_occ_button_disconnect"), mMainView);
   310             hbTrId("txt_occ_button_disconnect"), mMainView);
   307     button->setObjectName("disconnectButton");
   311     button->setObjectName("disconnectButton");
   308     button->setSizePolicy(QSizePolicy::Preferred, 
   312     button->setSizePolicy(QSizePolicy::Preferred, 
   309                           QSizePolicy::Preferred, 
   313                           QSizePolicy::Preferred, 
   310                           QSizePolicy::PushButton);
   314                           QSizePolicy::PushButton);
       
   315    	mMainLayout->addItem( button );
   311     
   316     
   312     // Create the horizontal layout for the labels
   317     // Create the horizontal layout for the labels
   313     QGraphicsLinearLayout *labelLayout = new QGraphicsLinearLayout(Qt::Horizontal);
   318     QGraphicsLinearLayout *labelLayout = new QGraphicsLinearLayout(Qt::Horizontal);
   314     labelLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   319     labelLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   315     HbLabel *typeLabel = new HbLabel(hbTrId("txt_occ_list_name"));
   320     HbLabel *typeLabel = new HbLabel(hbTrId("txt_occ_list_name"));
       
   321     labelLayout->setContentsMargins( 0, 0, 0, 0 );
   316 
   322 
   317     // get the pixel size matching the spesified 18 units using the HbDeviceProfile
   323     // get the pixel size matching the spesified 18 units using the HbDeviceProfile
   318     // and set the width of the label
   324     // and set the width of the label
   319     HbDeviceProfile profile = HbDeviceProfile::profile(mMainView);
   325     HbDeviceProfile profile = HbDeviceProfile::profile(mMainView);
   320     typeLabel->setPreferredWidth(typeLabelWidth*profile.unitValue());
   326     typeLabel->setPreferredWidth(typeLabelWidth*profile.unitValue());