ComboBoxChoiceFieldWidget::ComboBoxChoiceFieldWidget(QMutex* mutex, Poppler::FormFieldChoice* formField, QWidget* parent) : QComboBox(parent),
    m_mutex(mutex),
    m_formField(formField)
{
    LOCK_FORM_FIELD

    addItems(m_formField->choices());

    if(!m_formField->currentChoices().isEmpty())
    {
        setCurrentIndex(m_formField->currentChoices().first());
    }

    connect(this, SIGNAL(currentIndexChanged(int)), SLOT(on_currentIndexChanged(int)));
    connect(this, SIGNAL(currentIndexChanged(int)), SIGNAL(wasModified()));

#ifdef HAS_POPPLER_22

    if(m_formField->isEditable())
    {
        setEditable(true);
        setInsertPolicy(QComboBox::NoInsert);

        lineEdit()->setText(m_formField->editChoice());

        connect(lineEdit(), SIGNAL(textChanged(QString)), SLOT(on_currentTextChanged(QString)));
        connect(lineEdit(), SIGNAL(textChanged(QString)), SIGNAL(wasModified()));

        connect(lineEdit(), SIGNAL(returnPressed()), SLOT(hide()));
    }
    else
    {
        connect(this, SIGNAL(activated(int)), SLOT(hide()));
    }

#else

    connect(this, SIGNAL(activated(int)), SLOT(hide()));

#endif // HAS_POPPLER_22
}
Beispiel #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    this->setWindowIcon(QIcon(":/images/Earth-icon.png"));
    ui->actionExit->setIcon(QIcon(":/system/power_off.png"));

    ui->actionShow_spectrum->setChecked(true);

    connect(ui->listView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(on_listView_clicked(const QModelIndex&)));
    connect(ui->listView, SIGNAL(sig_sel_changed(const QModelIndex&)),this, SLOT(on_listView_clicked(const QModelIndex&)));

    connect(ui->descriptionTextEdit, SIGNAL(textChanged()), this, SLOT(on_descriptionChanged()));
    connect(ui->titleLineEdit, SIGNAL(textChanged(QString)), this, SLOT(on_titleChanged(QString)));
    connect(ui->fromLineEdit, SIGNAL(textChanged(QString)), this, SLOT(on_fromChanged(QString)));
    connect(ui->toLineEdit, SIGNAL(textChanged(QString)), this, SLOT(on_toChanged(QString)));
    connect(ui->dateLineEdit, SIGNAL(textChanged(QString)), this, SLOT(on_dateChanged(QString)));
    connect(ui->comboBox, SIGNAL(currentTextChanged(QString)), this, SLOT(on_currentTextChanged(QString)));
    connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(on_filteredTextChnged(QString)));
    connect(ui->overtimeLineEdit, SIGNAL(textChanged(QString)), this, SLOT(on_overtimeTextChanged(QString)));
    connect(this, SIGNAL(destroyed()), this, SLOT(on_Savetimeout()));

    // set up style
    //Style::get_style(true);
    QString style = Style::get_style(true);
    this->setStyleSheet(style);

    Refresh("Today");

    ui->listView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    ui->listView->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui->listView->show_big_items(true);
    ui->listView->select_row(0);

    HandleFilters();

    ui->comboBox->setFocusPolicy(Qt::NoFocus);

    manager = new TSManager();

    //set up filter to today
    int todayIndex = ui->comboBox->findText("Today");
    ui->comboBox->setCurrentIndex(todayIndex);

    ui->descriptionTextEdit->setStyleSheet(Style::set_textEdit_style());
    ui->descriptionTextEdit->setAcceptRichText(true);
    //ui->titleLineEdit->setStyleSheet(Style::set_textEdit_style());

    timer = new QTimer(this) ;
    connect(timer, SIGNAL(timeout()), this, SLOT(on_timeout()));
    timer->setInterval(2000);
    timer->start();

    timerSave = new QTimer(this) ;
    connect(timerSave, SIGNAL(timeout()), this, SLOT(on_Savetimeout()));
    timerSave->setInterval(60000); // co 60 s
    timerSave->start();

    this->setMouseTracking(true);


    PersistentStorage_XML* storage = &TSCore::I().entriesStorage;
    QList<float> list = storage->GetSpectrum();
    ui->spectrum->set_spectrum(list);

    ui->spectrum->setMinimumWidth(ui->spectrum->height()*1.618);
    ui->spectrum->resize(ui->spectrum->height()*1.618,ui->spectrum->height());

    this->resize(this->height()*1.618, this->height());
    ui->descriptionTextEdit->setMouseTracking(true);

    ui->urlLabel->setText("");
    ui->urlLabel->setMaximumHeight(24);
}