void ObxTreeView::reportPosition() { emit positionChanged(currentPage(), pages()); }
bool CertWizard::validateCurrentPage() { if (currentPage() == qwpNew) { QRegExp ereg(QLatin1String("(^$)|((.+)@(.+))"), Qt::CaseInsensitive, QRegExp::RegExp2); if (!ereg.exactMatch(qleEmail->text())) { qlError->setText(tr("Unable to validate email.<br />Enter a valid (or blank) email to continue.")); qwpNew->setComplete(false); return false; } else { kpNew = generateNewCert(qleName->text(), qleEmail->text()); if (! validateCert(kpNew)) { qlError->setText(tr("There was an error generating your certificate.<br />Please try again.")); return false; } } } if (currentPage() == qwpExport) { QByteArray qba = exportCert(kpNew); if (qba.isEmpty()) { QToolTip::showText(qleExportFile->mapToGlobal(QPoint(0,0)), tr("Your certificate and key could not be exported to PKCS#12 format. There might be an error in your certificate."), qleExportFile); return false; } QFile f(qleExportFile->text()); if (! f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Unbuffered)) { QToolTip::showText(qleExportFile->mapToGlobal(QPoint(0,0)), tr("The file could not be opened for writing. Please use another file."), qleExportFile); return false; } if (! f.setPermissions(QFile::ReadOwner | QFile::WriteOwner)) { QToolTip::showText(qleExportFile->mapToGlobal(QPoint(0,0)), tr("The file's permissions could not be set. No certificate and key has been written. Please use another file."), qleExportFile); return false; } qint64 written = f.write(qba); f.close(); if (written != qba.length()) { QToolTip::showText(qleExportFile->mapToGlobal(QPoint(0,0)), tr("The file could not be written successfully. Please use another file."), qleExportFile); return false; } } if (currentPage() == qwpImport) { QFile f(qleImportFile->text()); if (! f.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) { QToolTip::showText(qleImportFile->mapToGlobal(QPoint(0,0)), tr("The file could not be opened for reading. Please use another file."), qleImportFile); return false; } QByteArray qba = f.readAll(); f.close(); if (qba.isEmpty()) { QToolTip::showText(qleImportFile->mapToGlobal(QPoint(0,0)), tr("The file is empty or could not be read. Please use another file."), qleImportFile); return false; } QPair<QList<QSslCertificate>, QSslKey> imp = importCert(qba, qlePassword->text()); if (! validateCert(imp)) { QToolTip::showText(qleImportFile->mapToGlobal(QPoint(0,0)), tr("The file did not contain a valid certificate and key. Please use another file."), qleImportFile); return false; } kpNew = imp; } if (currentPage() == qwpFinish) { g.s.kpCertificate = kpNew; } return QWizard::validateCurrentPage(); }
bool KNetAttach::validateCurrentPage() { if (currentPage() == _folderType){ _host->setFocus(); _connectionName->setFocus(); if (_webfolder->isChecked()) { setInformationText("WebFolder"); updateForProtocol("WebFolder"); _port->setValue(80); } else if (_fish->isChecked()) { setInformationText("Fish"); updateForProtocol("Fish"); _port->setValue(22); } else if (_ftp->isChecked()) { setInformationText("FTP"); updateForProtocol("FTP"); _port->setValue(21); if (_path->text().isEmpty()) { _path->setText("/"); } } else if (_smb->isChecked()) { setInformationText("SMB"); updateForProtocol("SMB"); } else { //if (_recent->isChecked()) { KConfig recent( "krecentconnections", KConfig::NoGlobals ); if (!recent.hasGroup(_recentConnectionName->currentText())) { KConfigGroup group = recent.group("General"); QStringList idx = group.readEntry("Index",QStringList()); if (idx.isEmpty()) { _recent->setEnabled(false); if (_recent->isChecked()) { _webfolder->setChecked(true); } } else { _recent->setEnabled(true); _recentConnectionName->addItems(idx); } return false; } KConfigGroup group = recent.group(_recentConnectionName->currentText()); _type = group.readEntry("Type"); setInformationText(_type); if (!updateForProtocol(_type)) { // FIXME: handle error } KUrl u(group.readEntry("URL")); _host->setText(u.host()); _user->setText(u.user()); _path->setText(u.path()); if (group.hasKey("Port")) { _port->setValue(group.readEntry("Port",0)); } else { _port->setValue(u.port()); } _connectionName->setText(_recentConnectionName->currentText()); _createIcon->setChecked(false); } updateParametersPageStatus(); }else{ button(BackButton)->setEnabled(false); button(FinishButton)->setEnabled(false); KUrl url; if (_type == "WebFolder") { if (_useEncryption->isChecked()) { url.setProtocol("webdavs"); } else { url.setProtocol("webdav"); } url.setPort(_port->value()); } else if (_type == "Fish") { KConfig config("kio_fishrc"); KConfigGroup cg(&config, _host->text().trimmed()); cg.writeEntry("Charset", KCharsets::charsets()->encodingForName(_encoding->currentText())); url.setProtocol(_protocolText->currentText()); url.setPort(_port->value()); } else if (_type == "FTP") { url.setProtocol("ftp"); url.setPort(_port->value()); KConfig config("kio_ftprc"); KConfigGroup cg(&config, _host->text().trimmed()); cg.writeEntry("Charset", KCharsets::charsets()->encodingForName(_encoding->currentText())); config.sync(); } else if (_type == "SMB") { url.setProtocol("smb"); } else { // recent } url.setHost(_host->text().trimmed()); url.setUser(_user->text().trimmed()); QString path = _path->text().trimmed(); #ifndef Q_WS_WIN // could a relative path really be made absolute by simply prepending a '/' ? if (!path.startsWith('/')) { path = QString("/") + path; } #endif url.setPath(path); _folderParameters->setEnabled(false); bool success = doConnectionTest(url); _folderParameters->setEnabled(true); if (!success) { KMessageBox::sorry(this, i18n("Unable to connect to server. Please check your settings and try again.")); button(BackButton)->setEnabled(true); return false; } KRun::runUrl(url, "inode/directory", this); QString name = _connectionName->text().trimmed(); if (_createIcon->isChecked()) { KGlobal::dirs()->addResourceType("remote_entries", "data", "remoteview"); QString path = KGlobal::dirs()->saveLocation("remote_entries"); path += name + ".desktop"; KConfig _desktopFile( path, KConfig::SimpleConfig ); KConfigGroup desktopFile(&_desktopFile, "Desktop Entry"); desktopFile.writeEntry("Icon", "folder-remote"); desktopFile.writeEntry("Name", name); desktopFile.writeEntry("Type", "Link"); desktopFile.writeEntry("URL", url.prettyUrl()); desktopFile.writeEntry("Charset", url.fileEncoding()); desktopFile.sync(); org::kde::KDirNotify::emitFilesAdded( QUrl("remote:/") ); } if (!name.isEmpty()) { KConfig _recent("krecentconnections", KConfig::NoGlobals); KConfigGroup recent(&_recent, "General"); QStringList idx = recent.readEntry("Index",QStringList()); _recent.deleteGroup(name); // erase anything stale if (idx.contains(name)) { idx.removeAll(name); idx.prepend(name); recent.writeEntry("Index", idx); } else { QString last; if (!idx.isEmpty()) { last = idx.last(); idx.pop_back(); } idx.prepend(name); _recent.deleteGroup(last); recent.writeEntry("Index", idx); } recent = KConfigGroup(&_recent,name); recent.writeEntry("URL", url.prettyUrl()); if (_type == "WebFolder" || _type == "Fish" || _type == "FTP") { recent.writeEntry("Port", _port->value()); } recent.writeEntry("Type", _type); recent.sync(); } } return true; }
bool KatePrinter::print (KateDocument *doc) { QPrinter printer; readSettings(printer); // docname is now always there, including the right Untitled name printer.setDocName(doc->documentName()); KatePrintTextSettings *kpts = new KatePrintTextSettings; KatePrintHeaderFooter *kphf = new KatePrintHeaderFooter; KatePrintLayout *kpl = new KatePrintLayout; QList<QWidget*> tabs; tabs << kpts; tabs << kphf; tabs << kpl; QWidget *parentWidget=doc->widget(); if ( !parentWidget ) parentWidget=QApplication::activeWindow(); QScopedPointer<QPrintDialog> printDialog(KdePrint::createPrintDialog(&printer, KdePrint::SystemSelectsPages, tabs, parentWidget)); if ( doc->activeView()->selection() ) { printer.setPrintRange(QPrinter::Selection); printDialog->setOption(QAbstractPrintDialog::PrintSelection, true); } if ( printDialog->exec() ) { writeSettings(printer); KateRenderer renderer(doc, doc->activeKateView()); renderer.config()->setSchema (kpl->colorScheme()); renderer.setPrinterFriendly(true); QPainter paint( &printer ); /* * We work in tree cycles: * 1) initialize variables and retrieve print settings * 2) prepare data according to those settings * 3) draw to the printer */ uint pdmWidth = printer.width(); uint pdmHeight = printer.height(); int y = 0; uint xstart = 0; // beginning point for painting lines uint lineCount = 0; uint maxWidth = pdmWidth; int headerWidth = pdmWidth; int startCol = 0; int endCol = 0; bool pageStarted = true; int remainder = 0; // remaining sublines from a wrapped line (for the top of a new page) // Text Settings Page bool selectionOnly = (printDialog->printRange() == QAbstractPrintDialog::Selection); bool useGuide = kpts->printGuide(); bool printLineNumbers = kpts->printLineNumbers(); uint lineNumberWidth( 0 ); // Header/Footer Page QFont headerFont(kphf->font()); // used for header/footer bool useHeader = kphf->useHeader(); QColor headerBgColor(kphf->headerBackground()); QColor headerFgColor(kphf->headerForeground()); uint headerHeight( 0 ); // further init only if needed QStringList headerTagList; // do bool headerDrawBg = false; // do bool useFooter = kphf->useFooter(); QColor footerBgColor(kphf->footerBackground()); QColor footerFgColor(kphf->footerForeground()); uint footerHeight( 0 ); // further init only if needed QStringList footerTagList; // do bool footerDrawBg = false; // do // Layout Page renderer.config()->setSchema( kpl->colorScheme() ); bool useBackground = kpl->useBackground(); bool useBox = kpl->useBox(); int boxWidth(kpl->boxWidth()); QColor boxColor(kpl->boxColor()); int innerMargin = useBox ? kpl->boxMargin() : 6; // Post initialization int maxHeight = (useBox ? pdmHeight-innerMargin : pdmHeight); uint currentPage( 1 ); uint lastline = doc->lastLine(); // necessary to print selection only uint firstline( 0 ); const int fontHeight = renderer.fontHeight(); KTextEditor::Range selectionRange; /* * Now on for preparations... * during preparations, variable names starting with a "_" means * those variables are local to the enclosing block. */ { if ( selectionOnly ) { // set a line range from the first selected line to the last selectionRange = doc->activeView()->selectionRange(); firstline = selectionRange.start().line(); lastline = selectionRange.end().line(); lineCount = firstline; } if ( printLineNumbers ) { // figure out the horiizontal space required QString s( QString("%1 ").arg( doc->lines() ) ); s.fill('5', -1); // some non-fixed fonts haven't equally wide numbers // FIXME calculate which is actually the widest... lineNumberWidth = renderer.currentFontMetrics().width( s ); // a small space between the line numbers and the text int _adj = renderer.currentFontMetrics().width( "5" ); // adjust available width and set horizontal start point for data maxWidth -= (lineNumberWidth + _adj); xstart += lineNumberWidth + _adj; } if ( useHeader || useFooter ) { // Set up a tag map // This retrieves all tags, ued or not, but // none of theese operations should be expensive, // and searcing each tag in the format strings is avoided. QDateTime dt = QDateTime::currentDateTime(); QMap<QString,QString> tags; KUser u (KUser::UseRealUserID); tags["u"] = u.loginName(); tags["d"] = KGlobal::locale()->formatDateTime(dt, KLocale::ShortDate); tags["D"] = KGlobal::locale()->formatDateTime(dt, KLocale::LongDate); tags["h"] = KGlobal::locale()->formatTime(dt.time(), false); tags["y"] = KGlobal::locale()->formatDate(dt.date(), KLocale::ShortDate); tags["Y"] = KGlobal::locale()->formatDate(dt.date(), KLocale::LongDate); tags["f"] = doc->url().fileName(); tags["U"] = doc->url().prettyUrl(); if ( selectionOnly ) { QString s( i18n("(Selection of) ") ); tags["f"].prepend( s ); tags["U"].prepend( s ); } QRegExp reTags( "%([dDfUhuyY])" ); // TODO tjeck for "%%<TAG>" if (useHeader) { headerDrawBg = kphf->useHeaderBackground(); headerHeight = QFontMetrics( headerFont ).height(); if ( useBox || headerDrawBg ) headerHeight += innerMargin * 2; else headerHeight += 1 + QFontMetrics( headerFont ).leading(); headerTagList = kphf->headerFormat(); QMutableStringListIterator it(headerTagList); while ( it.hasNext() ) { QString tag = it.next(); int pos = reTags.indexIn( tag ); QString rep; while ( pos > -1 ) { rep = tags[reTags.cap( 1 )]; tag.replace( (uint)pos, 2, rep ); pos += rep.length(); pos = reTags.indexIn( tag, pos ); } it.setValue( tag ); } if (!headerBgColor.isValid()) headerBgColor = Qt::lightGray; if (!headerFgColor.isValid()) headerFgColor = Qt::black; } if (useFooter) { footerDrawBg = kphf->useFooterBackground(); footerHeight = QFontMetrics( headerFont ).height(); if ( useBox || footerDrawBg ) footerHeight += 2*innerMargin; else footerHeight += 1; // line only footerTagList = kphf->footerFormat(); QMutableStringListIterator it(footerTagList); while ( it.hasNext() ) { QString tag = it.next(); int pos = reTags.indexIn( tag ); QString rep; while ( pos > -1 ) { rep = tags[reTags.cap( 1 )]; tag.replace( (uint)pos, 2, rep ); pos += rep.length(); pos = reTags.indexIn( tag, pos ); } it.setValue( tag ); } if (!footerBgColor.isValid()) footerBgColor = Qt::lightGray; if (!footerFgColor.isValid()) footerFgColor = Qt::black; // adjust maxheight, so we can know when/where to print footer maxHeight -= footerHeight; } } // if ( useHeader || useFooter ) if ( useBackground ) { if ( ! useBox ) { xstart += innerMargin; maxWidth -= innerMargin * 2; } } if ( useBox ) { if (!boxColor.isValid()) boxColor = Qt::black; if (boxWidth < 1) // shouldn't be pssible no more! boxWidth = 1; // set maxwidth to something sensible maxWidth -= ( ( boxWidth + innerMargin ) * 2 ); xstart += boxWidth + innerMargin; // maxheight too.. maxHeight -= boxWidth; } else boxWidth = 0; // now that we know the vertical amount of space needed, // it is possible to calculate the total number of pages // if needed, that is if any header/footer tag contains "%P". if ( !headerTagList.filter("%P").isEmpty() || !footerTagList.filter("%P").isEmpty() ) { kDebug(13020)<<"'%P' found! calculating number of pages..."; int pageHeight = maxHeight; if ( useHeader ) pageHeight -= ( headerHeight + innerMargin ); if ( useFooter ) pageHeight -= innerMargin; const int linesPerPage = pageHeight / fontHeight; // kDebug() << "Lines per page:" << linesPerPage; // calculate total layouted lines in the document int totalLines = 0; // TODO: right now ignores selection printing for (int i = firstline; i <= lastline; ++i) { KateLineLayoutPtr rangeptr(new KateLineLayout(doc)); rangeptr->setLine(i); renderer.layoutLine(rangeptr, (int)maxWidth, false); totalLines += rangeptr->viewLineCount(); } int totalPages = (totalLines / linesPerPage) + ((totalLines % linesPerPage) > 0 ? 1 : 0); // kDebug() << "_______ pages:" << (totalLines / linesPerPage); // kDebug() << "________ rest:" << (totalLines % linesPerPage); // TODO: add space for guide if required // if ( useGuide ) // _lt += (guideHeight + (fontHeight /2)) / fontHeight; // substitute both tag lists QString re("%P"); QStringList::Iterator it; for ( it=headerTagList.begin(); it!=headerTagList.end(); ++it ) (*it).replace( re, QString( "%1" ).arg( totalPages ) ); for ( it=footerTagList.begin(); it!=footerTagList.end(); ++it ) (*it).replace( re, QString( "%1" ).arg( totalPages ) ); } } // end prepare block /* On to draw something :-) */ while ( lineCount <= lastline ) { startCol = 0; endCol = 0; if ( y + fontHeight > maxHeight ) { kDebug(13020)<<"Starting new page,"<<lineCount<<"lines up to now."; printer.newPage(); paint.resetTransform(); currentPage++; pageStarted = true; y=0; } if ( pageStarted ) { if ( useHeader ) { paint.setPen(headerFgColor); paint.setFont(headerFont); if ( headerDrawBg ) paint.fillRect(0, 0, headerWidth, headerHeight, headerBgColor); if (headerTagList.count() == 3) { int valign = ( (useBox||headerDrawBg||useBackground) ? Qt::AlignVCenter : Qt::AlignTop ); int align = valign|Qt::AlignLeft; int marg = ( useBox || headerDrawBg ) ? innerMargin : 0; if ( useBox ) marg += boxWidth; QString s; for (int i=0; i<3; i++) { s = headerTagList[i]; if (s.indexOf("%p") != -1) s.replace("%p", QString::number(currentPage)); paint.drawText(marg, 0, headerWidth-(marg*2), headerHeight, align, s); align = valign|(i == 0 ? Qt::AlignHCenter : Qt::AlignRight); } } if ( ! ( headerDrawBg || useBox || useBackground ) ) // draw a 1 px (!?) line to separate header from contents { paint.drawLine( 0, headerHeight-1, headerWidth, headerHeight-1 ); //y += 1; now included in headerHeight } y += headerHeight + innerMargin; } if ( useFooter ) { paint.setPen(footerFgColor); if ( ! ( footerDrawBg || useBox || useBackground ) ) // draw a 1 px (!?) line to separate footer from contents paint.drawLine( 0, maxHeight + innerMargin - 1, headerWidth, maxHeight + innerMargin - 1 ); if ( footerDrawBg ) paint.fillRect(0, maxHeight+innerMargin+boxWidth, headerWidth, footerHeight, footerBgColor); if (footerTagList.count() == 3) { int align = Qt::AlignVCenter|Qt::AlignLeft; int marg = ( useBox || footerDrawBg ) ? innerMargin : 0; if ( useBox ) marg += boxWidth; QString s; for (int i=0; i<3; i++) { s = footerTagList[i]; if (s.indexOf("%p") != -1) s.replace("%p", QString::number(currentPage)); paint.drawText(marg, maxHeight+innerMargin, headerWidth-(marg*2), footerHeight, align, s); align = Qt::AlignVCenter|(i == 0 ? Qt::AlignHCenter : Qt::AlignRight); } } } // done footer if ( useBackground ) { // If we have a box, or the header/footer has backgrounds, we want to paint // to the border of those. Otherwise just the contents area. int _y = y, _h = maxHeight - y; if ( useBox ) { _y -= innerMargin; _h += 2 * innerMargin; } else { if ( headerDrawBg ) { _y -= innerMargin; _h += innerMargin; } if ( footerDrawBg ) { _h += innerMargin; } } paint.fillRect( 0, _y, pdmWidth, _h, renderer.config()->backgroundColor()); } if ( useBox ) { paint.setPen(QPen(boxColor, boxWidth)); paint.drawRect(0, 0, pdmWidth, pdmHeight); if (useHeader) paint.drawLine(0, headerHeight, headerWidth, headerHeight); else y += innerMargin; if ( useFooter ) // drawline is not trustable, grr. paint.fillRect( 0, maxHeight+innerMargin, headerWidth, boxWidth, boxColor ); } if ( useGuide && currentPage == 1 ) { // FIXME - this may span more pages... // draw a box unless we have boxes, in which case we end with a box line int _ystart = y; QString _hlName = doc->highlight()->name(); QList<KateExtendedAttribute::Ptr> _attributes; // list of highlight attributes for the legend doc->highlight()->getKateExtendedAttributeList(kpl->colorScheme(), _attributes); KateAttributeList _defaultAttributes; KateHlManager::self()->getDefaults ( renderer.config()->schema(), _defaultAttributes ); QColor _defaultPen = _defaultAttributes.at(0)->foreground().color(); paint.setPen(_defaultPen); int _marg = 0; if ( useBox ) _marg += (2*boxWidth) + (2*innerMargin); else { if ( useBackground ) _marg += 2*innerMargin; _marg += 1; y += 1 + innerMargin; } // draw a title string QFont _titleFont = renderer.config()->font(); _titleFont.setBold(true); paint.setFont( _titleFont ); QRect _r; paint.drawText( QRect(_marg, y, pdmWidth-(2*_marg), maxHeight - y), Qt::AlignTop|Qt::AlignHCenter, i18n("Typographical Conventions for %1", _hlName ), &_r ); int _w = pdmWidth - (_marg*2) - (innerMargin*2); int _x = _marg + innerMargin; y += _r.height() + innerMargin; paint.drawLine( _x, y, _x + _w, y ); y += 1 + innerMargin; int _widest( 0 ); foreach (const KateExtendedAttribute::Ptr &attribute, _attributes) _widest = qMax(QFontMetrics(attribute->font()).width(attribute->name().section(':',1,1)), _widest); int _guideCols = _w/( _widest + innerMargin ); // draw attrib names using their styles int _cw = _w/_guideCols; int _i(0); _titleFont.setUnderline(true); QString _currentHlName; foreach (const KateExtendedAttribute::Ptr &attribute, _attributes) { QString _hl = attribute->name().section(':',0,0); QString _name = attribute->name().section(':',1,1); if ( _hl != _hlName && _hl != _currentHlName ) { _currentHlName = _hl; if ( _i%_guideCols ) y += fontHeight; y += innerMargin; paint.setFont(_titleFont); paint.setPen(_defaultPen); paint.drawText( _x, y, _w, fontHeight, Qt::AlignTop, _hl + ' ' + i18n("text") ); y += fontHeight; _i = 0; } KTextEditor::Attribute _attr = *_defaultAttributes[attribute->defaultStyleIndex()]; _attr += *attribute; paint.setPen( _attr.foreground().color() ); paint.setFont( _attr.font() ); if (_attr.hasProperty(QTextFormat::BackgroundBrush) ) { QRect _rect = QFontMetrics(_attr.font()).boundingRect(_name); _rect.moveTo(_x + ((_i%_guideCols)*_cw), y); paint.fillRect(_rect, _attr.background() ); } paint.drawText(( _x + ((_i%_guideCols)*_cw)), y, _cw, fontHeight, Qt::AlignTop, _name ); _i++; if ( _i && ! ( _i%_guideCols ) ) y += fontHeight; } if ( _i%_guideCols ) y += fontHeight;// last row not full // draw a box around the legend paint.setPen ( _defaultPen ); if ( useBox ) paint.fillRect( 0, y+innerMargin, headerWidth, boxWidth, boxColor ); else { _marg -=1; paint.drawRect( _marg, _ystart, pdmWidth-(2*_marg), y-_ystart+innerMargin ); } y += ( useBox ? boxWidth : 1 ) + (innerMargin*2); } // useGuide paint.translate(xstart,y); pageStarted = false; } // pageStarted; move on to contents:)
void SettingsPageDlg::undoChanges() { if (currentPage()) { currentPage()->load(); } }
void ReportAssistantDialog::completeChanged(ReportAssistantPage* page, bool isComplete) { if (page == dynamic_cast<ReportAssistantPage*>(currentPage()->widget())) { nextButton()->setEnabled(isComplete); } }
void SettingsPageDlg::setButtonStates() { SettingsPage *sp = currentPage(); ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(sp && sp->hasChanged()); ui.buttonBox->button(QDialogButtonBox::Reset)->setEnabled(sp && sp->hasChanged()); ui.buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(sp && sp->hasDefaults()); }
int ChipCP1121A::vc12RegAddr(int vc4sn, int vc12sn) { if( currentPage() == 0 ) { return HLXCM_PG1 | (vc4sn << 7) | (vc12sn+1); } return HLXCM_PG0 | (vc4sn << 7) | (vc12sn+1); }
Chip_INIT_RESULT ChipCP1121A::ChipInit(void) { uint16 id = regAccess->readReg(ID); if( id != CP1121A_ID ) { id = regAccess->readReg(ID); if( id != CP1121A_ID ) { id = regAccess->readReg(ID); if( id != CP1121A_ID ) { return failed; } } } /* top level */ if( ObjectReference::getOPTMode() ) { regAccess->writeReg(MCR, 0x58); // 77.76MHz mode, STM-1 mode, H12H4A, H12H4B } else { regAccess->writeReg(MCR, 0x59); // 77.76MHz mode, STM-4 mode, H12H4A, H12H4B } regAccess->writeReg(0x0006, 0x0781); regAccess->writeReg(0x0007, 0x1890); //0x1888 id = regAccess->readReg(BHLXMCTL); id &= 0xfffe; regAccess->writeReg(BHLXMCTL, id); //the idle code type is all 0 /* ��ʼ�������Ĵ��� */ uint16 firstPage = 0; uint16 secondPage = 0; if( currentPage() == 0 ) { firstPage = HLXCM_PG1; secondPage = HLXCM_PG0; } else { firstPage = HLXCM_PG0; secondPage = HLXCM_PG1; } static int defultOH[] = {4,5,6,7,0,1,2,3,0,1,2,3,4,5,6,7,0,4}; for( int i = 0; i < 18; i++ ) { regAccess->writeReg(firstPage+(i<<7), defultOH[i]); for( int j = 0; j < 63; j++ ) { uint16 regAddr = firstPage+(i<<7)+j+1; uint16 regValue = ((j+1)<<5) | i | (1<<11); regAccess->writeReg(regAddr, regValue); } } switchPage(); for( int i = 0; i < 18; i++ ) { regAccess->writeReg(secondPage+(i<<7), defultOH[i]); for( int j = 0; j < 63; j++ ) { uint16 regAddr = secondPage+(i<<7)+j+1; uint16 regValue = ((j+1)<<5) | i | (1<<11); regAccess->writeReg(regAddr, regValue); } } /* ��ʼ������Ĵ��� */ for(int i = 0; i < 18; i++ ) { for( int j = 0; j < 63; j++ ) { connectVC12(-1, -1, i, j); } } /* ��ʼ��MAP�Ĵ��� */ for(int i = 0; i < 21; i++ ) { ITUT_T& t = TimeSlot2ITUT::itutFrom(i+1); uint16 regData = (t.tug3<<5) | (t.tug2 << 2) | t.tug1; regData |= (regData << 8); regAccess->writeReg(TUTSCFG+(i+1)*128, regData); regAccess->writeReg(CCR+(i+1)*128, 0x00f9); regAccess->writeReg(PPSCR+(i+1)*128, 0x0004); regAccess->writeReg(TV5K4LINA+(i+1)*128, 0x0004); regAccess->writeReg(TV5K4LINB+(i+1)*128, 0x0004); regAccess->writeReg(TJ2+(i+1)*128, 0x0089); } /* ��ʼ��oh�Ĵ��� */ regAccess->writeReg(0x1480, 0xf010); regAccess->writeReg(0x1580, 0xf010); regAccess->writeReg(0x1680, 0xf010); regAccess->writeReg(0x1780, 0xf010); regAccess->writeReg(0x1c80, 0xf010); regAccess->writeReg(0x1d80, 0xf010); regAccess->writeReg(0x1e80, 0xf010); regAccess->writeReg(0x1f80, 0xf010); regAccess->writeReg(0x14d0, 0x0089); regAccess->writeReg(0x15d0, 0x0089); regAccess->writeReg(0x16d0, 0x0089); regAccess->writeReg(0x17d0, 0x0089); regAccess->writeReg(0x1cd0, 0x0089); regAccess->writeReg(0x1dd0, 0x0089); regAccess->writeReg(0x1ed0, 0x0089); regAccess->writeReg(0x1fd0, 0x0089); regAccess->writeReg(0x1482, 0x0002); regAccess->writeReg(0x1582, 0x0002); regAccess->writeReg(0x1682, 0x0002); regAccess->writeReg(0x1782, 0x0002); regAccess->writeReg(0x1c82, 0x0002); regAccess->writeReg(0x1d82, 0x0002); regAccess->writeReg(0x1e82, 0x0002); regAccess->writeReg(0x1f82, 0x0002); regAccess->writeReg(0x3101, 0x0020); regAccess->writeReg(0x3201, 0x0020); regAccess->writeReg(0x3301, 0x0020); regAccess->writeReg(0x3401, 0x0020); regAccess->writeReg(0x3501, 0x0020); regAccess->writeReg(0x3601, 0x0020); regAccess->writeReg(0x3701, 0x0020); regAccess->writeReg(0x3801, 0x0020); /*��ʼ��DCC�Ĵ���*/ regAccess->writeReg(0x1020, 0x0000); regAccess->writeReg(0x1345, 0x3fee); regAccess->writeReg(0x1B45, 0x3fee); return succeed; }
void ofxSimpleGuiToo::focusPrev(){ currentPage().focusPreviousControl(); }
int ChipCP1121A::vc4RegAddr(int vc4sn) { if( currentPage() == 0 ) { return HLXCR_PG1 + vc4sn; } return HLXCR_PG0 + vc4sn; }
void ofxSimpleGuiToo::focusNext(){ currentPage().focusNextControl(); }
int MaemoPublishingWizardFremantleFree::nextId() const { if (currentPage()->isCommitPage()) return ResultPageId; return QWizard::nextId(); }
QValueList<int> KPrinter::pageList() const { QValueList<int> list; int mp(minPage()), MP(maxPage()); if (mp > 0 && MP > 0 && MP >= mp) { // do something only if bounds specified if (option("kde-current") == "1") { // print only current page int pp = currentPage(); if (pp >= mp && pp <= MP) list.append(pp); } else { // process range specification if (!option("kde-range").isEmpty()) { QStringList ranges = QStringList::split(',',option("kde-range"),false); for (QStringList::ConstIterator it=ranges.begin();it!=ranges.end();++it) { int p = (*it).find('-'); bool ok; if (p == -1) { int pp = (*it).toInt(&ok); if (ok && pp >= mp && pp <= MP) list.append(pp); } else { int p1(0), p2(0); p1 = (*it).left(p).toInt(&ok); if (ok) p2 = (*it).right((*it).length()-p-1).toInt(&ok); if (ok && p1 <= p2) { // clip to min/max p1 = QMAX(mp,p1); p2 = QMIN(MP,p2); for (int i=p1;i<=p2;i++) list.append(i); } } } } else { // add all pages between min and max for (int i=mp;i<=MP;i++) list.append(i); } // revert the list if needed if (pageOrder() == LastPageFirst) { for (uint i=0;i<(list.count()/2);i++) qSwap(list[i],list[list.count()-1-i]); } // select page set if needed if (pageSet() != AllPages) { bool keepEven = (pageSet() == EvenPages); for (QValueList<int>::Iterator it=list.begin();it!=list.end();) if ((((*it) % 2) != 0 && keepEven) || (((*it) % 2) == 0 && !keepEven)) it = list.remove(it); else ++it; } } } return list; }
void Konfigurator::slotReset() { ((KonfiguratorPage *)(currentPage()->widget()))->loadInitialValues(); }
void KexiWelcomeAssistant::tryAgainActionTriggered() { messageWidget()->animatedHide(); currentPage()->next(); }
void Konfigurator::slotRestoreDefaults() { ((KonfiguratorPage *)(currentPage()->widget()))->setDefaults(); }
void KexiWelcomeAssistant::cancelActionTriggered() { if (currentPage() == d->m_passwordPage) { d->passwordPage()->focusWidget()->setFocus(); } }
void SettingsDialog::apply() { did_apply = TRUE; previous_position = pos(); previous_active_tab = currentPage()->name(); accept(); }
QWidget* KexiWelcomeAssistant::calloutWidget() const { return currentPage()->nextButton(); }
bool QtQuickAppWizardDialog::validateCurrentPage() { if (currentPage() == m_componentOptionsPage) setIgnoreGenericOptionsPage(false); return AbstractMobileAppWizardDialog::validateCurrentPage(); }
bool CertWizard::validateCurrentPage() { if (currentPage() == qwpNew) { if (! bValidDomain) { QRegExp ereg(QLatin1String("(.+)@(.+)"), Qt::CaseInsensitive, QRegExp::RegExp2); if (ereg.exactMatch(qleEmail->text())) { const QString &domain = ereg.cap(2); if (! domain.isEmpty()) { qlError->setText(tr("Resolving domain %1.").arg(domain)); bPendingDns = true; iLookupId = QHostInfo::lookupHost(domain, this, SLOT(lookedUp(QHostInfo))); } else bValidDomain = true; } else qlError->setText(tr("Unable to validate email.<br />Enter a valid (or blank) email to continue.")); if (! bValidDomain) { qwpNew->setComplete(false); return false; } } else { kpNew = generateNewCert(qleName->text(), qleEmail->text()); if (! validateCert(kpNew)) { qlError->setText(tr("There was an error generating your certificate.<br />Please try again.")); return false; } } } if (currentPage() == qwpExport) { QByteArray qba = exportCert(kpNew); if (qba.isEmpty()) { QToolTip::showText(qleExportFile->mapToGlobal(QPoint(0,0)), tr("Your certificate and key could not be exported to PKCS#12 format. There might be an error in your certificate."), qleExportFile); return false; } QFile f(qleExportFile->text()); if (! f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Unbuffered)) { QToolTip::showText(qleExportFile->mapToGlobal(QPoint(0,0)), tr("The file could not be opened for writing. Please use another file."), qleExportFile); return false; } qint64 written = f.write(qba); f.close(); if (written != qba.length()) { QToolTip::showText(qleExportFile->mapToGlobal(QPoint(0,0)), tr("The file could not be written successfully. Please use another file."), qleExportFile); return false; } } if (currentPage() == qwpImport) { QFile f(qleImportFile->text()); if (! f.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) { QToolTip::showText(qleImportFile->mapToGlobal(QPoint(0,0)), tr("The file could not be opened for reading. Please use another file."), qleImportFile); return false; } QByteArray qba = f.readAll(); f.close(); if (qba.isEmpty()) { QToolTip::showText(qleImportFile->mapToGlobal(QPoint(0,0)), tr("The file is empty or could not be read. Please use another file."), qleImportFile); return false; } QPair<QList<QSslCertificate>, QSslKey> imp = importCert(qba, qlePassword->text()); if (! validateCert(imp)) { QToolTip::showText(qleImportFile->mapToGlobal(QPoint(0,0)), tr("The file did not contain a valid certificate and key. Please use another file."), qleImportFile); return false; } kpNew = imp; } if (currentPage() == qwpFinish) { g.s.kpCertificate = kpNew; } return QWizard::validateCurrentPage(); }
void MainWindow::contentSizeChanged() { m_page->setPreferredContentsSize(currentPage()->exposedContentRect().size().toSize()); }
void PsiTabWidget::tab_currentChanged(int tab) { // qt 4.4 sends -1 i case of an empty QTabbar, ignore that case. if (tab == -1) return; setCurrentPage(tab); emit currentChanged(currentPage()); }
void HighscoresDialog::slotUser1() { // kDebug(11001) ; if ( KExtHighscore::configure(this) ) highscorePageChanged(currentPage(), 0);//update data }
void PsiTabWidget::removeCurrentPage() { removePage(currentPage()); }
/** * Entered when Apply button pressed. */ void ObjectNodeDialog::slotApply() { applyPage(currentPage()); }
void Konfigurator::slotApply() { emit configChanged(((KonfiguratorPage*)(currentPage()->widget()))->apply()); }
void CDPWizard::formSelected(const QString &thePageNameQString) { QString myQString; QLineEdit *myLineEdit; if (thePageNameQString==tr("Raw data file selection")) { #ifdef QGISDEBUG std::cout << "Opening Raw Data File Selection page" << std::endl; #endif checkInputFilenames(); } if (thePageNameQString==tr("File type and variables")) //we do this after leaving the file selection page { //#ifdef QGISDEBUG std::cout << "Leaving file selection page" << std::endl; //#endif /** @todo Add some checking to make sure each file exists and is readable and valid for its type */ climateDataProcessor->setMeanTempFileName(leMeanTemp->text()); climateDataProcessor->setMinTempFileName(leMinTemp->text()); climateDataProcessor->setMaxTempFileName(leMaxTemp->text()); climateDataProcessor->setDiurnalTempFileName(leDiurnalTemp->text()); climateDataProcessor->setMeanPrecipFileName(leMeanPrecipitation->text()); climateDataProcessor->setFrostDaysFileName(leFrostDays->text()); climateDataProcessor->setTotalSolarRadFileName(leTotalSolarRadiation->text()); //turn off next button until one or more variables have been selected setNextEnabled(currentPage(), false); ///////////////////////////////////////////////////////////////////// // // OK now we need to update the list of available calculations that // can be carried out. // ///////////////////////////////////////////////////////////////////// // // get the input file type // climateDataProcessor->setInputFileType("GDAL Supported Raster"); //Should not need to have the next line here - it slows everythinf down! //climateDataProcessor->makeFileGroups(); //#ifdef QGISDEBUG std::cout << "Getting available calculations list" << std::endl; //#endif climateDataProcessor->makeAvailableCalculationsMap(); // and then update the list box //List the calculations in availableCalculationsMap using an iterator QMap<QString, bool> myAvailableCalculationsMap = climateDataProcessor->getAvailableCalculationsMap(); QMap<QString, bool>::const_iterator myIter; //#ifdef QGISDEBUG std::cout << myAvailableCalculationsMap.size() << " available calculations in list which are:" << std::endl; std::cout << climateDataProcessor->getDescription() << std::endl; //#endif //clear the current entries from the box lstVariablesToCalc->clear(); for (myIter=myAvailableCalculationsMap.begin(); myIter != myAvailableCalculationsMap.end(); myIter++) { if (myIter.data()) { //#ifdef QGISDEBUG std::cout << myIter.key() << QString(": true\n"); //#endif //need to add some logic here to select the inserted item lstVariablesToCalc->insertItem(myIter.key()); } else { #ifdef QGISDEBUG std::cout << myIter->first << QString(": false\n"); #endif //need to add some logic here to select the inserted item lstVariablesToCalc->insertItem(myIter.key()); } } } //end of test for page 3 if (thePageNameQString==tr("Output destination")) //we do this after leaving the file type and variables page { } if (thePageNameQString==tr("Summary of processing to be performed")) //we do this when we arrive at the summary of variables to be calculated { //update the summary of vars to calculate txtVariableSummary->clear(); for ( unsigned int i = 0; i < lstVariablesToCalc->count(); i++ ) { QListBoxItem *item = lstVariablesToCalc->item( i ); // if the item is selected... if ( item->isSelected() ) { // increment the count of selected items txtVariableSummary->append(item->text()); } } //update the output file format summary box leInputFormatSummary->setText("GDAL Supported Raster"); //update the file output path box leOutputPathSummary->setText(leOutputPath->text()); txtInputFileSummary->clear(); txtInputFileSummary->append(leMeanTemp->text()); txtInputFileSummary->append(leMinTemp->text()); txtInputFileSummary->append(leMaxTemp->text()); txtInputFileSummary->append(leDiurnalTemp->text()); txtInputFileSummary->append(leMeanPrecipitation->text()); txtInputFileSummary->append(leMeanPrecipitation->text()); txtInputFileSummary->append(leFrostDays->text()); txtInputFileSummary->append(leTotalSolarRadiation->text()); } //end of test for page 5 if (thePageNameQString==tr("Progress")) //we do this when we start the calculation { qApp->processEvents(); run(); } } //end of formSelected
void ActionListEditor::onRemoveAction() { QModelIndexList currentIndexes = currentPage()->selectionModel()->selectedRows(); foreach (QModelIndex index, currentIndexes) { PimItemServices::remove(PimItemServices::fromIndex(index), this); }