Пример #1
0
bool Terminal::setEncoding(const QString& encoding)
{
    // Since there can be multiple names for the same codec (i.e., "utf8" and
    // "utf-8"), we need to get the codec in the system first and use its
    // canonical name
    QTextCodec* codec = QTextCodec::codecForName(encoding.toLatin1());
    if (!codec) {
        return false;
    }

    // Check whether encoding actually needs to be changed
    const QString encodingBeforeUpdate(m_encoding.getName());
    if (0 == encodingBeforeUpdate.compare(QString(codec->name()), Qt::CaseInsensitive)) {
        return false;
    }

    m_encoding.setEncoding(encoding);

    // Emit the signal only if the encoding actually was changed
    const QString encodingAfterUpdate(m_encoding.getName());
    if (0 == encodingBeforeUpdate.compare(encodingAfterUpdate, Qt::CaseInsensitive)) {
        return false;
    }

    emit encodingChanged(encoding);

    return true;
}
Пример #2
0
void BufferWidget::doBufferEncodingChanged(const QByteArray &e)
{
	const editor::Buffer *b =
	        dynamic_cast<const editor::Buffer *>(sender());
	if(b == nullptr)
		return;

	const editor::Buffer *current = currentBuffer();

	if(b == current)
		Q_EMIT(encodingChanged(e));
}
Пример #3
0
void BufferWidget::doTabChanged(int i)
{
	Q_EMIT bufferChanged();

	Pane *p = dynamic_cast<Pane *>(tabWidget->widget(i));

	if(p != nullptr)
	{
		QTextCursor curs = p->getBuffer()->textCursor();

		p->getBuffer()->setFocus(Qt::OtherFocusReason);

		Q_EMIT pathChanged(p->getBuffer()->getPath());
		Q_EMIT encodingChanged(p->getBuffer()->getEncoding());
	}
	else
	{
		Q_EMIT pathChanged("");
		Q_EMIT encodingChanged("UTF-8");
	}
}
Пример #4
0
void Configure::on_encodingComboBox_currentIndexChanged(int index)
{
    qDebug() << "audio_encoding changed to :  " << index;
    if (index == 2){
        widget.audioChannelsSpinBox->setDisabled(TRUE);
        widget.sampleRateComboBox->setDisabled(TRUE);
    }
    else {
        widget.audioChannelsSpinBox->setDisabled(FALSE);
        widget.sampleRateComboBox->setDisabled(FALSE);
    }
    emit encodingChanged(index);
}
Пример #5
0
ResultForm::ResultForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ResultForm), m_request(0), m_response(0)
{
    ui->setupUi(this);

    connect(ui->requestRadio, SIGNAL(toggled(bool)), this, SLOT(renderData()));
    connect(ui->responseRadio, SIGNAL(toggled(bool)), this, SLOT(renderData()));

    connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(renderData()));

    connect(ui->encodingCBox, SIGNAL(currentTextChanged(QString)),
            this, SLOT(encodingChanged(QString)));
}
Пример #6
0
int preferencesForm::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: defaultDataChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: defaultTextChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: encodingChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: chooseLocation(); break;
        case 4: loadSettings(); break;
        case 5: saveSettings(); break;
        case 6: languageChange(); break;
        default: ;
        }
        _id -= 7;
    }
    return _id;
}
Пример #7
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QObject::connect(ui->treeWidget, SIGNAL(selectedDumpChanged(Dump const*)),
        this, SLOT(on_selectedDumpChanged(Dump const*)));

    m_txtView = ui->txtView;
    m_hexView = new HexViewWidget(ui->hexScroll);
    m_bmpView = new BitmapWidget(ui->bmpScroll);

    ui->hexScroll->setWidget(m_hexView);
    ui->bmpScroll->setWidget(m_bmpView);

    connect(ui->txtView, SIGNAL(labelAdded(Label)), ui->tableWidget, SLOT(addLabel(Label)));
    connect(ui->txtView, SIGNAL(encodingChanged()), this, SLOT(onEncodingChanged()));
    ui->txtView->setEncodings(ui->tableWidget->getEncodings());

    on_actionNew_set_triggered();
    //ui->treeWidget->addDump("C:/Users/nhurman/Documents/GitHub/data-carving/build-BitGrapher-Desktop_Qt_5_3_0_MinGW_32bit-Debug/dump3.txt");
    //ui->treeWidget->addDump("C:/Users/nhurman/Documents/GitHub/data-carving/build-BitGrapher-Desktop_Qt_5_3_0_MinGW_32bit-Debug/dump3_.txt");
}
Пример #8
0
void Buffer::setEncoding(const Encoding *encoding) {
    if (m_encoding != encoding) {
        m_encoding = encoding;
        emit encodingChanged(encoding);
    }
}
ImportWizardPreviewPage::ImportWizardPreviewPage(QString importFileName, QStringList *stringList,
    QWidget *parent) :  QWizardPage(parent), importFileName(importFileName), strList(stringList)
{
    setTitle(tr("Preview"));

    QGridLayout* pGridLayout = new QGridLayout;

    pCheckBox_areHeadersIncluded = new QCheckBox(tr("First row is headers"));
    pCheckBox_areHeadersIncluded->setChecked(false);

    QLabel* pFirstRowLabel = new QLabel(tr("first row"));
    pFirstRowLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    pFirstRowEdit = new QSpinBox();
    pFirstRowEdit->setMinimum(1);
    QLabel* pLastRowLabel = new QLabel(tr("last row"));
    pLastRowLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    pLastRowEdit = new QSpinBox();
    pLastRowEdit->setMinimum(1);    

    encodingComboBox = new QComboBox();
    QList<QByteArray> availableCodecs = QTextCodec::availableCodecs();
    for (QByteArray codec : availableCodecs)
        encodingComboBox->addItem(QString(codec));
    connect(encodingComboBox, SIGNAL(currentTextChanged(QString)), this, SLOT(encodingChanged(QString)));

    pCheckBox_Tab = new QCheckBox(tr("Tabulation character"));
    pCheckBox_Tab->setChecked(true);
    pCheckBox_Space = new QCheckBox(tr("Space"));
    pCheckBox_SemiColon = new QCheckBox(tr("Semicolon"));
    pCheckBox_Comma = new QCheckBox(tr("Comma"));
    pCheckBox_OtherSeparator = new QCheckBox(tr("Other (regular expression)"));
    pTextEdit_RegExp = new QLineEdit();

    QHBoxLayout* hBox = new QHBoxLayout();
    hBox->addWidget(pCheckBox_areHeadersIncluded);
    hBox->addSpacing(50);
    hBox->addWidget(pFirstRowLabel);
    hBox->addWidget(pFirstRowEdit);
    hBox->addWidget(pLastRowLabel);
    hBox->addWidget(pLastRowEdit);
    hBox->addWidget(encodingComboBox);
    hBox->addStretch(1);

    QGridLayout* separatorGrid = new QGridLayout();
    separatorGrid->addWidget(pCheckBox_Tab, 0, 0, 1, 1);
    separatorGrid->addWidget(pCheckBox_Space, 0, 1, 1, 1);
    separatorGrid->addWidget(pCheckBox_SemiColon, 1, 0, 1, 1);
    separatorGrid->addWidget(pCheckBox_Comma, 1, 1, 1, 1);
    separatorGrid->addWidget(pCheckBox_OtherSeparator, 2, 0, 1, 2);
    separatorGrid->addWidget(pTextEdit_RegExp, 2, 2, 1, 1);

    QGroupBox* separatorGroupBox = new QGroupBox(tr("Column separator"));
    separatorGroupBox->setLayout(separatorGrid);

    pTextEdit = new QPlainTextEdit();
    pTextEdit->setWordWrapMode(QTextOption::NoWrap);
    pTextEdit->setReadOnly(true);
    pTextEdit->setUndoRedoEnabled(false);

    pGridLayout->addLayout(hBox, 0, 0);
    pGridLayout->addWidget(separatorGroupBox, 1, 0);
    pGridLayout->addWidget(pTextEdit, 2, 0);
    pGridLayout->setMargin(0);
    setLayout(pGridLayout);

    registerField("areHeadersIncluded",  pCheckBox_areHeadersIncluded);
    registerField("firstRow",  pFirstRowEdit);
    registerField("lastRow",  pLastRowEdit);
    registerField("isTabSeparator",  pCheckBox_Tab);
    registerField("isSpaceSeparator",  pCheckBox_Space);
    registerField("isSemicolonSeparator",  pCheckBox_SemiColon);
    registerField("isCommaSeparator",  pCheckBox_Comma);
    registerField("isOtherSeparator",  pCheckBox_OtherSeparator);
    registerField("regExpSeparator",  pTextEdit_RegExp);
}
Пример #10
0
MainWindow::MainWindow(
  QWidget *parent)
  : QMainWindow(parent),
    preferencesForm(0),
    videoMonitorForm(0),
    documentationForm(0),
    aboutForm(0),
    myGst(0),
    myDBus(0),
//    myUrlDialog(0),
    lastActiveStatus(Playing_Status), // this is a hack
    audioChoice(Microphone_Audio),
    videoChoice(No_Video),
    elapsedTime(0),
    ui(new Ui::MainWindow)
{
  ui->setupUi(this);

  ui->pauseButton->setEnabled(false);
  ui->stopButton->setEnabled(false);

  updateStatus(Idle_Status);

  setAttribute(Qt::WA_Maemo5StackedWindow);

  preferencesForm = new OrePreferencesForm(this);
  videoMonitorForm = new OreVideoMonitorForm(this);

  myGst = new OreGst(this, videoMonitorForm->getWindowId());
  myDBus = new OreDBus();
//  myUrlDialog = new OreMJpegDialog(this);

  connect(
    myDBus, SIGNAL(callStarted()),
    this, SLOT(startRecordingCall()));

  connect(
    myDBus, SIGNAL(callTerminated()),
    this, SLOT(stopRecordingCall()));

  connect(
    myDBus, SIGNAL(playingAllowed()),
    this, SLOT(startPlaying()));

  connect(
    myDBus, SIGNAL(playingDenied()),
    this, SLOT(stopPlaying()));

  connect(
    preferencesForm, SIGNAL(encodingChanged(AudioEncoding)),
    myGst, SLOT(setAudioEncoding(AudioEncoding)));

  secondTimer.setInterval(1000);

  connect(
    &secondTimer, SIGNAL(timeout()),
    this, SLOT(updateStatusTime()));

  // Set up the combo boxes:
  QSettings settings("pietrzak.org", "Orecchiette");
  if (settings.contains("AudioSourceChoice"))
  {
    QString asc = settings.value("AudioSourceChoice").toString();

    if (asc == "Microphone_Audio")
    {
      ui->audioComboBox->setCurrentIndex(1);
    }
    else if (asc == "Speaker_Audio")
    {
      ui->audioComboBox->setCurrentIndex(2);
    }
    else if (asc == "MicrophoneAndSpeaker_Audio")
    {
      ui->audioComboBox->setCurrentIndex(3);
    }
    else
    {
      ui->audioComboBox->setCurrentIndex(0);
    }
  }

  if (settings.contains("VideoSourceChoice"))
  {
    QString vsc = settings.value("VideoSourceChoice").toString();

    if (vsc == "Screen_Video")
    {
      ui->videoComboBox->setCurrentIndex(1);
    }
    else if (vsc == "BackCamera_Video")
    {
      ui->videoComboBox->setCurrentIndex(2);
    }
    else if (vsc == "FrontCamera_Video")
    {
      ui->videoComboBox->setCurrentIndex(3);
    }
/*
    else if (vsc == "MJpegStream_Video")
    {
      ui->videoComboBox->setCurrentIndex(4);
    }
*/
    else
    {
      ui->videoComboBox->setCurrentIndex(0);
    }
  }

  if (preferencesForm)
  {
/*
    switch (preferencesForm->source)
    {
    case OrePreferencesForm::Microphone:
      ui->inputButton->click();
      break;
    case OrePreferencesForm::Speaker:
      ui->outputButton->click();
      break;
    case OrePreferencesForm::Both:
    default:
      ui->bothButton->click();
      break;
    }
*/

    if (preferencesForm->recordOnStartUp())
    {
      // Act like the Record button's been pressed immediately after initialization
      ui->recordButton->click();
    }
  }
}