MobileSettingsWindow::MobileSettingsWindow(const qutim_sdk_0_3::SettingsItemList& settings, QObject* controller) : p(new MobileSettingsWindowPrivate) { setAttribute(Qt::WA_DeleteOnClose); p->controller = controller; //setup ui QWidget *w = new QWidget(this); QVBoxLayout *l = new QVBoxLayout(w); l->setMargin(0); l->setSpacing(0); p->stackedWidget = new SlidingStackedWidget(w); //init widgets p->settingsListWidget = new QListWidget(w); p->categoryListWidget = new QListWidget(w); p->stackedWidget->addWidget(p->categoryListWidget); p->stackedWidget->addWidget(p->settingsListWidget); p->categoryListWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); p->settingsListWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); p->actionBox = new ActionBox(this); p->backAct = new QAction(tr("Back"),this); p->backAct->setVisible(false); p->actionBox->addAction(p->backAct); p->closeAct = new QAction(tr("Close"),this); p->closeAct->setVisible(false); p->actionBox->addAction(p->closeAct); l->addWidget(p->stackedWidget); l->addWidget(p->actionBox); int width = style()->pixelMetric(QStyle::PM_LargeIconSize); QSize size = QSize(width, width); p->categoryListWidget->setIconSize(size); p->settingsListWidget->setIconSize(size); setCentralWidget(w); //connections connect(p->categoryListWidget, SIGNAL(activated(QModelIndex)), SLOT(onCategoryActivated(QModelIndex)) ); connect(p->settingsListWidget, SIGNAL(activated(QModelIndex)), SLOT(onCurrentItemActivated(QModelIndex)) ); connect(p->backAct,SIGNAL(triggered()),SLOT(slideUp())); connect(p->closeAct,SIGNAL(triggered()),SLOT(close())); connect(p->stackedWidget, SIGNAL(fingerGesture(enum SlidingStackedWidget::SlideDirection)), this,SLOT(fingerGesture(enum SlidingStackedWidget::SlideDirection))); loadSettings(settings); QTimer::singleShot(0, this, SLOT(initScrolling())); }
void Board::slideBoard(Board::MOVE m) { switch (m) { case MOVE::LEFT: slideLeft(); break; case MOVE::RIGHT: slideRight(); break; case MOVE::UP: slideUp(); break; case MOVE::DOWN: slideDown(); break; } }