Beispiel #1
0
// Конструктор TransCoder
TransCoder::TransCoder(QWidget *parent) : QMainWindow(parent)
{
    setupUi(this);

    defaultContainer = 1;
    defaultCodec = 1;
    transcoder = this;
    bitrateList << 8 << 16 << 24 << 32 << 40 <<
                48 << 56 << 64 << 80 << 96 << 112 <<
                128 << 160 << 192 << 224 << 256 << 320;

    treeWidget->setHeaderLabels(QStringList() << trUtf8("Композиция") << trUtf8("Время"));
    treeWidget->header()->setStretchLastSection(false);
    treeWidget->setColumnWidth(1, 75);
    treeWidget->header()->setSectionResizeMode(0,QHeaderView::Stretch);

    containerBox->addItems(QStringList() << "ogg" << "mp3" << "flac" << "aac");
    codecBox->addItems(QStringList() << "vorbis" << "lame" << "flac" << "faac");

    containerBox->setCurrentIndex(defaultContainer);
    codecBox->setCurrentIndex(defaultCodec);

    statusLabel = new QLabel();
    lineEdit->setText(QDir::homePath());
    dirdialog = new QFileDialog(this, trUtf8("Выбрать директорию для сохранения альбома"), QDir::homePath());
    dirdialog->setFileMode(QFileDialog::DirectoryOnly);
    dirdialog->setOption(QFileDialog::DontUseNativeDialog, true);
    statusBar()->addWidget(statusLabel, 1);
    selectAllAction->setStatusTip(trUtf8("Выбор всех композиций для кодирования"));

    selected = false;
    transcode = false;
    numTrack = 0;

    timer = new QTimer(this);

    // Костыль для неюникодовых локалей
    localFileNamesEncoder = QTextCodec::codecForLocale()->makeEncoder();

    restoreSettings();

    connect(selectDirButton, SIGNAL(clicked()), dirdialog, SLOT(exec()));
    connect(dirdialog, SIGNAL(directoryEntered(QString)), lineEdit, SLOT(setText(QString)));
    connect(dirdialog, SIGNAL(directoryEntered(QString)), this, SLOT(updateSettings()));
    connect(timer, SIGNAL(timeout()), this, SLOT(timerUpdate()));
    connect(selectAllAction, SIGNAL(triggered()), this, SLOT(selectAllTrigger()));
    connect(startButton, SIGNAL(clicked()), this, SLOT(startTranscode()));
    connect(stopButton, SIGNAL(clicked()), this, SLOT(stopAll()));
    connect(containerBox, SIGNAL(activated(int)), codecBox, SLOT(setCurrentIndex(int)));
    connect(codecBox, SIGNAL(activated(int)), containerBox, SLOT(setCurrentIndex(int)));
    connect(treeWidget, SIGNAL(itemEntered(QTreeWidgetItem*,int)), this, SLOT(toolItem(QTreeWidgetItem*,int)));
    connect(treeWidget, SIGNAL(itemPressed(QTreeWidgetItem*,int)), this, SLOT(toolItem(QTreeWidgetItem*,int)));
    connect(quitAction, SIGNAL(triggered()), this, SIGNAL(transQuit()));
    connect(prefAction, SIGNAL(triggered()), this, SIGNAL(prefShow()));
}
Beispiel #2
0
FileDialog::FileDialog(QWidget *parent)
    : QFileDialog(parent)
{
    // Remove the default Choose button to prevent it being updated elsewhere
    QDialogButtonBox *box = qFindChild<QDialogButtonBox*>(this);
    Q_ASSERT(box);
    box->removeButton(box->button(QDialogButtonBox::Open));

    // Add our own button so we can disable/enable it
    mChooseButton = new QPushButton(tr("&Choose"));
    mChooseButton->setIcon(QIcon::fromTheme("document-open"));
    mChooseButton->setEnabled(false);
    box->addButton(mChooseButton, QDialogButtonBox::AcceptRole);

    connect(this, SIGNAL(directoryEntered(const QString&)), this, SLOT(updateChooseButton(const QString&)));
    emit directoryEntered(directory().absolutePath());
}
QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper()
{
    QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
    if (parentItem)
        m_parentWindow = parentItem->window();

    if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
            usePlatformNativeDialog(QPlatformTheme::FileDialog) ) {
        m_dlgHelper = static_cast<QPlatformFileDialogHelper *>(QGuiApplicationPrivate::platformTheme()
           ->createPlatformDialogHelper(QPlatformTheme::FileDialog));
        if (!m_dlgHelper)
            return m_dlgHelper;
        m_dlgHelper->setOptions(m_options);
        connect(m_dlgHelper, SIGNAL(directoryEntered(QUrl)), this, SIGNAL(folderChanged()));
        connect(m_dlgHelper, SIGNAL(filterSelected(QString)), this, SIGNAL(filterSelected()));
        connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
        connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
    }

    return m_dlgHelper;
}