Ejemplo n.º 1
0
//-----------------------------------------------------------------------------
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;
}
Ejemplo n.º 2
0
void stringSort(char* str)
{
    if(str == NULL)
        return;

    inSort(str, str);
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
void KMAddrBook::insert(const QString aAddress)
{
  if (find(aAddress)<0)
  {
    inSort(aAddress);
    mModified=TRUE;
  }
}
Ejemplo n.º 4
0
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 ) );
}
Ejemplo n.º 5
0
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;
}
Ejemplo n.º 6
0
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;
        }
    }

}
Ejemplo n.º 7
0
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()));

}
Ejemplo n.º 8
0
void
VGradientEx::addStop( const VColorStopEx& colorStop )
{
	inSort( new VColorStopEx( colorStop ) );
} // VGradientEx::addStop
Ejemplo n.º 9
0
void
VGradient::addStop( const VColorStop& colorStop )
{
	inSort( new VColorStop( colorStop ) );
} // VGradient::addStop
Ejemplo n.º 10
0
void
VacationList::add(VacationInterval* vi)
{
    inSort(vi);
}
Ejemplo n.º 11
0
void
VacationList::add(const QString& name, const Interval& i)
{
    inSort(new VacationInterval(name, i));
}