void TaskDefinition::clearSecondList()
{
    if (mSecondList.size() == 0)
        return;

    mSecondList.clear();
    emit definitionChanged(TD_LIST_2);
}
void TaskDefinition::setPriority(QThread::Priority priority)
{
    if (mPriority == priority)
        return;

    mPriority = priority;
    emit definitionChanged(TD_PRIORITY);
}
void TaskDefinition::setThird(const QString& third)
{
    if (third.compare(mThird) == 0)
        return;

    mThird = third;
    emit definitionChanged(TD_THIRD);
}
void TaskDefinition::setName(const QString& name)
{
    if (name.compare(mName) == 0)
        return;

    mName = name;
    emit definitionChanged(TD_NAME);
}
void TaskDefinition::clearFirstList()
{
    if (mFirstList.size() == 0)
        return;

    mFirstList.clear();
    emit definitionChanged(TD_LIST_1);
}
void TaskDefinition::setSecond(const QString& second)
{
    if (second.compare(mSecond) == 0)
        return;

    mSecond = second;
    emit definitionChanged(TD_SECOND);
}
void TaskDefinition::setFirst(const QString& first)
{
    if (first.compare(mFirst) == 0)
        return;

    mFirst = first;
    emit definitionChanged(TD_FIRST);
}
SerializableSymbolLine::SerializableSymbolLine( SymbolLine *symbol, CigiOutgoingMsg &message ) :
    SerializableSymbol( symbol, message ),
    line( symbol )
{
    definitionChanged( line );

    line->lineStyleChanged.connect( BIND_SLOT1( SerializableSymbolLine::definitionChanged, this ) );
    line->verticesChanged.connect( BIND_SLOT1( SerializableSymbolLine::definitionChanged, this ) );
}
void TaskDefinition::addToSecondList(const std::vector<QString>& values)
{
    for (auto it = values.begin(); it != values.end(); it++)
    {
        mSecondList.push_back(*it);
    }

    if (values.size() > 0)
        emit definitionChanged(TD_LIST_2);
}
void TaskDefinition::removeFromSecondList(int index)
{
    if (index < 0 || index >= mSecondList.size())
    {
        LOG_ERROR() << "Index " << index << " out of bounds [0," <<  mSecondList.size() << "].";
        return;
    }

    mSecondList.erase(mSecondList.begin() + index);
    emit definitionChanged(TD_LIST_2);
}
QT_BEGIN_NAMESPACE

PhraseBookBox::PhraseBookBox(PhraseBook *phraseBook, QWidget *parent)
    : QDialog(parent),
      m_phraseBook(phraseBook),
      m_translationSettingsDialog(0)
{

// This definition needs to be within class context for lupdate to find it
#define NewPhrase tr("(New Entry)")

    setupUi(this);
    setWindowTitle(tr("%1[*] - Qt Linguist").arg(m_phraseBook->friendlyPhraseBookName()));
    setWindowModified(m_phraseBook->isModified());

    phrMdl = new PhraseModel(this);

    m_sortedPhraseModel = new QSortFilterProxyModel(this);
    m_sortedPhraseModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    m_sortedPhraseModel->setSortLocaleAware(true);
    m_sortedPhraseModel->setDynamicSortFilter(true);
    m_sortedPhraseModel->setSourceModel(phrMdl);

    phraseList->setModel(m_sortedPhraseModel);
    phraseList->header()->setDefaultSectionSize(150);
    phraseList->header()->setSectionResizeMode(QHeaderView::Interactive);

    connect(sourceLed, SIGNAL(textChanged(QString)),
            this, SLOT(sourceChanged(QString)));
    connect(targetLed, SIGNAL(textChanged(QString)),
            this, SLOT(targetChanged(QString)));
    connect(definitionLed, SIGNAL(textChanged(QString)),
            this, SLOT(definitionChanged(QString)));
    connect(phraseList->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
            this, SLOT(selectionChanged()));
    connect(newBut, SIGNAL(clicked()), this, SLOT(newPhrase()));
    connect(removeBut, SIGNAL(clicked()), this, SLOT(removePhrase()));
    connect(settingsBut, SIGNAL(clicked()), this, SLOT(settings()));
    connect(saveBut, SIGNAL(clicked()), this, SLOT(save()));
    connect(m_phraseBook, SIGNAL(modifiedChanged(bool)), this, SLOT(setWindowModified(bool)));

    sourceLed->installEventFilter(this);
    targetLed->installEventFilter(this);
    definitionLed->installEventFilter(this);

    foreach (Phrase *p, phraseBook->phrases())
        phrMdl->addPhrase(p);

    phraseList->sortByColumn(0, Qt::AscendingOrder);

    enableDisable();
}
void TaskDefinition::swapInSecondList(int index1, int index2)
{
    if (index1 < 0 || index1 >= mSecondList.size())
    {
        LOG_ERROR() << "Index1 " << index2 << " out of bounds [0," <<  mSecondList.size() << "].";
        return;
    }
    if (index2 < 0 || index2 >= mSecondList.size())
    {
        LOG_ERROR() << "Index2 " << index2 << " out of bounds [0," <<  mSecondList.size() << "].";
        return;
    }

    if (index1 == index2)
        return;

    //Swap
    QString swap = mSecondList.at(index1);
    mSecondList.replace(index1, mSecondList.at(index2));
    mSecondList.replace(index2, swap);

    emit definitionChanged(TD_LIST_2);
}
// ****************************************************************************
//  Constructor:  XMLEditFunctions::XMLEditFunctions
//
//  Programmer:  Jeremy Meredith
//  Creation:    October 17, 2002
//
//  Modifications:
//    Brad Whitlock, Thu Mar 6 15:42:34 PST 2008
//    Added target.
//
//    Brad Whitlock, Mon Apr 28 15:59:56 PDT 2008
//    Added access, tr()'s.
//
//    Cyrus Harrison, Thu May 15 16:00:46 PDT 2008
//    First pass at porting to Qt 4.4.0
//
// ****************************************************************************
XMLEditFunctions::XMLEditFunctions(QWidget *p)
    : QFrame(p)
{
    QHBoxLayout *hLayout = new QHBoxLayout(this);

    QGridLayout *listLayout = new QGridLayout();

    functionlist = new QListWidget(this);
    listLayout->addWidget(functionlist, 0,0, 1,2);

    newButton = new QPushButton(tr("New"), this);
    listLayout->addWidget(newButton, 1,0);

    delButton = new QPushButton(tr("Del"), this);
    listLayout->addWidget(delButton, 1,1);
    hLayout->addLayout(listLayout);
    hLayout->addSpacing(10);

    QGridLayout *topLayout = new QGridLayout();
    int row = 0;

    topLayout->addWidget(new QLabel(tr("Target"), this), row, 0);
    target = new QLineEdit(this);
    topLayout->addWidget(target, row, 1);
    row++;

    topLayout->addWidget(new QLabel(tr("Name"), this), row, 0);
    name = new QLineEdit(this);
    topLayout->addWidget(name, row, 1);
    row++;

    typeGroup = new QButtonGroup(this);
    
    newFunctionButton    = new QRadioButton(tr("New function"), this);
    replaceBuiltinButton = new QRadioButton(tr("Replaces builtin"), this);
    newFunctionButton->setChecked(true);
    
    typeGroup->addButton(newFunctionButton,0);
    typeGroup->addButton(replaceBuiltinButton,1);
    
    topLayout->addWidget(newFunctionButton,    row, 0);
    topLayout->addWidget(replaceBuiltinButton, row, 1);
    row++;

    member = new QCheckBox(tr("Class member"), this);
    topLayout->addWidget(member, row,0,1,2);
    row++;

    accessLabel = new QLabel(tr("Access"), this);
    access = new QComboBox(this);
    access->addItem(tr("private"));
    access->addItem(tr("protected"));
    access->addItem(tr("public"));
    topLayout->addWidget(accessLabel, row, 0);
    topLayout->addWidget(access,      row, 1);
    row++;

    topLayout->addWidget(new QLabel(tr("Declaration"), this), row, 0);
    declaration = new QLineEdit(this);
    topLayout->addWidget(declaration, row, 1);
    row++;

    topLayout->addWidget(new QLabel("Definition", this), row, 0);
    row++;

    definition = new QTextEdit(this);
    QFont monospaced("Courier");
    definition->setFont(monospaced);
    definition->setWordWrapMode(QTextOption::NoWrap);
    topLayout->addWidget(definition, row,0, 1,2);
    row++;

    topLayout->setRowMinimumHeight(row, 20);
    row++;
    
    hLayout->addLayout(topLayout);
    
    connect(functionlist, SIGNAL(currentRowChanged(int)),
            this, SLOT(UpdateWindowSingleItem()));
    connect(name, SIGNAL(textChanged(const QString&)),
            this, SLOT(nameTextChanged(const QString&)));
    connect(typeGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(typeGroupChanged(int)));
    connect(member, SIGNAL(clicked()),
            this, SLOT(memberChanged()));
    connect(target, SIGNAL(textChanged(const QString&)),
            this, SLOT(targetTextChanged(const QString&)));
    connect(declaration, SIGNAL(textChanged(const QString&)),
            this, SLOT(declarationTextChanged(const QString&)));
    connect(definition, SIGNAL(textChanged()),
            this, SLOT(definitionChanged()));
    connect(newButton, SIGNAL(clicked()),
            this, SLOT(functionlistNew()));
    connect(delButton, SIGNAL(clicked()),
            this, SLOT(functionlistDel()));
    connect(access, SIGNAL(activated(int)),
            this, SLOT(accessChanged(int)));
}
Exemple #14
0
// ****************************************************************************
//  Constructor:  XMLEditConstants::XMLEditConstants
//
//  Programmer:  Jeremy Meredith
//  Creation:    October 17, 2002
//
//  Modifications:
//    Brad Whitlock, Thu Mar 6 16:11:47 PST 2008
//    Added targets.
//
//    Cyrus Harrison, Thu May 15 16:00:46 PDT 200
//    First pass at porting to Qt 4.4.0
//
// ****************************************************************************
XMLEditConstants::XMLEditConstants(QWidget *p)
    : QFrame(p)
{
    QHBoxLayout *hLayout = new QHBoxLayout(this);
    setLayout(hLayout);
    
    QGridLayout *listLayout = new QGridLayout();
    constantlist = new QListWidget(this);
    listLayout->addWidget(constantlist, 0,0, 1,2);

    newButton = new QPushButton(tr("New"), this);
    listLayout->addWidget(newButton, 1,0);

    delButton = new QPushButton(tr("Del"), this);
    listLayout->addWidget(delButton, 1,1);

    hLayout->addLayout(listLayout);
    hLayout->addSpacing(10);

    QGridLayout *topLayout = new QGridLayout();
    
    int row = 0;

    topLayout->addWidget(new QLabel(tr("Target"), this), row, 0);
    target = new QLineEdit(this);
    topLayout->addWidget(target, row, 1);
    row++;

    topLayout->addWidget(new QLabel(tr("Name"), this), row, 0);
    name = new QLineEdit(this);
    topLayout->addWidget(name, row, 1);
    row++;

    member = new QCheckBox(tr("Class member"), this);
    topLayout->addWidget(member, row,0, 1,2);
    row++;

    topLayout->addWidget(new QLabel(tr("Declaration"), this), row, 0);
    declaration = new QLineEdit(this);
    topLayout->addWidget(declaration, row, 1);
    row++;

    topLayout->addWidget(new QLabel(tr("Definition"), this), row, 0);
    row++;

    definition = new QTextEdit(this);
    QFont monospaced("Courier");
    definition->setFont(monospaced);
    definition->setWordWrapMode(QTextOption::NoWrap);
    topLayout->addWidget(definition, row,0, 1,2);
    row++;

    topLayout->setRowMinimumHeight(row, 20);
    row++;

    hLayout->addLayout(topLayout);
    
    connect(constantlist, SIGNAL(currentRowChanged(int)),
            this, SLOT(UpdateWindowSingleItem()));
    connect(target, SIGNAL(textChanged(const QString&)),
            this, SLOT(targetTextChanged(const QString&)));
    connect(name, SIGNAL(textChanged(const QString&)),
            this, SLOT(nameTextChanged(const QString&)));
    connect(member, SIGNAL(clicked()),
            this, SLOT(memberChanged()));
    connect(declaration, SIGNAL(textChanged(const QString&)),
            this, SLOT(declarationTextChanged(const QString&)));
    connect(definition, SIGNAL(textChanged()),
            this, SLOT(definitionChanged()));
    connect(newButton, SIGNAL(clicked()),
            this, SLOT(constantlistNew()));
    connect(delButton, SIGNAL(clicked()),
            this, SLOT(constantlistDel()));
}
void TaskDefinition::addToFirstList(const QString& value)
{
    mFirstList.push_back(value);

    emit definitionChanged(TD_LIST_1);
}
void TaskDefinition::addToSecondList(const QString& value)
{
    mSecondList.push_back(value);

    emit definitionChanged(TD_LIST_2);
}
void TaskDefinition::updateDefinitionChanged(ETaskData field)
{
    emit definitionChanged(field);
}