void kSpaceSetup::slotOk() { KConfig *config = klock_config(); config->setGroup( "Settings" ); TQString sspeed; sspeed.setNum( speed ); config->writeEntry( "Speed", sspeed ); TQString interval; interval.setNum( (int)warpinterval ); config->writeEntry( "WarpInterval", interval ); config->sync(); delete config; accept(); }
/** Ok pressed - save settings and exit */ void KEuphoriaSetup::slotOk() { KConfig* config = KGlobal::config(); config->setGroup("Settings"); TQString val; val.setNum( modeW->currentItem() ); config->writeEntry("Mode", val ); config->sync(); accept(); }
void TDECompletion::extractStringsFromNode( const TDECompTreeNode *node, const TQString& beginning, TDECompletionMatchesWrapper *matches, bool addWeight ) const { if ( !node || !matches ) return; // kDebug() << "Beginning: " << beginning << endl; const TDECompTreeChildren *list = node->children(); TQString string; TQString w; // loop thru all children for ( TDECompTreeNode *cur = list->begin(); cur ; cur = cur->next) { string = beginning; node = cur; if ( !node->isNull() ) string += *node; while ( node && node->childrenCount() == 1 ) { node = node->firstChild(); if ( node->isNull() ) break; string += *node; } if ( node && node->isNull() ) { // we found a leaf if ( addWeight ) { // add ":num" to the string to store the weighting string += ':'; w.setNum( node->weight() ); string.append( w ); } matches->append( node->weight(), string ); } // recursively find all other strings. if ( node && node->childrenCount() > 1 ) extractStringsFromNode( node, string, matches, addWeight ); } }
void KBlendWidget::paintEvent(TQPaintEvent */*ev*/) { TQTime time; int it, ft; TQString say; image = TQImage("testimage.png"); TQPainter p(this); p.setPen(Qt::black); // you see here use of anti_dir param (blend from down to up, here) time.start(); it = time.elapsed(); KImageEffect::blend(image, 0.2, bgnd, KImageEffect::VerticalGradient,true); ft = time.elapsed(); say.setNum( ft - it); say += " ms, Vertical"; p.drawImage(20, 20, image); p.drawText(5 , 15, say); image = TQImage("testimage.png"); // here a negative initial intensity is used (1/2 of image is unaffected) it = time.elapsed(); KImageEffect::blend(image, -0.5, bgnd, KImageEffect::HorizontalGradient); ft = time.elapsed(); say.setNum( ft - it); say += " ms, Horizontal"; p.drawImage(40+image.width(), 20, image); p.drawText(15+image.width() , 15, say); image = TQImage("testimage.png"); it = time.elapsed(); KImageEffect::blend(image, 0., bgnd, KImageEffect::DiagonalGradient,true); ft = time.elapsed(); say.setNum( ft - it); say += " ms, Diagonal"; p.drawImage(20, 40+image.height(), image); p.drawText(5 , 35+image.height(), say); image = TQImage("testimage.png"); it = time.elapsed(); KImageEffect::blend(image, 0.1, bgnd, KImageEffect::CrossDiagonalGradient); ft = time.elapsed(); say.setNum( ft - it); say += " ms, CrossDiagonal"; p.drawImage(40+image.width(), 40+image.height(), image); p.drawText(25+image.width() , 35 + image.height(), say); image = TQImage("testimage.png"); it = time.elapsed(); KImageEffect::blend(image, -0.6, bgnd, KImageEffect::RectangleGradient); ft = time.elapsed(); say.setNum( ft - it); say += " ms, Rectangle"; p.drawImage(20, 60+2*image.height(), image); p.drawText(5 , 55+2*image.height(), say); image = TQImage("testimage.png"); it = time.elapsed(); KImageEffect::blend(image, 0.2, bgnd, KImageEffect::EllipticGradient); ft = time.elapsed(); say.setNum( ft - it); say += " ms, Elliptic"; p.drawImage(40+image.width(), 60+2*image.height(), image); p.drawText(25+image.width(), 55+2*image.height(), say); p.end(); }
void CpuView::updateCpu(CpuData &cpu, int cpuNumber) { #ifdef Q_OS_LINUX if (!m_procStream) return; bool cpuFound = false; TQString output; TQString parser; TQString cpuString; cpuString.setNum(cpuNumber).prepend("cpu"); // Parse the proc file while (!m_procStream->atEnd()) { parser = m_procStream->readLine(); // remove all the entries apart from the line containing 'cpuString' if (!cpuFound && parser.find(TQRegExp(cpuString)) != -1) { output = parser; cpuFound = true; } } TQStringList cpuList = TQStringList::split(' ', output); if (!cpuList.isEmpty()) { cpu.name = cpuList[0].stripWhiteSpace(); cpu.user = cpuList[1].toULong(); cpu.nice = cpuList[2].toULong(); cpu.sys = cpuList[3].toULong(); cpu.idle = cpuList[4].toULong(); } fseek(m_procFile, 0L, SEEK_SET); #endif #ifdef __DragonFly__ struct kinfo_cputime cp_time; if (kinfo_get_sched_cputime(&cp_time)) err(1, "kinfo_get_sched_cputime"); cpu.user = cp_time.cp_user; cpu.nice = cp_time.cp_nice; cpu.sys = cp_time.cp_sys; cpu.idle = cp_time.cp_idle; #elif defined(Q_OS_FREEBSD) #warning "add support for SMP on FreeBSD" Q_UNUSED(cpuNumber); static int name2oid[2] = { 0, 3 }; static int oidCpuTime[CTL_MAXNAME + 2]; static size_t oidCpuTimeLen = sizeof(oidCpuTime); long cpuTime[CPUSTATES]; size_t cpuTimeLen = sizeof(cpuTime); static char name[] = "kern.cp_time"; static int initialized = 0; if (!initialized) { if (sysctl(name2oid, 2, oidCpuTime, &oidCpuTimeLen, name, strlen(name)) < 0) return; oidCpuTimeLen /= sizeof(int); initialized = 1; } if (sysctl(oidCpuTime, oidCpuTimeLen, cpuTime, &cpuTimeLen, 0, 0) < 0) return; cpu.user = cpuTime[CP_USER]; cpu.nice = cpuTime[CP_NICE]; cpu.sys = cpuTime[CP_SYS]; cpu.idle = cpuTime[CP_IDLE]; #endif #if defined(Q_OS_NETBSD) #define KERN_CPTIME KERN_CP_TIME #endif #if defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD) //#warning "add support for SMP on OpenBSD and NetBSD" int name2oid[2] = { CTL_KERN, KERN_CPTIME }; long cpuTime[CPUSTATES]; size_t cpuTimeLen = sizeof(cpuTime); if (sysctl(name2oid, 2, &cpuTime, &cpuTimeLen, 0, 0) < 0) return; cpu.user = cpuTime[CP_USER]; cpu.nice = cpuTime[CP_NICE]; cpu.sys = cpuTime[CP_SYS]; cpu.idle = cpuTime[CP_IDLE]; #endif }