Example #1
1
bool LevelManager::init()
{
	if (!Layer::init())
	{
		return false;
	}
	Size visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();
	_selectedLevelIndex = 0;
	auto pageView = PageView::create();
	pageView->setContentSize(Size(480.0f,320.0f));
	pageView->setAnchorPoint(Vec2(0.5,0.5));
	pageView->setPosition(Vec2(visibleSize.width/2,visibleSize.height/2));
	for (int i = 0; i < 3;++i)
	{
		Layout* layout = Layout::create();
		layout->setContentSize(Size(480.0f,320.0f));
		ImageView* _imageView = ImageView::create(StringUtils::format("preview%d.png",i+1));
		_imageView->setContentSize(Size(480.0f,320.0f));
		_imageView->setPosition(Vec2(layout->getContentSize().width/2.f,layout->getContentSize().height/2.f));
		layout->addChild(_imageView);
		pageView->insertPage(layout,i);
	}
	pageView->addEventListener([=](Ref* pSender,PageView::EventType type){
		switch (type)
		{
		case PageView::EventType::TURNING:
		{
				PageView* pageView = dynamic_cast<PageView*>(pSender);
				_selectedLevelIndex = pageView->getCurPageIndex();
		}
			break;
		default:
			break;
		}
	});
	this->addChild(pageView,1);
	auto start_button = Button::create("btn-start.png");
	start_button->setPosition(Vec2(visibleSize.width/2,visibleSize.height*0.2));
	start_button->addTouchEventListener([=](Ref* pSender, Widget::TouchEventType type)
	{
		if (type==Widget::TouchEventType::ENDED)
		{
			auto transition = TransitionSlideInR::create(1.5,GameScene::createSceneWithLevel(++_selectedLevelIndex));
			Director::getInstance()->pushScene(transition);
		}
	});
	this->addChild(start_button, 1);
	return true;
}
/**
 * Constructor.
 * @param     usSFN        SFN to display details for.
 * @param     hwndTaskMgr  Handle of the taskmgr window.
 */
kSFNDetails::kSFNDetails(USHORT usSFN, HWND hwndTaskMgr) throw (kError)
: kNotebookBase(DL_KSFNDETAILS, NULLHANDLE, KSFNDTL_NTBK, NULLHANDLE),
  kDetailsBase(hwnd),
  hwndOwner(hwndTaskMgr),
  usSFN(usSFN)
{
    TRACELOG_CONSTRUCT("start");
    qsFrec_t *      pFSData;
    char            szTitle[278];

    /* Get SFN data */
    pFSData = QSGetSfnData(usSFN);
    if (pFSData == NULL)
        throw(kError(ERROR_INVALID_PARAMETER, kError::dos)); /* FIXME better complaint! */

    /* Set title */
    sprintf(&szTitle[0], "SFN 0x%04x - %.260s",
            usSFN, pFSData + 1);
    setTitle(&szTitle[0]);

    /* Create and insert notebook pages */
    insertPage(new kSFNDetailsPage(this, usSFN), BKA_MAJOR | BKA_AUTOPAGESIZE, BKA_LAST);
    insertPage(new kProcessPage(this, 0, usSFN), BKA_MAJOR | BKA_AUTOPAGESIZE, BKA_LAST);

    /* Last */
    insertPage(new kAboutPage(this), BKA_MAJOR, BKA_LAST);

    TRACELOG_CONSTRUCT("end");
}
Example #3
0
NewElementWizard::NewElementWizard(const workspace::Workspace& ws, Library& lib,
                                   const IF_GraphicsLayerProvider& lp,
                                   QWidget* parent) noexcept
  : QWizard(parent), mUi(new Ui::NewElementWizard) {
  mUi->setupUi(this);
  setPixmap(WizardPixmap::LogoPixmap, QPixmap(":/img/logo/48x48.png"));
  mContext.reset(new NewElementWizardContext(ws, lib, lp));

  // add pages
  insertPage(NewElementWizardContext::ID_ChooseType,
             new NewElementWizardPage_ChooseType(*mContext, this));
  insertPage(NewElementWizardContext::ID_CopyFrom,
             new NewElementWizardPage_CopyFrom(*mContext, this));
  insertPage(NewElementWizardContext::ID_EnterMetadata,
             new NewElementWizardPage_EnterMetadata(*mContext, this));
  insertPage(NewElementWizardContext::ID_PackagePads,
             new NewElementWizardPage_PackagePads(*mContext, this));
  insertPage(NewElementWizardContext::ID_ComponentProperties,
             new NewElementWizardPage_ComponentProperties(*mContext, this));
  insertPage(NewElementWizardContext::ID_ComponentSymbols,
             new NewElementWizardPage_ComponentSymbols(*mContext, this));
  insertPage(NewElementWizardContext::ID_ComponentSignals,
             new NewElementWizardPage_ComponentSignals(*mContext, this));
  insertPage(NewElementWizardContext::ID_ComponentPinSignalMap,
             new NewElementWizardPage_ComponentPinSignalMap(*mContext, this));
  insertPage(NewElementWizardContext::ID_DeviceProperties,
             new NewElementWizardPage_DeviceProperties(*mContext, this));

  setStartId(NewElementWizardContext::ID_ChooseType);
}
Example #4
0
KPageWidgetItem *KPageWidgetModel::insertPage(KPageWidgetItem *before, QWidget *widget, const QString &name)
{
    KPageWidgetItem *item = new KPageWidgetItem(widget, name);

    insertPage(before, item);

    return item;
}
Example #5
0
DConfigDlgWdgItem* DConfigDlgWdgModel::insertPage(DConfigDlgWdgItem* before, QWidget* widget, const QString& name)
{
    DConfigDlgWdgItem* const item = new DConfigDlgWdgItem(widget, name);

    insertPage(before, item);

    return item;
}
Example #6
0
// add page
void caDoubleTabWidget::addPage(QWidget *page)
{
    PRINT(printf("add a new page %s\n", qasc(page->objectName())));
    QStringList stringlist = page->objectName().split( "_");
    if(stringlist.count() > 1 ) {
        row= stringlist[1].toInt();
        col = stringlist[2].toInt();
    } else {
        row = 0;
        col = 0;
    }
    addPages = true;
    insertPage(count(), page);
    addPages = false;
    setRow(0);
    setCol(0);
}
Example #7
0
void WordEditFrame::on_contextButton_clicked()
{
    QMenu *contextMenu=new QMenu(this);

    QMenu *autoTextMenu=contextMenu->addMenu("Вставить авто-текст");

    autoTextMenu->addAction("Страница", this, SLOT(insertPage()));
    autoTextMenu->addAction("Количество страниц", this, SLOT(insertPageCount()));

    contextMenu->addAction("Вставить переменную", this, SLOT(insertLink()));

    setGeometryInDesktop(contextMenu,
                         cursor().pos().x(),
                         cursor().pos().y(),
                         contextMenu->sizeHint().width(),
                         contextMenu->sizeHint().height());

    contextMenu->show();
}
Example #8
0
void MultiPageWidget::addPage( QWidget *page )
{
  insertPage( count(), page );
}
void LiveGameSidebar::addPage(const QString &title, SidebarPage *sidebarPage)
{
    insertPage(m_stackedLayout->count(), title, sidebarPage);
}
Example #10
0
/*!
    Adds a \a page with \a icon and \a title.

    In case \a title is an empty string, QWidget::windowTitle of \a page is used.

    Returns the index of added page.

    \warning Adding and removing pages dynamically at run time might cause flicker.

    \sa insertPage()
*/
int QxtConfigWidget::addPage(QWidget* page, const QIcon& icon, const QString& title)
{
    return insertPage(-1, page, icon, title);
}
Example #11
0
void KviTalWizard::addPage(QWidget * pWidget,const QString &szTitle)
{
	insertPage(pWidget,szTitle,-1);
}
Example #12
0
KPageWidgetTest::KPageWidgetTest( QWidget *parent )
  : QWidget( parent )
{
  QGridLayout *layout = new QGridLayout( this );

  mWidget = new KPageWidget( this );
  layout->addWidget( mWidget, 0, 0, 7, 1 );

  connect( mWidget, SIGNAL( currentPageChanged( KPageWidgetItem*, KPageWidgetItem* ) ),
           this, SLOT( currentPageChanged( KPageWidgetItem*, KPageWidgetItem* ) ) );
  connect( mWidget, SIGNAL( pageToggled( KPageWidgetItem*, bool ) ),
           this, SLOT( pageToggled( KPageWidgetItem*, bool ) ) );

  int rowCount = 0;
  QPushButton *button = new QPushButton( "Auto", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( setAutoFace() ) );
  rowCount++;

  button = new QPushButton( "Plain", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( setPlainFace() ) );
  rowCount++;

  button = new QPushButton( "List", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( setListFace() ) );
  rowCount++;

  button = new QPushButton( "Tree", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( setTreeFace() ) );
  rowCount++;

  button = new QPushButton( "Tabbed", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( setTabbedFace() ) );
  rowCount++;

  button = new QPushButton( "Add Page", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( addPage() ) );
  rowCount++;

  button = new QPushButton( "Add Sub Page", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( addSubPage() ) );
  rowCount++;

  button = new QPushButton( "Insert Page", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( insertPage() ) );
  rowCount++;

  button = new QPushButton( "Delete Page", this );
  layout->addWidget( button, rowCount, 1 );
  connect( button, SIGNAL( clicked() ), this, SLOT( deletePage() ) );
  rowCount++;

  KPageWidgetItem *item = mWidget->addPage( new QPushButton( "folder" ), "folder" );
  item->setIcon( KIcon( "folder" ) );
  item = mWidget->addSubPage( item, new QPushButton( "subfolder" ), "subfolder" );
  item->setIcon( KIcon( "folder" ) );
  item = mWidget->addPage( new QLabel( "second folder" ), "second folder" );
  item->setIcon( KIcon( "folder" ) );
}
Example #13
0
void KCPageManager::layoutPages()
{
    const KCSheet* sheet = d->sheet;
    const KCPrintSettings settings = d->settings;
    d->pages.clear();
    clearPages();
    int pageNumber = 1;
    preparePage(pageNumber);

    if (settings.pageOrder() == KCPrintSettings::LeftToRight) {
//         kDebug() << "processing printRanges" << settings.printRegion();
        // iterate over the print ranges
        KCRegion::ConstIterator end = settings.printRegion().constEnd();
        for (KCRegion::ConstIterator it = settings.printRegion().constBegin(); it != end; ++it) {
            if (!(*it)->isValid())
                continue;

            // limit the print range to the used area
            const QRect printRange = (*it)->rect() & sheet->usedArea(true);
//             kDebug() << "processing printRange" << printRange;

            int rows = 0;
            double height = 0.0;
            for (int row = printRange.top(); row <= printRange.bottom(); ++row) {
                rows++;
                height += sheet->rowFormat(row)->visibleHeight();

                // 1. find the number of rows per page
                if (row == printRange.bottom()) // always iterate over the last 'page row'
                    ;
                else if (height + sheet->rowFormat(row + 1)->visibleHeight() <= size(pageNumber).height())
                    continue;

//                 kDebug() << "1. done: row" << row << "rows" << rows << "height" << height;

                int columns = 0;
                double width = 0.0;
                // 2. iterate over the columns and create the pages
                for (int col = printRange.left(); col < printRange.right(); ++col) {
                    columns++;
                    width += sheet->columnFormat(col)->visibleWidth();

                    // Does the next column fit too?
                    if (width + sheet->columnFormat(col + 1)->visibleWidth() <= size(pageNumber).width())
                        continue;

//                     kDebug() << "col" << col << "columns" << columns << "width" << width;
                    const QRect cellRange(col - columns + 1, row - rows + 1, columns, rows);
                    if (pageNeedsPrinting(cellRange)) {
                        d->pages.append(cellRange);
                        insertPage(pageNumber++);
                        preparePage(pageNumber); // prepare the next page
                    }
                    columns = 0;
                    width = 0.0;
                }
                // Always insert a page for the last column
                columns++;
                const QRect cellRange(printRange.right() - columns + 1, row - rows + 1, columns, rows);
                if (pageNeedsPrinting(cellRange)) {
                    d->pages.append(cellRange);
                    insertPage(pageNumber);
                    pageNumber++;
                }

                // 3. prepare for the next row of pages
                if (row != printRange.bottom()) {
                    preparePage(pageNumber);
                }
                rows = 0;
                height = 0.0;
            }
        }
    } else { // if (settings.pageOrder() == KCPrintSettings::TopToBottom)
//         kDebug() << "processing printRanges" << settings.printRegion();
        // iterate over the print ranges
        KCRegion::ConstIterator end = settings.printRegion().constEnd();
        for (KCRegion::ConstIterator it = settings.printRegion().constBegin(); it != end; ++it) {
            if (!(*it)->isValid())
                continue;

            // limit the print range to the used area
            const QRect printRange = (*it)->rect() & sheet->usedArea();
            kDebug() << "processing printRange" << printRange;

            int columns = 0;
            double width = 0.0;
            for (int col = printRange.left(); col <= printRange.right(); ++col) {
                columns++;
                width += sheet->columnFormat(col)->visibleWidth();

                // 1. find the number of columns per page
                if (col == printRange.right()) // always iterate over the last 'page column'
                    ;
                else if (width + sheet->columnFormat(col + 1)->visibleWidth() <= size(pageNumber).width())
                    continue;

//                 kDebug() << "1. done: col" << col << "columns" << columns << "width" << width;

                int rows = 0;
                double height = 0.0;
                // 2. iterate over the rows and create the pages
                for (int row = printRange.top(); row < printRange.bottom(); ++row) {
                    rows++;
                    height += sheet->rowFormat(row)->visibleHeight();

                    // Does the next row fit too?
                    if (height + sheet->rowFormat(row + 1)->visibleHeight() <= size(pageNumber).height())
                        continue;

//                     kDebug() << "row" << row << "rows" << rows << "height" << height;
                    const QRect cellRange(col - columns + 1, row - rows + 1, columns, rows);
                    if (pageNeedsPrinting(cellRange)) {
                        d->pages.append(cellRange);
                        insertPage(pageNumber++);
                        preparePage(pageNumber); // prepare the next page
                    }
                    rows = 0;
                    height = 0.0;
                }
                // Always insert a page for the last row
                rows++;
                const QRect cellRange(col - columns + 1, printRange.bottom() - rows + 1, columns, rows);
                if (pageNeedsPrinting(cellRange)) {
                    d->pages.append(cellRange);
                    insertPage(pageNumber);
                    pageNumber++;
                }

                // 3. prepare for the next column of pages
                if (col != printRange.right()) {
                    preparePage(pageNumber);
                }
                columns = 0;
                width = 0.0;
            }
        }
    }
    kDebug() << d->pages.count() << "page(s) created";
}
Example #14
0
void KoPAView::initActions()
{
    KAction *action = actionCollection()->addAction( KStandardAction::Cut, "edit_cut", 0, 0);
    new KoCutController(kopaCanvas(), action);
    action = actionCollection()->addAction( KStandardAction::Copy, "edit_copy", 0, 0 );
    new KoCopyController(kopaCanvas(), action);
    d->editPaste = actionCollection()->addAction( KStandardAction::Paste, "edit_paste", proxyObject, SLOT( editPaste() ) );
    connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
    connect(d->canvas->toolProxy(), SIGNAL(toolChanged(const QString&)), this, SLOT(clipboardDataChanged()));
    clipboardDataChanged();
    actionCollection()->addAction(KStandardAction::SelectAll,  "edit_select_all", this, SLOT(editSelectAll()));
    actionCollection()->addAction(KStandardAction::Deselect,  "edit_deselect_all", this, SLOT(editDeselectAll()));

    d->deleteSelectionAction = new KAction(KIcon("edit-delete"), i18n("D&elete"), this);
    actionCollection()->addAction("edit_delete", d->deleteSelectionAction );
    d->deleteSelectionAction->setShortcut(QKeySequence("Del"));
    d->deleteSelectionAction->setEnabled(false);
    connect(d->deleteSelectionAction, SIGNAL(triggered()), this, SLOT(editDeleteSelection()));
    connect(d->canvas->toolProxy(),    SIGNAL(selectionChanged(bool)),
            d->deleteSelectionAction, SLOT(setEnabled(bool)));

    KToggleAction *showGrid= d->doc->gridData().gridToggleAction(d->canvas);
    actionCollection()->addAction("view_grid", showGrid );

    d->actionViewSnapToGrid = new KToggleAction(i18n("Snap to Grid"), this);
    d->actionViewSnapToGrid->setChecked(d->doc->gridData().snapToGrid());
    actionCollection()->addAction("view_snaptogrid", d->actionViewSnapToGrid);
    connect( d->actionViewSnapToGrid, SIGNAL( triggered( bool ) ), this, SLOT (viewSnapToGrid( bool )));

    KToggleAction *actionViewShowGuides = KoStandardAction::showGuides(this, SLOT(viewGuides(bool)), this);
    actionViewShowGuides->setChecked( d->doc->guidesData().showGuideLines() );
    actionCollection()->addAction(KoStandardAction::name(KoStandardAction::ShowGuides),
            actionViewShowGuides );

    d->actionViewShowMasterPages = new KToggleAction(i18n( "Show Master Pages" ), this );
    actionCollection()->addAction( "view_masterpages", d->actionViewShowMasterPages );
    connect( d->actionViewShowMasterPages, SIGNAL( triggered( bool ) ), this, SLOT( setMasterMode( bool ) ) );

    d->viewRulers  = new KToggleAction(i18n("Show Rulers"), this);
    actionCollection()->addAction("view_rulers", d->viewRulers );
    d->viewRulers->setToolTip(i18n("Show/hide the view's rulers"));
    connect(d->viewRulers, SIGNAL(triggered(bool)), proxyObject, SLOT(setShowRulers(bool)));
    setShowRulers(d->doc->rulersVisible());

    d->actionInsertPage = new KAction( KIcon("document-new"), i18n( "Insert Page" ), this );
    actionCollection()->addAction( "page_insertpage", d->actionInsertPage );
    d->actionInsertPage->setToolTip( i18n( "Insert a new page after the current one" ) );
    d->actionInsertPage->setWhatsThis( i18n( "Insert a new page after the current one" ) );
    connect( d->actionInsertPage, SIGNAL( triggered() ), proxyObject, SLOT( insertPage() ) );

    d->actionCopyPage = new KAction( i18n( "Copy Page" ), this );
    actionCollection()->addAction( "page_copypage", d->actionCopyPage );
    d->actionCopyPage->setToolTip( i18n( "Copy the current page" ) );
    d->actionCopyPage->setWhatsThis( i18n( "Copy the current page" ) );
    connect( d->actionCopyPage, SIGNAL( triggered() ), this, SLOT( copyPage() ) );

    d->actionDeletePage = new KAction( i18n( "Delete Page" ), this );
    d->actionDeletePage->setEnabled( d->doc->pageCount() > 1 );
    actionCollection()->addAction( "page_deletepage", d->actionDeletePage );
    d->actionDeletePage->setToolTip( i18n( "Delete the current page" ) );
    d->actionDeletePage->setWhatsThis( i18n( "Delete the current page" ) );
    connect( d->actionDeletePage, SIGNAL( triggered() ), this, SLOT( deletePage() ) );

    d->actionMasterPage = new KAction(i18n("Master Page..."), this);
    actionCollection()->addAction("format_masterpage", d->actionMasterPage);
    connect(d->actionMasterPage, SIGNAL(triggered()), this, SLOT(formatMasterPage()));

    d->actionPageLayout = new KAction( i18n( "Page Layout..." ), this );
    actionCollection()->addAction( "format_pagelayout", d->actionPageLayout );
    connect( d->actionPageLayout, SIGNAL( triggered() ), this, SLOT( formatPageLayout() ) );

    actionCollection()->addAction(KStandardAction::Prior,  "page_previous", this, SLOT(goToPreviousPage()));
    actionCollection()->addAction(KStandardAction::Next,  "page_next", this, SLOT(goToNextPage()));
    actionCollection()->addAction(KStandardAction::FirstPage,  "page_first", this, SLOT(goToFirstPage()));
    actionCollection()->addAction(KStandardAction::LastPage,  "page_last", this, SLOT(goToLastPage()));

    KActionMenu *actionMenu = new KActionMenu(i18n("Variable"), this);
    foreach(QAction *action, d->doc->inlineTextObjectManager()->createInsertVariableActions(d->canvas))
        actionMenu->addAction(action);
    actionCollection()->addAction("insert_variable", actionMenu);

    KAction * am = new KAction(i18n("Import Document..."), this);
    actionCollection()->addAction("import_document", am);
    connect(am, SIGNAL(triggered()), this, SLOT(importDocument()));

    d->actionConfigure = new KAction(KIcon("configure"), i18n("Configure..."), this);
    actionCollection()->addAction("configure", d->actionConfigure);
    connect(d->actionConfigure, SIGNAL(triggered()), this, SLOT(configure()));

    d->find = new KoFind( this, d->canvas->resourceManager(), actionCollection() );

    actionCollection()->action( "object_group" )->setShortcut( QKeySequence( "Ctrl+G" ) );
    actionCollection()->action( "object_ungroup" )->setShortcut( QKeySequence( "Ctrl+Shift+G" ) );
}