Esempio n. 1
0
void tst_IrcBuffer::testTitleNamePrefix()
{
    IrcBuffer buffer;

    QSignalSpy titleSpy(&buffer, SIGNAL(titleChanged(QString)));
    QSignalSpy nameSpy(&buffer, SIGNAL(nameChanged(QString)));
    QSignalSpy prefixSpy(&buffer, SIGNAL(prefixChanged(QString)));
    QVERIFY(titleSpy.isValid());
    QVERIFY(nameSpy.isValid());
    QVERIFY(prefixSpy.isValid());

    buffer.setName("name");
    QCOMPARE(buffer.title(), QString("name"));
    QCOMPARE(buffer.name(), QString("name"));
    QCOMPARE(buffer.prefix(), QString());
    QCOMPARE(titleSpy.count(), 1);
    QCOMPARE(titleSpy.last().first().toString(), QString("name"));
    QCOMPARE(nameSpy.count(), 1);
    QCOMPARE(nameSpy.last().first().toString(), QString("name"));
    QCOMPARE(prefixSpy.count(), 0);

    buffer.setPrefix("prefix");
    QCOMPARE(buffer.title(), QString("prefixname"));
    QCOMPARE(buffer.name(), QString("name"));
    QCOMPARE(buffer.prefix(), QString("prefix"));
    QCOMPARE(titleSpy.count(), 2);
    QCOMPARE(titleSpy.last().first().toString(), QString("prefixname"));
    QCOMPARE(nameSpy.count(), 1);
    QCOMPARE(prefixSpy.count(), 1);
    QCOMPARE(prefixSpy.last().first().toString(), QString("prefix"));
}
Esempio n. 2
0
void FrameSvgItem::setPrefix(const QString &prefix)
{
    if (m_prefix == prefix) {
        return;
    }

    m_frameSvg->setElementPrefix(prefix);
    m_prefix = prefix;

    if (implicitWidth() <= 0) {
        setImplicitWidth(m_frameSvg->marginSize(Plasma::Types::LeftMargin) + m_frameSvg->marginSize(Plasma::Types::RightMargin));
    }

    if (implicitHeight() <= 0) {
        setImplicitHeight(m_frameSvg->marginSize(Plasma::Types::TopMargin) + m_frameSvg->marginSize(Plasma::Types::BottomMargin));
    }

    emit prefixChanged();
    m_margins->update();
    m_fixedMargins->update();

    if (isComponentComplete()) {
        m_frameSvg->resizeFrame(QSizeF(width(), height()));
        m_textureChanged = true;
        update();
    }
}
Esempio n. 3
0
void GolangCode::setCompleter(LiteApi::ICompleter *completer)
{
    if (m_completer) {
        disconnect(m_completer,0,this,0);
    }
    m_completer = completer;
    if (m_completer) {
        if (!m_gocodeCmd.isEmpty()) {
            m_completer->setSearchSeparator(false);
            m_completer->setExternalMode(true);
            connect(m_completer,SIGNAL(prefixChanged(QTextCursor,QString)),this,SLOT(prefixChanged(QTextCursor,QString)));
            connect(m_completer,SIGNAL(wordCompleted(QString,QString)),this,SLOT(wordCompleted(QString,QString)));
        } else {
            m_completer->setSearchSeparator(true);
            m_completer->setExternalMode(false);
        }
    }
}
Esempio n. 4
0
QString ParameterFileModel::setPrefix(const QString& newPrefix) {
	if (newPrefix == _prefix)
		return _prefix;
	QString old = _prefix;
	_prefix = newPrefix;
	_update();
	emit prefixChanged(_prefix);
	return old;
}
Esempio n. 5
0
    string AutoComplete::getNextWord(string& prefix)
    {
        if(prefix == "")
        {
            prefixChanged();
            return "";
        }

        if(prefix != mLastPrefix)
        {
            prefixChanged(prefix);
            mTrie.findWordsWithPrefix(prefix, mWords);
        }

        string result = prefix;

        if(mWords.size() > 0)
        {
            result = mWords[mCounter % mWords.size()];
            mCounter++;
        }

        return result;
    }
Esempio n. 6
0
 AutoComplete::AutoComplete()
 {
     prefixChanged();
 }
Esempio n. 7
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    logfileIndicator (new QLabel ( this)),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    this->setWindowTitle( tr("QT Logger") );

    version = "1.1.2";


    this->setMouseTracking(true);
    this->setBackgroundRole(QPalette::Base);

    QCoreApplication::setOrganizationName("openhpsdr");
    QCoreApplication::setOrganizationDomain("openhpsdr.org");
    QCoreApplication::setApplicationName("QtLogger");

    //logfileIndicator->setStyleSheet (QString ("QLabel {color:red}"));
    logfileIndicator->setPixmap(QPixmap(":/icons/filefoldergrey16.svg"));
    logfileIndicator->setToolTip(QString("Logfile: No file")  );

    About *about = new About();
    about->setVersion( version );


    Help *help = new Help();

    data = new Data();
    data->setMinimumHeader();

    add = new addDialog( this );


    readDefinitions(":/xml/adif_codes_2.2.7.xml");


    add->loadmodeComboBox( modes );
    add->loadcountryComboBox( country );
    add->loadsubdivisionsComboBox( subdivisions );
    add->loadbandsData( bands );

    last = new lastContact( this );

    pref = new Preferences( this );
    pref->setPreferences( QString("radio"), settings.value("preference_radio").toString() );
    pref->setPreferences( QString("location"), settings.value("preference_location").toString() );
    pref->setPreferences( QString("event"), settings.value("preference_event").toString() );
    pref->setPreferences( QString("owner"), settings.value("preference_owner").toString() );
    pref->setPreferences( QString("qsl"), settings.value("preference_qsl").toString() );
    pref->setPreferences( QString("callfilter"), settings.value("callsign_filter").toString() );
    add->callsign_filter = pref->getPreferences("callfilter");


    udpSocket = new QUdpSocket(this);
    udpSocket->bind( 11500, QUdpSocket::ShareAddress );

    statusBar ()->addPermanentWidget (logfileIndicator);

    ui->tableView->verticalScrollBar()->setValue(ui->tableView->verticalScrollBar()->maximum());

    deleteFlag = false;

    connect(udpSocket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams()));
    connect(ui->actionQuit,SIGNAL(triggered()),this,SLOT(closeDown()));
    connect(ui->actionAbout,SIGNAL(triggered()),about,SLOT(aboutMessage()));
    connect(ui->actionHelp,SIGNAL(triggered()),help,SLOT(show()));
    connect(ui->actionPreferences,SIGNAL(triggered()),pref,SLOT(show()));
    connect(pref,SIGNAL(preferencesChanged()),this,SLOT(updateView()));
    connect(ui->actionOpen,SIGNAL(triggered()),data,SLOT(readData()));
    connect(ui->actionLast_Contact,SIGNAL(triggered()),last,SLOT(show()));
    connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(updateStatus()));
    connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(writeData()));
    connect(ui->actionSupport_Directory,SIGNAL(triggered()),this,SLOT(setSupportDirectory()));
    connect(ui->actionLog_Directory,SIGNAL(triggered()),this,SLOT(setLogDirectory()));
    connect(ui->tableView,SIGNAL(clicked(QModelIndex)),this,SLOT(removeTableRow(QModelIndex)));
    connect(ui->tableView,SIGNAL(activated(QModelIndex)),ui->tableView,SLOT(resizeRowsToContents()));
    connect(ui->actionAdd,SIGNAL(triggered()),add,SLOT(show()));
    connect(add,SIGNAL(newdata()),this,SLOT(update()));
    connect(data,SIGNAL(refresh()),this,SLOT(update()));
    connect(ui->actionDelete,SIGNAL(toggled(bool)),this,SLOT(setDeleteFlag(bool)));
    connect(add,SIGNAL(ownerChanged()),this,SLOT(updateOwner()));
    connect(add,SIGNAL(prefixChanged(QString)),last->proxyModel,SLOT(setFilterRegExp(QString)));
    connect(add,SIGNAL(prefixChanged(QString)),last,SLOT(setCallLabel(QString)));
    connect(add,SIGNAL(prefixChanged(QString)),add->proxyModel,SLOT(setFilterRegExp(QString)));
}