void NCPreview::slotLast() { if ( pageNo < pageCount ) { pageNo = pageCount; refreshPage(); } }
void NCPreview::slotFirst() { if ( pageNo != 1 ) { pageNo = 1; refreshPage(); } }
void NCPreview::slotPrev() { if ( pageNo > 1 ) { pageNo--; refreshPage(); } }
void NCPreview::slotNext() { if ( pageNo < pageCount ) { pageNo++; refreshPage(); } }
void Spellbook::previousPage() { /* Don't go further than first page. */ if( curPage == 0 ) { return; } --curPage; refreshPage(); }
void NCPreview::slotGoTo() { bool ok = FALSE; int res = QInputDialog::getInteger( this, tr( "Go to page" ), tr( "Page number:" ), 1, 1, pageCount, 1, &ok ); if ( ok ) { //picList.at( res-1 ); pageNo = res; refreshPage(); } else ;// user pressed cancel }
void Spellbook::nextPage() { /* Don't go to a page with no spells on it. */ size_t numSlots = spellSlot.size(); size_t numSpells = inscribedSpells.size(); if ( numSlots * (curPage+1) >= numSpells ) { return; } ++curPage; refreshPage(); }
void Spellbook::clear() { inscribedSpells.clear(); refreshPage(); }
void Spellbook::reloadSpellsFromPlayer() { inscribedSpells = player->getSpellbook(); refreshPage(); }
NCPreview::NCPreview( int height, int width, QList<QPicture*>& piclist, QWidget * parent, const char * name, Qt::WFlags f, NCIconFactoryBase* factory ) : QMainWindow( parent, f ) { picList = piclist; //save QList<QPicture> reference to picList iconFactory = 0; setObjectName( name ); setIconFactory( factory ); formInitDone = FALSE; //picList //plist->list().first(); pageCount = picList.count(); //picList.setAutoDelete(TRUE); deleteReportOnClose = false; //picList = QList( picList); //report = rpt; pvMargin = 20; //basePageWidth = 2100; //basePageHeight = 2960; basePageWidth = (int)(width*TRIMFACTOR); basePageHeight = (int)(height*TRIMFACTOR); readSettings(); initTools(); sa = new NCPreviewScrollArea( this ); QWidget *frameWidget = new QWidget( sa ); //frameWidget->resize( basePageWidth + pvMargin*4, basePageHeight + pvMargin*4 ); //frameWidget->setBackgroundRole(QPalette::Dark); currentPage = new NCPreviewPage( frameWidget ); currentPage->setContainer( frameWidget ); currentPage->setContainerMargin( pvMargin ); //currentPage->resize( basePageWidth, basePageHeight ); currentPage->setPageSize( basePageWidth, basePageHeight ); currentPage->move( pvMargin, pvMargin ); sa->setWidget( frameWidget ); //currentPage->setPicture( picList.current() ); pageNo = 1; refreshPage(); currentPage->zoom( 100 ); //svw->setWidget( currentPage, pvMargin, pvMargin); //svw->show(); /* currentPage->setFrameShadow( QFrame::Plain ); currentPage->setFrameStyle( QFrame::Box ); currentPage->setFrameShape( QFrame::Box ); currentPage->setLineWidth(1); */ //pageList.append( currentPage ); setCentralWidget( sa ); setWindowTitle( tr("Report print preview") ); setWindowIcon( QIcon( mImagesPath + "/app.png" ) ); }
LogicPasteApp::LogicPasteApp(Application *app) : QObject(app), loginSheet_(NULL), ignoreSettingsEvent_(false) { qDebug() << "LogicPasteApp::LogicPasteApp()"; QCoreApplication::setOrganizationName("LogicProbe"); QCoreApplication::setApplicationName("LogicPaste"); qRegisterMetaType<PasteListing>("PasteListing"); pasteModel_ = new PasteModel(this); QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); qml->setContextProperty("cs", this); qml->setContextProperty("model", pasteModel_); AppSettings *appSettings = AppSettings::instance(); if(!qml->hasErrors()) { tabbedPane_ = qml->createRootObject<TabbedPane>(); if(tabbedPane_) { // Paste page pastePage_ = tabbedPane_->findChild<Page*>("pastePage"); connect(pastePage_, SIGNAL(submitPaste()), this, SLOT(onSubmitPaste())); replaceDropDown(pastePage_, "formatDropDown"); // History page historyNav_ = tabbedPane_->findChild<NavigationPane*>("historyPage"); connect(historyNav_, SIGNAL(popTransitionEnded(bb::cascades::Page*)), this, SLOT(onPopFinished(bb::cascades::Page*))); historyPage_ = historyNav_->findChild<Page*>("pasteListPage"); connect(historyPage_, SIGNAL(refreshPage()), pasteModel_, SLOT(refreshHistory())); ListView *historyList = historyPage_->findChild<ListView*>("pasteList"); historyList->setDataModel(pasteModel_->historyModel()); connect(historyList, SIGNAL(openPaste(QString)), this, SLOT(onOpenHistoryPaste(QString))); connect(historyList, SIGNAL(copyUrl(QString)), this, SLOT(onCopyText(QString))); connect(historyList, SIGNAL(deletePaste(QString)), this, SLOT(onDeleteHistoryPaste(QString))); connect(pasteModel_, SIGNAL(historyUpdating()), historyPage_, SLOT(onRefreshStarted())); connect(pasteModel_, SIGNAL(historyUpdated(bool)), this, SLOT(onHistoryRefreshComplete(bool))); // Trending page trendingNav_ = tabbedPane_->findChild<NavigationPane*>("trendingPage"); connect(trendingNav_, SIGNAL(popTransitionEnded(bb::cascades::Page*)), this, SLOT(onPopFinished(bb::cascades::Page*))); trendingPage_ = trendingNav_->findChild<Page*>("pasteListPage"); trendingPage_->findChild<ActionItem*>("refreshAction")->setEnabled(true); connect(trendingPage_, SIGNAL(refreshPage()), pasteModel_, SLOT(refreshTrending())); ListView *trendingList = trendingPage_->findChild<ListView*>("pasteList"); trendingList->setDataModel(pasteModel_->trendingModel()); connect(trendingList, SIGNAL(openPaste(QString)), this, SLOT(onOpenTrendingPaste(QString))); connect(trendingList, SIGNAL(copyUrl(QString)), this, SLOT(onCopyText(QString))); connect(pasteModel_, SIGNAL(trendingUpdating()), trendingPage_, SLOT(onRefreshStarted())); connect(pasteModel_, SIGNAL(trendingUpdated(bool)), this, SLOT(onTrendingRefreshComplete(bool))); // Settings page settingsPage_ = tabbedPane_->findChild<Page*>("settingsPage"); CheckBox *sslCheckBox = settingsPage_->findChild<CheckBox *>("sslCheckBox"); sslCheckBox->setChecked(appSettings->useSsl()); CheckBox *formatterEnable = settingsPage_->findChild<CheckBox*>("formatterEnable"); formatterEnable->setChecked(appSettings->formatterEnabled()); CheckBox *formatterLineNumbering = settingsPage_->findChild<CheckBox*>("formatterLineNumbering"); formatterLineNumbering->setChecked(appSettings->formatterLineNumbering()); DropDown *formatterStyle = settingsPage_->findChild<DropDown*>("formatterStyle"); for(int i = formatterStyle->count() - 1; i >= 0; --i) { if(formatterStyle->at(i)->value() == appSettings->formatterStyle()) { formatterStyle->setSelectedIndex(i); break; } } connect(settingsPage_, SIGNAL(requestLogin()), this, SLOT(onRequestLogin())); connect(settingsPage_, SIGNAL(requestLogout()), this, SLOT(onRequestLogout())); connect(settingsPage_, SIGNAL(refreshUserDetails()), pasteModel_, SLOT(refreshUserDetails())); connect(settingsPage_, SIGNAL(connectionSettingsChanged()), this, SLOT(onConnectionSettingsChanged())); connect(settingsPage_, SIGNAL(pasteSettingsChanged()), this, SLOT(onPasteSettingsChanged())); connect(settingsPage_, SIGNAL(formatterSettingsChanged()), this, SLOT(onFormatterSettingsChanged())); connect(pasteModel_, SIGNAL(userDetailsUpdated()), this, SLOT(onUserDetailsUpdated())); connect(pasteModel_, SIGNAL(userDetailsError(QString)), this, SLOT(onUserDetailsError(QString))); connect(pasteModel_, SIGNAL(userAvatarUpdated()), this, SLOT(onUserAvatarUpdated())); connect(pasteModel_, SIGNAL(deletePasteError(PasteListing,QString)), this, SLOT(onDeletePasteError(PasteListing,QString))); FormatDropDown *formatDropDown = replaceDropDown(settingsPage_, "formatDropDown"); connect(formatDropDown, SIGNAL(selectedIndexChanged(int)), this, SLOT(onPasteSettingsChanged())); // Tabbed pane connect(tabbedPane_, SIGNAL(activePaneChanged(bb::cascades::AbstractPane*)), this, SLOT(onActivePaneChanged(bb::cascades::AbstractPane*))); app->setScene(tabbedPane_); // Create the pull-down menu ActionItem *aboutItem = ActionItem::create() .title(tr("About")) .image(QUrl("asset:///images/action-about.png")); connect(aboutItem, SIGNAL(triggered()), this, SLOT(onAboutActionTriggered())); Menu *menu = Menu::create() .addAction(aboutItem); app->setMenu(menu); if(pasteModel_->isAuthenticated()) { onUserDetailsUpdated(); onUserAvatarUpdated(); } refreshPastePageDefaults(); refreshMainActions(); } }