//----------------------------------------------------------------------------- int KMAddrBook::load(const char* aFileName) { char line[256]; const char* fname = (aFileName ? aFileName : (const char*)mDefaultFileName); QFile file(fname); int rc; //assert(fname != NULL); if(!fname) return IO_FatalError; if (!file.open(IO_ReadOnly)) return file.status(); clear(); while (!file.atEnd()) { if (file.readLine(line,255) > 0) { if (line[strlen(line)-1] < ' ') line[strlen(line)-1] = '\0'; if (line[0]!='#' && line[0]!='\0') inSort(line); } } rc = file.status(); file.close(); mModified = FALSE; return rc; }
void stringSort(char* str) { if(str == NULL) return; inSort(str, str); }
//----------------------------------------------------------------------------- void KMAddrBook::insert(const QString aAddress) { if (find(aAddress)<0) { inSort(aAddress); mModified=TRUE; } }
void VGradientEx::addStop( const ScColor &color, double rampPoint, double midPoint, double opa, QString name, int shade ) { // Clamping between 0.0 and 1.0 rampPoint = qMax( 0.0, rampPoint ); rampPoint = qMin( 1.0, rampPoint ); // Clamping between 0.0 and 1.0 midPoint = qMax( 0.0, midPoint ); midPoint = qMin( 1.0, midPoint ); inSort( new VColorStopEx( rampPoint, midPoint, color, opa, name, shade ) ); }
void CoreAttributesList::sort() { QList<CoreAttributes*> lst = *this; clear(); QStringList s; for(int i = 0; i < lst.count(); ++i) s << lst.at(i)->getId(); qDebug()<<"CoreAttributesList::sort:"<<s; while (!lst.isEmpty()) { inSort(lst.takeLast()); } s.clear(); for(int i = 0; i < lst.count(); ++i) s << lst.at(i)->getId(); qDebug()<<"CoreAttributesList::sort: sorted"<<s; }
void inSort(char* str, char* begin) { if(*begin == '\0') { printf("%s\n", str); } else { for(char* ptr = begin; *ptr != '\0'; ++ptr) { char tmp = *ptr; *ptr = *begin; *begin = tmp; inSort(str, begin + 1); tmp = *ptr; *ptr = *begin; *begin = tmp; } } }
Multiwin::Multiwin(std::string arg) : QWidget(NULL) { //call on the parser engine = new SearchEng; NewParse* p = new NewParse(); this->parser(arg); engine->add_parse_from_index_file(newIndex, p); std::map<std::string, WebPage*> allPages = engine->getPages(); //setting the title this->setWindowTitle("GOOGLE II"); //fixing placement & width + height this->setGeometry(100,100, 600, 165); //Overall Layout overallLayout = new QVBoxLayout(); //Google Tu image image.load("GoogleTu.png"); imageContainer = new QLabel(); imageContainer->setPixmap(QPixmap::fromImage(image)); overallLayout->addWidget(imageContainer); //searchLayout radioLayout = new QHBoxLayout(); orRadio = new QRadioButton("OR", this); andRadio = new QRadioButton("AND ", this); singleRadio = new QRadioButton("Single", this); singleRadio->setChecked(true); radioLayout->addWidget(singleRadio); radioLayout->addWidget(orRadio); radioLayout->addWidget(andRadio); overallLayout->addLayout(radioLayout); searchLayout = new QHBoxLayout(); //search textbox textSearch = new QLineEdit(); searchLayout->addWidget(textSearch); //search Button searchButton = new QPushButton("Search"); searchLayout->addWidget(searchButton); overallLayout->addLayout(searchLayout); //resultsLayout resultsLayout = new QHBoxLayout(); //QTreeWidget to display the results tree = new QTreeWidget; tree->setColumnCount(4); //setting the header of the TreeWidget QStringList headerLabels; headerLabels.push_back("Filename"); headerLabels.push_back("In Links"); headerLabels.push_back("Out Links"); headerLabels.push_back("Page Rank"); tree->setHeaderLabels(headerLabels); //sorting list button options sortList = new QVBoxLayout(); sortLabel = new QLabel("Sort By: "); fileNameButton = new QPushButton("Filename"); inLinkButton = new QPushButton("InLinks"); outLinkButton = new QPushButton("OutLinks"); pageRankButton = new QPushButton("Page Rank"); sortList->addWidget(sortLabel); sortList->addWidget(pageRankButton); sortList->addWidget(fileNameButton); sortList->addWidget(inLinkButton); sortList->addWidget(outLinkButton); //The results list resultsLayout->addWidget(tree); resultsLayout->addLayout(sortList); //adding the layouts to overallLayout overallLayout->addLayout(resultsLayout); //set the overall layout setLayout(overallLayout); QVBoxLayout* mainLayout = new QVBoxLayout; overallLayout->addLayout(mainLayout); QVBoxLayout* otherLayout = new QVBoxLayout; otherWin = new QWidget; closeButton = new QPushButton("&Close Popup Window"); otherLayout->addWidget(closeButton); exitButton = new QPushButton("&Exit Program"); otherLayout->addWidget(exitButton); overallLayout->addLayout(otherLayout); //otherWin stuff otherWin->setWindowTitle(""); otherWin->setGeometry(300,200, 800, 600); popupLayout = new QVBoxLayout(); fileContent = new QTextEdit(""); popupLayout->addWidget(fileContent); //setting up bottom tier of the popup window; bottom = new QHBoxLayout(); inLayout = new QVBoxLayout(); outLayout = new QVBoxLayout(); sortButtons = new QVBoxLayout(); incomingLabel = new QLabel("Incoming"); inList = new QTreeWidget(); inLayout->addWidget(incomingLabel); QStringList headerLabelsIn; headerLabelsIn.push_back("Filename"); headerLabelsIn.push_back("In Links"); headerLabelsIn.push_back("Out Links"); inList->setHeaderLabels(headerLabelsIn); inLayout->addWidget(inList); sortByLabel = new QLabel("SORT BY:"); fSort = new QPushButton("filename"); iSort = new QPushButton("input files"); oSort = new QPushButton("output files"); sortButtons->addWidget(sortByLabel); sortButtons->addWidget(fSort); sortButtons->addWidget(iSort); sortButtons->addWidget(oSort); outgoingLabel = new QLabel("Outgoing"); outList = new QTreeWidget(); outLayout->addWidget(outgoingLabel); QStringList headerLabelsOut; headerLabelsOut.push_back("Filename"); headerLabelsOut.push_back("In Links"); headerLabelsOut.push_back("Out Links"); outList->setHeaderLabels(headerLabelsOut); outLayout->addWidget(outList); bottom->addLayout(inLayout); bottom->addLayout(sortButtons); bottom->addLayout(outLayout); popupLayout->addLayout(bottom); otherWin->setLayout(popupLayout); QObject::connect(searchButton, SIGNAL(clicked()), this, SLOT(displayResults())); QObject::connect(textSearch, SIGNAL(returnPressed()), this, SLOT(displayResults())); QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(otherButtonClicked())); QObject::connect(fileNameButton, SIGNAL(clicked()), this, SLOT(fileSort())); QObject::connect(inLinkButton, SIGNAL(clicked()), this, SLOT(inSort())); QObject::connect(outLinkButton, SIGNAL(clicked()), this, SLOT(outSort())); QObject::connect(pageRankButton, SIGNAL(clicked()), this, SLOT(prSort())); //pop up window QObject::connect(fSort, SIGNAL(clicked()), this, SLOT(popFSort())); QObject::connect(iSort, SIGNAL(clicked()), this, SLOT(popISort())); QObject::connect(oSort, SIGNAL(clicked()), this, SLOT(popOSort())); QObject::connect(inList, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(changeInLists(QTreeWidgetItem*))); QObject::connect(outList, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(changeOutLists(QTreeWidgetItem*))); QObject::connect(tree, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(mainButtonClicked())); QObject::connect(exitButton, SIGNAL(clicked()), this, SLOT(close())); }
void VGradientEx::addStop( const VColorStopEx& colorStop ) { inSort( new VColorStopEx( colorStop ) ); } // VGradientEx::addStop
void VGradient::addStop( const VColorStop& colorStop ) { inSort( new VColorStop( colorStop ) ); } // VGradient::addStop
void VacationList::add(VacationInterval* vi) { inSort(vi); }
void VacationList::add(const QString& name, const Interval& i) { inSort(new VacationInterval(name, i)); }