void MediaNotifier::notify(KFileItem &medium) { kdDebug() << "Notification triggered." << endl; NotifierSettings *settings = new NotifierSettings(); if(settings->autoActionForMimetype(medium.mimetype()) == 0L) { QValueList< NotifierAction * > actions = settings->actionsForMimetype(medium.mimetype()); // If only one action remains, it's the "do nothing" action // no need to popup in this case. if(actions.size() > 1) { NotificationDialog *dialog = new NotificationDialog(medium, settings); dialog->show(); } } else { NotifierAction *action = settings->autoActionForMimetype(medium.mimetype()); action->execute(medium); delete settings; } }
int LegendMarker::symbolsMaxLineLength() const { QValueList<int> cvs = d_plot->curveKeys(); int maxL=0; QString text=d_text->text(); QStringList titles=QStringList::split ("\n",text,FALSE); for (int i=0;i<(int)titles.count();i++) { if (titles[i].contains("\\c{") && (int)cvs.size()>0) { int pos=titles[i].find("{",0); int pos2=titles[i].find("}",pos); QString aux=titles[i].mid(pos+1,pos2-pos-1); int cv = aux.toInt()-1; if (cv < 0) continue; const QwtPlotCurve *c = d_plot->curve(cvs[cv]); if (c) { int l=c->symbol().size().width(); if (l>maxL && c->symbol().style() != QwtSymbol::None) maxL=l; } } if (titles[i].contains("\\p{")) maxL=10; } return maxL; }
void ExternalLanguage::displayProcessCommand() { QStringList quotedArguments; QValueList<QCString> arguments = m_languageProcess->args(); if ( arguments.size() == 1 ) quotedArguments << arguments[0]; else { QValueList<QCString>::const_iterator end = arguments.end(); for ( QValueList<QCString>::const_iterator it = arguments.begin(); it != end; ++it ) { if ( (*it).isEmpty() || (*it).contains( QRegExp("[\\s]") ) ) quotedArguments << KProcess::quote( *it ); else quotedArguments << *it; } } // outputMessage( "<i>" + quotedArguments.join(" ") + "</i>" ); outputMessage( quotedArguments.join(" ") ); // LanguageManager::self()->logView()->addOutput( quotedArguments.join(" "), LogView::ot_info ); }
void QwtLegend::PrivateData::LegendMap::clear() { /* We can't delete the widgets in the following loop, because we would get ChildRemoved events, changing d_itemMap, while we are iterating. */ #if QT_VERSION < 0x040000 QValueList<QWidget *> widgets; QMap<const QwtLegendItemManager *, QWidget *>::const_iterator it; for ( it = d_itemMap.begin(); it != d_itemMap.end(); ++it ) widgets.append(it.data()); #else QList<QWidget *> widgets; QMap<const QwtLegendItemManager *, QWidget *>::const_iterator it; for ( it = d_itemMap.begin(); it != d_itemMap.end(); ++it ) widgets.append(it.value()); #endif d_itemMap.clear(); d_widgetMap.clear(); for ( int i = 0; i < (int)widgets.size(); i++ ) delete widgets[i]; }
void ClusterPalette::groupClusters() { QValueList<int> selected = selectedClusters(); //To group clusters, there must be more then one cluster !!! if(selected.size()>1) { emit groupClusters(selected); isUpToDate = true; } }
QValueList<int> NewGameView::selectedRows( const QValueList<QCheckBox *> &checks ) { QValueList<int> rows; for( unsigned int i = 0; i < checks.size(); ++i ) { if ( checks[ i ]->isChecked() ) { rows.append( i + 1 ); } } return rows; }
/* * Returns the list of the chars in this multi */ static PyObject* wpMulti_chars( wpMulti* self, PyObject* args ) { Q_UNUSED(args); if( !self->pMulti || self->pMulti->free ) return PyFalse; QValueList< SERIAL > chars = self->pMulti->chars(); QValueList< SERIAL >::iterator it = chars.begin(); PyObject* list = PyList_New( chars.size() ); while( it != chars.end() ) { P_CHAR pChar = FindCharBySerial( *it ); if( pChar ) PyList_Append( list, PyGetCharObject( pChar ) ); it ++; } return list; }
/* * Returns the list of the items in this multi */ static PyObject* wpMulti_items( wpMulti* self, PyObject* args ) { Q_UNUSED(args); if( !self->pMulti || self->pMulti->free ) return PyFalse; QValueList< SERIAL > items = self->pMulti->items(); QValueList< SERIAL >::iterator it = items.begin(); PyObject* list = PyList_New( items.size() ); while( it != items.end() ) { P_ITEM pItem = FindItemBySerial( *it ); if( pItem ) PyList_Append( list, PyGetItemObject( pItem ) ); it ++; } return list; }
void PMLatheEdit::slotRemovePoint( ) { int row = m_pPoints->currentRow( ); if( row >= 0 ) { QValueList<PMVector> points = m_pPoints->vectors( ); QValueListIterator<PMVector> it = points.at( row ); if( it != points.end( ) && points.size( ) > 1 ) { points.remove( it ); m_pPoints->setVectors( points, true ); updatePointButtons( ); emit dataChanged( ); emit sizeChanged( ); } } }
void GuideUiScheme::continuation_set_length (int nb_rows) { cont->set_nb_rows (nb_rows); if (nb_rows == 0) { env->set_nb_rows (0); mainWindow->removeSpecialSelectionInFiles (); repl->removeSpecialSelection (); } // Open or close the debug frame (continuation & environment) QValueList<int> sizes = splitter9->sizes (); // printf ("sizes[0] = %d\n", sizes[0]); // if (sizes.size () >= 2) // printf ("sizes[1] = %d\n", sizes[1]); // fflush (stdout); if (nb_rows > 0) { contenv->show (); if (sizes.size () >= 2 && sizes[1] > 10 * sizes[0]) { // contenv->show (); sizes[0] = 600; sizes[1] = 400; splitter9->setSizes (sizes); } } else { contenv->hide (); // if (sizes.size () >= 2 && sizes[1] < 10 * sizes[0]) // { // contenv->hide (); // } } }
void ClusterPalette::selectItems(QValueList<int> selectedClusters) { //Set isInSelectItems to true to prevent the emission of signals due to selectionChange isInSelectItems = true; //unselect all the items first iconView->selectAll(false); //Loop on the clusters to be selected QValueList<int>::iterator clusterIterator; ClusterPaletteIconViewItem* currentIcon = 0L; for(clusterIterator = selectedClusters.begin(); clusterIterator != selectedClusters.end(); ++clusterIterator) { currentIcon = static_cast<ClusterPaletteIconViewItem*>(iconView->findItem(QString("%1").arg(*clusterIterator),Qt::BeginsWith)); currentIcon->setSelected(true,true); } //Last item in selection gets focus if it exists if(selectedClusters.size() != 0) iconView->setCurrentItem(currentIcon); //reset isInSelectItems to false to enable again the the emission of signals due to selectionChange isInSelectItems = false; isUpToDate = true; }
/** * Add entries to a variable. Will just add the variables to the existing line, removing duplicates * Will preserve += constructs and make sure that the variable only has one copy of the value across * all += constructs * @param fileName * @param variables key=value string of entries to add * @param add true= add these key,value pairs, false = remove. You can have empty values for an add - the whole line is * removed. For adding, we will not add an empty line. */ void AutoProjectTool::addRemoveMakefileam(const QString &fileName, QMap<QString, QString> variables, bool add) { // input file reading QFile fin(fileName); if (!fin.open(IO_ReadOnly)) { return ; } QTextStream ins(&fin); // output file writing. QFile fout(fileName + "#"); if (!fout.open(IO_WriteOnly)) { fin.close(); return ; } QTextStream outs(&fout); // variables QRegExp re("^(#kdevelop:[ \t]*)?([A-Za-z][@A-Za-z0-9_]*)[ \t]*([:\\+]?=)[ \t]*(.*)$"); // build key=map of values to add // map can be empty.we never add an empty key, but do remove empty keys from the file.. QDict< QMap<QString, bool> > interest; for (QMap<QString, QString>::Iterator it0 = variables.begin(); it0 != variables.end(); ++it0) { kdDebug(9020) << "key (" << add<<"): " << it0.key() << "="<< it0.data() << endl; QMap<QString, bool>* set = new QMap<QString, bool>(); if (!it0.data().stripWhiteSpace().isEmpty()) { QStringList variableList = QStringList::split(' ', it0.data()); for (uint i = 0; i < variableList.count(); i++) { set->insert(variableList[i], true); } } interest.insert(it0.key(), set); } bool multiLine = false; QString lastLhs; QStringList lastRhs; QMap<QString, QString> seenLhs; while (!fin.atEnd()) { QString s = ins.readLine(); if (re.exactMatch(s)) { QString lhs = re.cap(2); QMap<QString, bool>* ourRhs = interest.find(lhs); if (!ourRhs) { // not interested in this line at all // write it out as is.. outs << s << endl; } else { // we are interested in this line.. QString rhs = re.cap(4).stripWhiteSpace(); if (rhs[ rhs.length() - 1 ] == '\\') { // save it for when we have the whole line.. multiLine = true; lastLhs = lhs; rhs.setLength(rhs.length() - 1); lastRhs += QStringList::split(" ", rhs); } else { // deal with it now. QStringList bits = QStringList::split(" ", rhs); if (add) { // we are adding our interested values to this line and writing it // add this line to we we want to add to remove duplicates. for (uint index = 0; index < bits.size(); index++) { QMap<QString, bool>::iterator findEntry = ourRhs->find(bits[index]); if (findEntry == ourRhs->end()) { // we haven't seen it, so add it, so we don't add it again later.. ourRhs->insert(bits[index], true); } // else we have this value in our 'to add list' , it is either already been // added, so we don't want to add it again, or it hasn't been added, in which // case we will do so soon. so we can ignore this now.. } // now write the line out if it is not going to be empty. QString newLine(lhs); if (seenLhs.find(lhs) == seenLhs.end()) { newLine += " = "; seenLhs[lhs] = ""; } else { newLine += " += "; } int len = newLine.length(); bool added = false; QValueList<QString> keys = ourRhs->keys(); for (uint count = 0; count < keys.size(); count++) { // if out entry is true, add it.. if ((*ourRhs)[keys[count]]) { added = true; len += keys[count].length() + 1; if (len > 80) { newLine += "\\\n\t"; len = 8; } newLine += keys[count]; newLine += ' '; // set our value so we don't add it again. (*ourRhs)[keys[count]] = false; } } // only print it out if there was a value to add.. if (added) { newLine.setLength(newLine.length() - 1); outs << newLine << endl; } } else { // we are removing our interested values from this line // special case - no values, remove the line.. if (!ourRhs->empty()) { // check if any of these values are down to remove. QString newLine(lhs); if (seenLhs.find(lhs) == seenLhs.end()) { newLine += " = "; seenLhs[lhs] = ""; } else { newLine += " += "; } int len = newLine.length(); bool added = false; for (QStringList::Iterator posIter = bits.begin(); posIter != bits.end();posIter++) { QMap<QString, bool>::iterator findEntry = ourRhs->find(*posIter); if (findEntry == ourRhs->end()) { // we do not want to remove it.. added = true; len += (*posIter).length() + 1; if (len > 80) { newLine += "\\\n\t"; len = 8; } newLine += (*posIter); newLine += ' '; } // else we have this value in our 'to remove list', so don't add it. } // only print it out if there was a value on it.. if (added) { newLine.setLength(newLine.length() - 1); outs << newLine << endl; } } }//if (add) }//if ( rhs[ rhs.length() - 1 ] == '\\' ) }//if ( found == interest.end()) } else if (multiLine) { s = s.stripWhiteSpace(); // we are only here if were interested in this line.. if (s[s.length()-1] == '\\') { s.setLength(s.length() - 1); // still more multi line we wait for.. } else { // end of the multi line.. multiLine = false; } lastRhs += QStringList::split(" ", s); if (!multiLine) { // now we have to deal with this multiLine value.. // ourRhs will always be a value, as we only get multiLine if we're interested in it.. QMap<QString, bool>* ourRhs = interest.find(lastLhs); if (add) { // we are adding our interested values to this line and writing it // add this line to we we want to add to remove duplicates. for (uint index = 0; index < lastRhs.size(); index++) { QMap<QString, bool>::iterator findEntry = ourRhs->find(lastRhs[index]); if (findEntry == ourRhs->end()) { // we haven't seen it, so add it, so we don't add it again later.. ourRhs->insert(lastRhs[index], true); } // else we have this value in our 'to add list' , it is either already been // added, so we don't want to add it again, or it hasn't been added, in which // case we will do so soon. so we can ignore this now.. } // now write the line out if it is not going to be empty. QString newLine(lastLhs); if (seenLhs.find(lastLhs) == seenLhs.end()) { newLine += " = "; seenLhs[lastLhs] = ""; } else { newLine += " += "; } int len = newLine.length(); bool added = false; QValueList<QString> keys = ourRhs->keys(); for (uint count = 0; count < keys.size(); count++) { // if out entry is true, add it.. if ((*ourRhs)[keys[count]]) { added = true; len += keys[count].length() + 1; if (len > 80) { newLine += "\\\n\t"; len = 8; } newLine += keys[count]; newLine += ' '; // set our value so we don't add it again. (*ourRhs)[keys[count]] = false; } } // only print it out if there was a value to add.. if (added) { newLine.setLength(newLine.length() - 1); outs << newLine << endl; } } else { // we are removing our interested values from this line // special case - no values, remove the line.. if (!ourRhs->empty()) { // check if any of these values are down to remove. QString newLine(lastLhs); if (seenLhs.find(lastLhs) == seenLhs.end()) { newLine += " = "; seenLhs[lastLhs] = ""; } else { newLine += " += "; } int len = newLine.length(); bool added = false; for (QStringList::Iterator posIter = lastRhs.begin(); posIter != lastRhs.end();posIter++) { QMap<QString, bool>::iterator findEntry = ourRhs->find(*posIter); if (findEntry == ourRhs->end()) { // we do not want to remove it.. added = true; len += (*posIter).length() + 1; if (len > 80) { newLine += "\\\n\t"; len = 8; } newLine += (*posIter); newLine += ' '; } // else we have this value in our 'to remove list', so don't add it. } // only print it out if there was a value on it.. if (added) { newLine.setLength(newLine.length() - 1); outs << newLine << endl; } } } lastLhs.setLength(0); lastRhs.clear(); } } else { // can write this line out.. // not a match, not a multi line, outs << s << endl; } } if (add) { QDictIterator<QMap<QString, bool> > it(interest); for (; it.current(); ++it) { QString lhs = it.currentKey(); QMap<QString, bool>* ourRhs = it.current(); QString newLine(lhs); if (seenLhs.find(lhs) == seenLhs.end()) { newLine += " = "; seenLhs[lastLhs] = ""; } else { newLine += " += "; } int len = newLine.length(); bool added = false; QValueList<QString> keys = ourRhs->keys(); for (uint count = 0; count < keys.size(); count++) { if ((*ourRhs)[keys[count]]) { added = true; len += keys[count].length() + 1; if (len > 80) { newLine += "\\\n\t"; len = 8; } newLine += keys[count]; newLine += ' '; // set our value so we don't add it again. (*ourRhs)[keys[count]] = false; } } // only print it out if there was a value to add.. if (added) { newLine.setLength(newLine.length() - 1); outs << newLine << endl; } } } interest.setAutoDelete(true); interest.clear(); fin.close(); fout.close(); QDir().rename(fileName + "#", fileName); }
static Bool kconfigReadOptionValue (CompObject *object, KConfig *config, CompOption *o, CompOptionValue *value) { compInitOptionValue (value); switch (o->type) { case CompOptionTypeBool: case CompOptionTypeBell: kconfigBoolToValue (config->readBoolEntry (o->name), o->type, value); break; case CompOptionTypeInt: value->i = config->readNumEntry (o->name); break; case CompOptionTypeFloat: value->f = config->readDoubleNumEntry (o->name); break; case CompOptionTypeString: case CompOptionTypeColor: case CompOptionTypeKey: case CompOptionTypeButton: case CompOptionTypeEdge: case CompOptionTypeMatch: if (!kconfigStringToValue (object, config->readEntry (o->name), o->type, value)) return FALSE; break; case CompOptionTypeList: { int n, i; value->list.value = NULL; value->list.nValue = 0; value->list.type = o->value.list.type; switch (o->value.list.type) { case CompOptionTypeInt: { QValueList< int > list; list = config->readIntListEntry (o->name); n = list.size (); if (n) { value->list.value = (CompOptionValue *) malloc (sizeof (CompOptionValue) * n); if (value->list.value) { for (i = 0; i < n; i++) value->list.value[i].i = list[i]; value->list.nValue = n; } } } break; case CompOptionTypeBool: case CompOptionTypeFloat: case CompOptionTypeString: case CompOptionTypeColor: case CompOptionTypeKey: case CompOptionTypeButton: case CompOptionTypeEdge: case CompOptionTypeBell: case CompOptionTypeMatch: { QStringList list; list = config->readListEntry (o->name); n = list.size (); if (n) { value->list.value = (CompOptionValue *) malloc (sizeof (CompOptionValue) * n); if (value->list.value) { for (i = 0; i < n; i++) { if (!kconfigStringToValue (object, list[i], value->list.type, &value->list.value[i])) break; value->list.nValue++; } if (value->list.nValue != n) { compFiniOptionValue (value, o->type); return FALSE; } } } } break; case CompOptionTypeList: case CompOptionTypeAction: return FALSE; } } break; case CompOptionTypeAction: return FALSE; break; } return TRUE; }
void CorrelationView::drawClusterIds(QPainter& painter){ QValueList<int> shownClusters; QValueList<int>::const_iterator iterator; QValueList<int> const clusters = view.clusters(); for(iterator = clusters.begin(); iterator != clusters.end(); ++iterator) shownClusters.append(*iterator); qHeapSort(shownClusters); QFont f("Helvetica",8); painter.setFont(f); painter.setPen(colorLegend); //set the color for the legends. //Draw the absciss ids //The abscissa of the legend for the current correlogram. uint X = widthBorder + 2; //The ordinate of the legend for the current correlogram. uint Y = 0; int width = nbBins * binWidth + XMARGIN; //Variable used to draw the firing rate uint firingX = 0; uint firingY = 0; int clusterIndex = 1; int nbClusters = shownClusters.size(); ItemColors& clusterColors = doc.clusterColors(); QRect r((QRect)window); bool isMargin = true; if(r.left() != 0) isMargin = false; for(iterator = shownClusters.begin(); iterator != shownClusters.end(); ++iterator){ //the abscissa is increase by the font size to adjust for conversion from world coordinates to viewport coordinates. QRect r; if(isMargin) r = QRect(worldToViewport(X,-Y).x() + 10,worldToViewport(X,-Y).y() - 2,worldToViewportWidth(width),10); else r = QRect(worldToViewport(X,-Y).x() + 10 - XMARGIN,worldToViewport(X,-Y).y() - 2,worldToViewportWidth(width),10); painter.drawText(r,Qt::AlignHCenter,QString("%1").arg(*iterator)); if(shoulderLine){ QString firingRate = ""; if(firingRates.contains(*iterator)) firingRate = firingRates[*iterator]; if(nbClusters == 1){ firingX = X; firingY = heightBorder + YsizeForMaxAmp; QRect rf; if(isMargin) rf = QRect(worldToViewport(firingX,-firingY).x() + 10,worldToViewport(firingX,-firingY).y() - 17,worldToViewportWidth(width + 20),15); else rf = QRect(worldToViewport(firingX,-firingY).x() + 10 - XMARGIN,worldToViewport(firingX,-firingY).y() - 17,worldToViewportWidth(width + 20),15); painter.setPen(clusterColors.color(*iterator)); painter.setBrush(NoBrush); painter.drawRect(rf); painter.setPen(colorLegend); painter.drawText(rf,Qt::AlignCenter,firingRate); } else if(clusterIndex == 1){ firingX = X + width + Xspace; firingY = heightBorder; QRect rf; if(isMargin) rf = QRect(worldToViewport(firingX,-firingY).x() + 10,worldToViewport(firingX,-firingY).y() - 13,worldToViewportWidth(width + 20),15); else rf = QRect(worldToViewport(firingX,-firingY).x() + 10 - XMARGIN,worldToViewport(firingX,-firingY).y() - 13,worldToViewportWidth(width + 20),15); painter.setPen(clusterColors.color(*iterator)); painter.setBrush(NoBrush); painter.drawRect(rf); painter.setPen(colorLegend); painter.drawText(rf,Qt::AlignCenter,firingRate); } else{ firingY = heightBorder + (clusterIndex - 1) * (YsizeForMaxAmp + Yspace) - (Yspace / 2); QRect rf; if(isMargin) rf = QRect(worldToViewport(firingX,-firingY).x() + 10,worldToViewport(firingX,-firingY).y(),worldToViewportWidth(width + 20),15); else rf = QRect(worldToViewport(firingX,-firingY).x() + 10 - XMARGIN,worldToViewport(firingX,-firingY).y(),worldToViewportWidth(width + 20),15); painter.setPen(clusterColors.color(*iterator)); painter.setBrush(NoBrush); painter.drawRect(rf); painter.setPen(colorLegend); painter.drawText(rf,Qt::AlignCenter,firingRate); firingX += shift; } clusterIndex++; } X += shift; } //Draw the ordinate ids X = 0; Y = heightBorder + YsizeForMaxAmp + Yspace - 2; uint yshift = YsizeForMaxAmp + Yspace; for(iterator = shownClusters.begin(); iterator != shownClusters.end(); ++iterator){ QRect r(worldToViewport(X,-Y).x(),worldToViewport(X,-Y).y(),10,worldToViewportHeight(YsizeForMaxAmp + Yspace)); painter.drawText(r,Qt::AlignCenter,QString("%1").arg(*iterator)); Y += yshift; } }
int main( int argc, char ** argv ) { //disable qt module support for skim itself; xim will be disabled latter setenv("QT_IM_SWITCHER", "imsw-none", 1); setenv("QT_IM_MODULE", "xim", 1); setenv("XMODIFIER", "@im=none", 1); KAboutData about(PACKAGE, "SKIM", VERSION " (compiled with libscim " SCIM_VERSION ")", description, KAboutData::License_GPL_V2, "(C) 2004 - 2006 LiuCougar", I18N_NOOP("IRC:\nserver: irc.freenode.net / channel: #scim\n\nFeedback:\[email protected]"), "http://www.scim-im.org"); about.addAuthor( "LiuCougar (liuspider)", I18N_NOOP("Core Developer"), "*****@*****.**" ); about.addCredit ( "JamesSu", I18N_NOOP("SCIM Core Author"), "*****@*****.**" ); about.addAuthor ( "JanHefti", I18N_NOOP("Doc writer and German translator"), "*****@*****.**" ); about.addAuthor ( "KitaeKim", I18N_NOOP("Art designer and Korean translator"), "*****@*****.**" ); about.addAuthor ( "YukikoBando", I18N_NOOP("Japanese translator"), "*****@*****.**" ); about.setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS\nYour names") ,I18N_NOOP("_: EMAIL OF TRANSLATORS\nYour emails")); QString curarg; QStringList otherArgs; for(int i = 1; i < argc ; i++) { curarg = argv[i]; if( curarg == "--no-stay") otherArgs.push_back("no-stay"); else if (curarg == "-c" ) { otherArgs.push_back("c"); //FIXME otherArgs.push_back(argv[++i]); } else if( curarg == "-f") otherArgs.push_back("force"); } //FIXME: noxim is necessary to disable xim support in qt for this app const char* fake_arg1 = "--noxim"; char* fake_argv[10] = {argv[0], const_cast<char *>(fake_arg1), 0, 0, 0, 0, 0}; for(int i = 1; i < argc; i++) { fake_argv[i+1] = argv[i]; } KCmdLineArgs::init(argc+1, fake_argv, &about); KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); scim::uint32 verbose_level = 0; QString verbose_raw = args->getOption("verbose"); if( verbose_raw.length() && verbose_raw.toInt()) verbose_level = verbose_raw.toInt(); scim::DebugOutput::set_verbose_level( verbose_level ); scim::DebugOutput::enable_debug (SCIM_DEBUG_AllMask); // scim::DebugOutput::enable_debug (SCIM_DEBUG_MainMask | SCIM_DEBUG_SocketMask); if( args->isSet("l") ) { new KInstance(PACKAGE); QValueList<SkimPluginInfo *> info = SkimPluginManager::allAvailablePlugins(); std::cout << I18N_NOOP("Installed skim Plugins:") << "\n" << I18N_NOOP("Name") << "\t\t\t\t" << I18N_NOOP("Comment") << "\n"; for(uint i = 0; i < info.size(); i++) { printf("%-26s\t%s", (const char *)info[i]->pluginName().local8Bit(), (const char *)info[i]->comment().local8Bit()); if(info[i]->isNoDisplay()) std::cout << I18N_NOOP(" (Hidden)"); std::cout << "\n"; } std::cout << "\n" << I18N_NOOP("Note: Hidden plugins can not be disabled.") << "\n"; return 0; } QCString p = args->getOption("p"), np = args->getOption("np"); QStringList enabledPlugins, disabledPlugins; if( p.length() ) enabledPlugins = QStringList::split(",", p); if( np.length() ) disabledPlugins = QStringList::split(",", np); if( args->isSet("d") ) scim::scim_daemon (); KApplication * kAppMainThread = new KApplication(); if( kAppMainThread->isRestored() && !ScimKdeSettings::autoStart() ) return 127; //when skim should not auto start, restore from session is not permitted if (signal(SIGTERM, sighandler) == SIG_IGN) signal(SIGTERM, SIG_IGN); if (signal(SIGINT, sighandler) == SIG_IGN) signal(SIGINT, SIG_IGN); if (signal(SIGHUP, sighandler) == SIG_IGN) signal(SIGHUP, SIG_IGN); new SkimPluginManager(enabledPlugins, disabledPlugins, otherArgs); return kAppMainThread->exec(); }
int main(int argc, char *argv[]) { atexit(exitHelper); KInstance inst("d2asc"); KstDataSourcePtr file; KConfig *kConfigObject = new KConfig("kstdatarc", false, false); KstDataSource::setupOnStartup(kConfigObject); fieldEntry field; QValueList<fieldEntry> fieldList; char *filename; bool do_ave = false, do_skip = false; int start_frame=0, n_frames=2000000; int n_skip = 0; int NS=0, i_S; int i; if (argc < 3 || argv[1][0] == '-') { Usage(); return -1; } filename = argv[1]; for (i = 2; i < argc; i++) { if (argv[i][0] == '-') { if (argv[i][1] == 'f') { i++; start_frame = atoi(argv[i]); } else if (argv[i][1] == 'n') { i++; n_frames = atoi(argv[i]); } else if (argv[i][1] == 's') { i++; n_skip = atoi(argv[i]); if (n_skip>0) do_skip = true; } else if (argv[i][1] == 'a') { do_ave = true; } else if (argv[i][1] == 'x') { i++; field.field = argv[i]; field.doHex = true; fieldList.append(field); } else { Usage(); } } else { field.field = argv[i]; field.doHex = false; fieldList.append(field); } } if (!do_skip) { do_ave = false; } file = KstDataSource::loadSource(filename); if (!file || !file->isValid() || file->isEmpty()) { fprintf(stderr, "d2asc error: file %s has no data\n", filename); return -2; } /** make vectors and fill the list **/ QPtrList<KstRVector> vlist; for (i=0; i<int(fieldList.size()); i++) { if (!file->isValidField(fieldList[i].field)) { fprintf(stderr, "d2asc error: field %s in file %s is not valid\n", fieldList[i].field.latin1(), filename); return -3; } KstRVectorPtr v = new KstRVector(file, fieldList[i].field, KstObjectTag("tag", KstObjectTag::globalTagContext), start_frame, n_frames, n_skip, n_skip>0, do_ave); vlist.append(v); } /* find NS */ for (i = 0; i < int(fieldList.size()); i++) { while (vlist.at(i)->update(-1) != KstObject::NO_CHANGE) ; // read vector if (vlist.at(i)->length() > NS) { NS = vlist.at(i)->length(); } } for (i_S = 0; i_S < NS; i_S++) { for (i = 0; i < int(fieldList.size()); i++) { if (fieldList[i].doHex) { printf("%4x ", (int)vlist.at(i)->interpolate(i_S, NS)); } else { printf("%.16g ", vlist.at(i)->interpolate(i_S, NS)); } } printf("\n"); } }
NewFileDlg::NewFileDlg( QWidget *parent ) : KDialogBase( parent, "newfiledlg", true, "New File", KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true ) { m_pMainParent = parent; m_bAccepted = false; m_pNewFileWidget = new NewFileWidget(this); m_pNewFileWidget->typeIconView->setSelectionMode(QIconView::Single); m_pNewFileWidget->typeIconView->setMode(KIconView::Select); KIconLoader *loader = KGlobal::iconLoader(); QValueList<QIconViewItem*> items; //BEGIN insert icons QString text = QString("%1 (.asm)").arg(i18n("Assembly Code")); items << new QIconViewItem(m_pNewFileWidget->typeIconView, text, loader->loadIcon( "source", KIcon::NoGroup, KIcon::SizeHuge ) ); text = "C (.c)"; items << new QIconViewItem(m_pNewFileWidget->typeIconView, text, loader->loadIcon( "source_c", KIcon::NoGroup, KIcon::SizeHuge ) ); text = QString("%1 (.circuit)").arg(i18n("Circuit")); items << new QIconViewItem(m_pNewFileWidget->typeIconView,text, loader->loadIcon( "ktechlab_circuit", KIcon::NoGroup, KIcon::SizeHuge ) ); items << new QIconViewItem(m_pNewFileWidget->typeIconView,"FlowCode (.flowcode)", loader->loadIcon( "ktechlab_flowcode", KIcon::NoGroup, KIcon::SizeHuge ) ); #ifdef MECHANICS items << new QIconViewItem(m_pNewFileWidget->typeIconView,"Mechanics (.mechanics)", loader->loadIcon( "exec", KIcon::NoGroup, KIcon::SizeHuge ) ); #endif items << new QIconViewItem(m_pNewFileWidget->typeIconView,"Microbe (.microbe)", loader->loadIcon( "ktechlab_microbe", KIcon::NoGroup, KIcon::SizeHuge ) ); //END insert icons unsigned minWidth = 20 + m_pNewFileWidget->typeIconView->spacing() * items.size(); int minHeight = 0; const QValueList<QIconViewItem*>::iterator end = items.end(); for ( QValueList<QIconViewItem*>::iterator it = items.begin(); it != end; ++it ) { (*it)->setDragEnabled(false); minWidth += (*it)->width(); minHeight = QMAX( minHeight, (*it)->height()+20 ); } m_pNewFileWidget->typeIconView->setMinimumSize( minWidth, minHeight ); m_pNewFileWidget->typeIconView->setCurrentItem(items[3]); m_pNewFileWidget->addToProjectCheck->setChecked( ProjectManager::self()->currentProject() ); m_pNewFileWidget->addToProjectCheck->setEnabled( ProjectManager::self()->currentProject() ); microSelectWidget()->setAllowedFlowCodeSupport( MicroInfo::FullSupport | MicroInfo::PartialSupport ); setMainWidget(m_pNewFileWidget); // Our behaviour is to have single click selects and double click accepts the dialog connect( m_pNewFileWidget->typeIconView, SIGNAL(selectionChanged(QIconViewItem*)), this, SLOT(fileTypeChanged(QIconViewItem*)) ); connect( m_pNewFileWidget->typeIconView, SIGNAL(doubleClicked(QIconViewItem*)), this, SLOT(accept())); setAcceptDrops(true); m_pNewFileWidget->typeIconView->adjustSize(); m_pNewFileWidget->adjustSize(); adjustSize(); }
GuideUiScheme::GuideUiScheme (GuideUiMainWindow* main_window, QString title) : QWidget (0, title, 0) { this->mainWindow = main_window; setName ("GuideUiScheme"); GuideUiSchemeLayout = new QGridLayout (this, 1, 1, 0, 6, "GuideUiSchemeLayout"); splitter9 = new QSplitter (this, "splitter9"); splitter9->setOrientation (QSplitter::Vertical); //repl was there contenv = new QWidget (splitter9, "layout3"); layout3 = new QHBoxLayout (contenv, 5, 6, "layout3"); layout2 = new QVBoxLayout (0, 0, 6, "layout2"); btnStep = new QPushButton (contenv, "btnStep"); btnStep->setSizePolicy (QSizePolicy ((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, btnStep->sizePolicy ().hasHeightForWidth ())); btnStep->setMinimumSize (QSize (24, 24)); btnStep->setMaximumSize (QSize (24, 24)); btnStep->setPixmap (QPixmap::fromMimeSource ("step.png")); layout2->addWidget (btnStep); btnLeap = new QPushButton (contenv, "btnLeap"); btnLeap->setSizePolicy (QSizePolicy ((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, btnLeap->sizePolicy ().hasHeightForWidth ())); btnLeap->setMinimumSize (QSize (24, 24)); btnLeap->setMaximumSize (QSize (24, 24)); btnLeap->setPixmap (QPixmap::fromMimeSource ("leap.png")); layout2->addWidget (btnLeap); btnCont = new QPushButton (contenv, "btnCont"); btnCont->setMinimumSize (QSize (24, 24)); btnCont->setMaximumSize (QSize (24, 24)); btnCont->setPixmap (QPixmap::fromMimeSource ("cont.png")); layout2->addWidget (btnCont); spacer1 = new QSpacerItem (20, 120, QSizePolicy::Minimum, QSizePolicy::Expanding); layout2->addItem (spacer1); layout3->addLayout (layout2); splitter7 = new QSplitter (contenv, "splitter7"); splitter7->setOrientation (QSplitter::Horizontal); cont = new GuideUiCont (splitter7, "cont"); env = new GuideUiEnv (splitter7, "env"); QValueList<int> sizes = splitter7->sizes (); if (sizes.size() >= 2) { sizes[0] = 600; sizes[1] = 400; splitter7->setSizes(sizes); } layout3->addWidget( splitter7 ); GuideUiSchemeLayout->addWidget (splitter9, 0, 0); repl = new GuideUiRepl (this, splitter9, "repl"); repl->setWrapPolicy (QTextEdit::Anywhere); languageChange (); resize (QSize (800, 600).expandedTo (minimumSizeHint ())); clearWState (WState_Polished); // signals and slots connections connect (btnStep, SIGNAL(clicked()), this, SLOT(btnStep_clicked())); connect (btnLeap, SIGNAL(clicked()), this, SLOT(btnLeap_clicked())); connect (btnCont, SIGNAL(clicked()), this, SLOT(btnCont_clicked())); connect (cont, SIGNAL(rowChanged(int)), this, SLOT(continuation_row_changed(int))); connect (repl, SIGNAL(sendLine(QString)), this, SLOT(typed_text(QString))); // Add this widget to the TabWidget of GuideUiMainWindow mainWindow->addConsole (this, title); sizes = splitter9->sizes (); if (sizes.size () >= 2) contenv->hide (); lines_typed = 0; repl->setFocus (); }
// private int kpFloodFill::fillLinesListSize (const QValueList <kpFloodFill::FillLine> &fillLines) const { return (fillLines.size () * kpFloodFill::FillLine::size ()); }
const QList<double> &levels, int flags) const #else QwtRasterData::ContourLines QwtRasterData::contourLines( const QwtDoubleRect &rect, const QSize &raster, const QValueList<double> &levels, int flags) const #endif { ContourLines contourLines; if ( levels.size() == 0 || !rect.isValid() || !raster.isValid() ) return contourLines; const double dx = rect.width() / raster.width(); const double dy = rect.height() / raster.height(); const bool ignoreOnPlane = flags & QwtRasterData::IgnoreAllVerticesOnLevel; const QwtDoubleInterval range = this->range(); bool ignoreOutOfRange = false; if ( range.isValid() ) ignoreOutOfRange = flags & IgnoreOutOfRange; ((QwtRasterData*)this)->initRaster(rect, raster); for ( int y = 0; y < raster.height() - 1; y++ ) { enum Position { Center, TopLeft, TopRight, BottomRight, BottomLeft, NumPositions }; Contour3DPoint xy[NumPositions]; for ( int x = 0; x < raster.width() - 1; x++ ) { const QwtDoublePoint pos(rect.x() + x * dx, rect.y() + y * dy); if ( x == 0 ) { xy[TopRight].setPos(pos.x(), pos.y()); xy[TopRight].setZ( value( xy[TopRight].x(), xy[TopRight].y()) ); xy[BottomRight].setPos(pos.x(), pos.y() + dy); xy[BottomRight].setZ( value(xy[BottomRight].x(), xy[BottomRight].y()) ); } xy[TopLeft] = xy[TopRight]; xy[BottomLeft] = xy[BottomRight]; xy[TopRight].setPos(pos.x() + dx, pos.y()); xy[BottomRight].setPos(pos.x() + dx, pos.y() + dy); xy[TopRight].setZ( value(xy[TopRight].x(), xy[TopRight].y()) ); xy[BottomRight].setZ( value(xy[BottomRight].x(), xy[BottomRight].y()) ); double zMin = xy[TopLeft].z(); double zMax = zMin; double zSum = zMin; for ( int i = TopRight; i <= BottomLeft; i++ ) { const double z = xy[i].z(); zSum += z; if ( z < zMin ) zMin = z; if ( z > zMax ) zMax = z; } if ( ignoreOutOfRange ) { if ( !range.contains(zMin) || !range.contains(zMax) ) continue; } if ( zMax < levels[0] || zMin > levels[levels.size() - 1] ) { continue; } xy[Center].setPos(pos.x() + 0.5 * dx, pos.y() + 0.5 * dy); xy[Center].setZ(0.25 * zSum); const int numLevels = (int)levels.size(); for (int l = 0; l < numLevels; l++) { const double level = levels[l]; if ( level < zMin || level > zMax ) continue; #if QT_VERSION >= 0x040000 QPolygonF &lines = contourLines[level]; #else QwtArray<QwtDoublePoint> &lines = contourLines[level]; #endif const ContourPlane plane(level); QwtDoublePoint line[2]; Contour3DPoint vertex[3]; for (int m = TopLeft; m < NumPositions; m++) { vertex[0] = xy[m]; vertex[1] = xy[0]; vertex[2] = xy[m != BottomLeft ? m + 1 : TopLeft]; const bool intersects = plane.intersect(vertex, line, ignoreOnPlane); if ( intersects ) { #if QT_VERSION >= 0x040000 lines += line[0]; lines += line[1]; #else const int index = lines.size(); lines.resize(lines.size() + 2, QGArray::SpeedOptim); lines[index] = line[0]; lines[index+1] = line[1]; #endif } } } } } ((QwtRasterData*)this)->discardRaster(); return contourLines; }