Пример #1
0
	QHash<QString,QVariant> getReparse()
	{
		QHash<QString,QVariant> data;
		int g=0;
		for(int i=0;i<8;++i){
			g=(g<<1)+Shield::shieldG[i];
		}
		data["/Shield/Group"]=g;
		data["/Shield/Regexp"]=rm->stringList();
		data["/Shield/Sender"]=sm->stringList();
		data["/Shield/Limit"]=Config::getValue("/Shield/Limit",5);
		return data;
	}
void ConversationPage::folderSelected(const QModelIndex& index)
{
    MPopupList *popupList = qobject_cast<MPopupList *>(sender());
    if (!popupList)
        return;
   
    QStringListModel *model = (QStringListModel *) popupList->itemModel();
    QStringList folders = model->stringList();

    m_downloadFolder = QDir::homePath() + "/" + folders[index.row()];

    QMailMessagePart::Location location = m_selectedAttachment.location();
    location.setContainingMessageId(m_id);

    if (m_selectedAttachment.hasBody())
    {
        // The content has already been downloaded to local device. No need to retrieve part from server.
        emit downloadCompleted();
        return;
    }

    m_retrievalAction = new QMailRetrievalAction(this);
    connect(m_retrievalAction, SIGNAL(activityChanged(QMailServiceAction::Activity)), 
                               this, SLOT(activityChanged(QMailServiceAction::Activity)));
    m_retrievalAction->retrieveMessagePart(location);
}
Пример #3
0
void GraphicalArrayTest::test_removeItems()
{
  GraphicalArray * value = new GraphicalArray();
  QPushButton * button = findRemoveButton(value);
  QStringListModel * model = findModel(value);
  QListView * view = findListView(value);
  QItemSelectionModel::SelectionFlags flag = QItemSelectionModel::Select;

  model->setStringList( QStringList() << "Hello" << "World" << "and" << "Happy" << "New" << "Year!" );
  value->show();

  view->selectionModel()->select( model->index(0), flag ); // select "Hello"
  view->selectionModel()->select( model->index(1), flag ); // select "World"
  view->selectionModel()->select( model->index(3), flag ); // select "Happy"
  view->selectionModel()->select( model->index(5), flag ); // select "Year"

  // simulate a click on the 'Remove' button
  QTest::mouseClick( button, Qt::LeftButton );

  QStringList values = model->stringList();

  QCOMPARE( values.count(), 2 );
  QCOMPARE( values.at(0), QString("and") );
  QCOMPARE( values.at(1), QString("New") );

  delete value;
}
void MRichTextEditDialogsManager::setTextStyleValues(const QString &fontfamily, int fontPointSize,
                                                     const QColor &fontColor)
{

    Q_ASSERT(fontFamilyCombo);

    int familyIndex = -1;
    QStringListModel *fontFamilyModel = dynamic_cast<QStringListModel *>(fontFamilyCombo->itemModel());
    if (fontFamilyModel) {
        QStringList fontFamilies = fontFamilyModel->stringList();
        familyIndex = fontFamilies.indexOf(fontfamily);
    }

    fontFamilyCombo->setCurrentIndex(familyIndex);

    Q_ASSERT(fontSizeCombo);

    QStringList fontSizeValues = generateFontSizeComboValues();
    QStringListModel *fontSizeModel = dynamic_cast<QStringListModel *>(fontSizeCombo->itemModel());
    if (fontSizeModel) {
        fontSizeModel->setStringList(fontSizeValues);
    }

    //% "%L1 points"
    QString fontSize(qtTrId("qtn_comm_font_size_value").arg(fontPointSize));
    int sizeIndex = fontSizeValues.indexOf(fontSize);
    fontSizeCombo->setCurrentIndex(sizeIndex);

    Q_ASSERT(fontColorCombo);

    fontColorCombo->setPickedColor(fontColor);
}
Пример #5
0
QStringList CodeEditor::completionWords() const{
    QStringList words;
    QStringListModel *model = qobject_cast<QStringListModel*>(completer_->model());
    if(model){
        words=model->stringList();
    }
    return words;
}
Пример #6
0
void ClickToFlashPlugin::configure()
{
    QDialog dialog;
    Ui_ClickToFlashSettings ui;
    ui.setupUi(&dialog);
    QStringListModel *model = new QStringListModel(m_whitelist, ui.whitelist);
    ui.whitelist->setModel(model);
    if (dialog.exec() == QDialog::Accepted) {
        m_whitelist = model->stringList();
        save();
    }
}
void Settings::saveSettings() {
    QSettings settings;

    QStringListModel* model = (QStringListModel*) ui.patternListView->model();
    settings.setValue(SETTINGS_PATTERNS, model->stringList());
    model = (QStringListModel*) ui.directoryListView->model();
    settings.setValue(SETTINGS_DIRECTORIES, model->stringList());
    settings.setValue(SETTINGS_MATCH_CASE, ui.matchCaseCheckBox->isChecked());
    settings.setValue(SETTINGS_DATE_MATCH, ui.dateMatchGroupBox->isChecked());
    if (ui.dateOption0RadioButton->isChecked()) {
        settings.setValue(SETTINGS_DATE_OPTION, 0);
    } else {
        settings.setValue(SETTINGS_DATE_OPTION, 1);
    }
    settings.setValue(SETTINGS_DATE, ui.dateOption1dateTimeEdit->dateTime());

    disconnect(ui.patternListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(changeDeletePatternButtonState()));
    disconnect(ui.directoryListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(changeDeleteDirectoryButtonState()));

    hide();

    emit settingsChanged();
}
Пример #8
0
void AppearanceSettings::themeChanged(int index)
{
    // Launch web browser for more themes
    if(index == (m_themeCombo->count() - 1)) {
        QProcess::execute("arora", QStringList() << "http://qtmoko.sourceforge.net/apps/category-themes.html");
        QStringListModel *model = qobject_cast<QStringListModel *>(m_themeCombo->model());
        QStringList oldThemes = model->stringList();
        loadThemes();
        
        // Find theme which was installed
        model = qobject_cast<QStringListModel *>(m_themeCombo->model());
        QStringList newThemes = model->stringList();
        for(int i = 0; i < newThemes.count(); i++) {
            if(oldThemes.count() <= i || oldThemes[i] != newThemes[i]) {
                m_prevIndex = i;
                break;
            }
        }
        m_themeCombo->setCurrentIndex(m_prevIndex);
        return;
    }

    Theme *theme = m_themes.value(index, 0);
    if (!theme)
        return;

    m_prevIndex = index;
    QStringListModel *model;

    model = qobject_cast<QStringListModel *>(m_colorCombo->model());
    model->setStringList(theme->colorSchemeNames());
    m_colorCombo->setCurrentIndex(theme->currentColorIndex());

    model = qobject_cast<QStringListModel *>(m_backgroundCombo->model());
    model->setStringList(theme->backgrounds());
    m_backgroundCombo->setCurrentIndex(theme->currentBackgroundIndex());
}
Пример #9
0
void CFX2DCsvImportDialog::addCsvFile()
{
    QStringList selFiles = QFileDialog::getOpenFileNames (this,tr("open csv file")//打开csv文件
                                   ,QString()
                                   ,tr("Ansys CFX csv file(*.csv)")//Ansys CFX csv file(*.csv)
                                   );
    if(selFiles.size ()<=0)
        return;
    QStringListModel* model = getStringListModel ();
    if(!model)
        return;
    QStringList slist = model->stringList ();
    slist += selFiles;
    model->setStringList (slist);
}
Пример #10
0
void GraphicalArrayTest::test_setValue()
{
  QString sep(";");
  GraphicalArray * value = new GraphicalArray( new QIntValidator(), sep );
  QLineEdit * lineEdit = findLineEdit(value);
  QStringListModel * model = findModel(value);

  QStringList validList;
  QStringList invalidList;

  validList << "42" << "15465" << "-145314" << "42"; // duplicates should be kept
  invalidList << "25" << "1" << "something" << "32" << "3.14" << "-54789";

  QVERIFY( is_not_null(lineEdit) );

  //
  // 1. check with strings
  //
  // 1a. list that only contains valid values
  QVERIFY( value->setValue( validList.join(sep) ) );
  QCOMPARE( model->stringList(), validList );

  // 1c. only one value
  QVERIFY( value->setValue( QString("1456789") ) );
  QCOMPARE( model->stringList().count(), 1 );
  QCOMPARE( model->stringList().at(0), QString("1456789") );

  // 1b. list that contains some invalid values
  QVERIFY( !value->setValue( invalidList.join(sep) ) );
  QStringList list = model->stringList();

  // "something" and "3.14" are invalid integers and so the value shouldn't have changed
  QCOMPARE( model->stringList().count(), 1 );
  QCOMPARE( model->stringList().at(0), QString("1456789") );

  //
  // 2. check with other types
  //
  QVERIFY( !value->setValue(true) );
  QCOMPARE( model->stringList().at(0), QString("1456789") );

  QVERIFY( !value->setValue(3.145) );
  QCOMPARE( model->stringList().at(0), QString("1456789") );

  delete value;
}
Пример #11
0
void Omnibar::setupCompleter() {
    // Set gotoEntry completer for jump history
    QStringList flagsList = this->getFlags();
    QCompleter *completer = new QCompleter(flagsList, this);
    completer->setMaxVisibleItems(20);
    completer->setCompletionMode(QCompleter::PopupCompletion);
    completer->setModelSorting(QCompleter::CaseSensitivelySortedModel);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    completer->setFilterMode(Qt::MatchContains);

    QStringListModel *completerModel = (QStringListModel*)(completer->model());
    completerModel->setStringList(completerModel->stringList() << this->commands);

    this->setCompleter(completer);
}
void ImageProcessDialog::on_butRemoveInputFileNames_clicked()
{

    if(ui->listViewInputFileNames->model())
    {
        ui->listViewInputFileNames->model()->removeRow(ui->listViewInputFileNames->currentIndex().row());

        QStringListModel* sss = (QStringListModel*)ui->listViewInputFileNames->model();

        this->imageFileNames.clear();

        this->imageFileNames = sss->stringList();

        qDebug()<<this->imageFileNames;

    }
}
Пример #13
0
void MigraineMainWindow::noMatch(const QString &name)
{
    QStringList names;
    QStringListModel *model;
    if (noMatchListView->model())
    {
        model = static_cast<QStringListModel*>(noMatchListView->model());
        names = model->stringList();
    }
    else
    {
        model = new QStringListModel(noMatchListView);
    }

    names << name;
    model->setStringList(names);

    noMatchListView->setModel(model);
}
Пример #14
0
void GraphicalArrayTest::test_constructor()
{
  GraphicalArray * value = new GraphicalArray();
  QStringListModel * model = findModel(value);

  // 1. value is empty, the line edit should be empty as well
  QVERIFY( is_not_null(model) );
  QVERIFY( model->stringList().empty() );

  delete value;

  QIntValidator * validator = new QIntValidator();
  value = new GraphicalArray( validator );
  QLineEdit * lineEdit = findLineEdit(value);

  // 2. validator objects should be the same
  QVERIFY( is_not_null(lineEdit) );
  QCOMPARE( lineEdit->validator(), validator );

  delete value;
  delete validator;
}
Пример #15
0
void MenuWidget::initMapList()
{
	QDirIterator it("data/arenas");

	QStringListModel *filelist = new QStringListModel(this->mapListView);
	QStringList list;
	
	while (it.hasNext())
	{
		it.next();
		if (!it.fileInfo().isFile())
			continue;
		qDebug() << "Found arena" << it.fileName();
		list << it.fileName();
	}
	
	filelist->setStringList(list);
	qDebug() << "string count" << filelist->stringList().count();
	mapListView->setModel(filelist);
	mapListView->setMovement(QListView::Static);
	mapListView->setEditTriggers(QAbstractItemView::NoEditTriggers);
	mapListView->setSelectionMode(QAbstractItemView::SingleSelection);
}