예제 #1
0
    #include <eikappui.h>
    #include <aknenv.h>
    #include <aknappui.h>
#endif


int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    // Lock orientation in Symbian
#ifdef Q_OS_SYMBIAN
    CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
    TRAP_IGNORE(if (appUi) {
        appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);
    });
#endif

    PhysicsWidget widget;

    QObject::connect(&widget, SIGNAL(exitPressed()), &app, SLOT(quit()));

#if defined(Q_WS_HARMATTAN) || defined(Q_OS_SYMBIAN)
    widget.showFullScreen();
#else
    widget.showMaximized();
#endif

    return app.exec();
}
QBT_NAMESPACE_BEGIN

// ----------------------------------------------------------------------------
// QBtSingleDeviceSelectorUIPrivate::::QBtSingleDeviceSelectorUIPrivate(QWidget* parent) :
//		QFrame(parent), prnt(parent)
//
// constuctor
// ----------------------------------------------------------------------------
QBtSingleDeviceSelectorUIPrivate::QBtSingleDeviceSelectorUIPrivate (QWidget* parent, QBtSingleDeviceSelectorUI* publicClass) :
    QDialog(parent), _parent(parent), _selectedDevice(0), _discoverer(0),
    _devList(0), _menu(0), _select(0), _exit(0), _publicClass (publicClass)
{
    //setup UI
    setObjectName(QString::fromUtf8("btDeviceSelectorUIWidget"));
    setAutoFillBackground(true);
    //setFrameShape(QFrame::WinPanel);
    //setFrameShadow(QFrame::Sunken);
    this->setFocus();
    
    
    QDesktopWidget* dw = QApplication::desktop();
    int width = dw->screenGeometry().width();
    int height = dw->screenGeometry().height() /4;
        
    setGeometry(QRect(0, 148 , width, height));

    _verticalLayout = new QVBoxLayout(this);
    _verticalLayout->setSpacing(6);
    _verticalLayout->setMargin(11);
    _verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));

    _label = new QLabel(this);
    _label->setText("Devices:");
    _verticalLayout->addWidget(_label);

    _devList = new QListWidget(this);

    /*QAction* clear = new QAction(tr("&Exit"), this);
    clear->setSoftKeyRole(QAction::NegativeSoftKey);
    connect(clear, SIGNAL(triggered()), this, SLOT(closeWidget()));

    devList->addAction(clear);
    addAction(clear);*/

    _devList->setFocusPolicy(Qt::WheelFocus);
    _devList->setFrameShape(QFrame::WinPanel);
    _devList->setFrameShadow(QFrame::Sunken);
    _devList->setFocus();
    _verticalLayout->addWidget(_devList);

    _select = new QAction(QString("Select"), this);
    _select->setSoftKeyRole(QAction::PositiveSoftKey);
    connect(_select, SIGNAL(triggered()), this, SLOT(selectPressed()));
    addAction(_select);


    _exit = new QAction(QString("Cancel"), this);
    _exit->setSoftKeyRole(QAction::NegativeSoftKey);
    connect(_exit, SIGNAL(triggered()), this, SLOT(exitPressed()));
    addAction(_exit);

    /*menu = new QMenuBar(this);
    menu->addAction(select);
    menu->addAction(exit);

    menu->setNativeMenuBar(true);
    verticalLayout->setMenuBar(menu);*/

    ////////////////

    _discoverer = new QBtDeviceDiscoverer(parent);

    connect(_discoverer, SIGNAL(newDeviceFound(const QBtDevice&)),
            this, SLOT(populateDeviceList(const QBtDevice&)));

    connect(_devList, SIGNAL(itemActivated(QListWidgetItem *)),
                    this, SLOT(devSelected(QListWidgetItem *)));
    this->hide();

}