Merge branch 'master' of https://github.com/olive-editor/olive
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "audio/audiomanager.h"
|
||||
#include "config/config.h"
|
||||
@@ -80,14 +79,14 @@ PreferencesAudioTab::PreferencesAudioTab()
|
||||
|
||||
row++;
|
||||
|
||||
QPushButton* refresh_devices = new QPushButton(tr("Refresh Devices"));
|
||||
audio_tab_layout->addWidget(refresh_devices, row, 1);
|
||||
refresh_devices_btn_ = new QPushButton(tr("Refresh Devices"));
|
||||
audio_tab_layout->addWidget(refresh_devices_btn_, row, 1);
|
||||
|
||||
row++;
|
||||
|
||||
RetrieveDeviceLists();
|
||||
|
||||
connect(refresh_devices, &QPushButton::clicked, this, &PreferencesAudioTab::RefreshDevices);
|
||||
connect(refresh_devices_btn_, &QPushButton::clicked, this, &PreferencesAudioTab::RefreshDevices);
|
||||
connect(AudioManager::instance(), &AudioManager::OutputListReady, this, &PreferencesAudioTab::RetrieveOutputList);
|
||||
connect(AudioManager::instance(), &AudioManager::InputListReady, this, &PreferencesAudioTab::RetrieveInputList);
|
||||
}
|
||||
@@ -151,6 +150,8 @@ void PreferencesAudioTab::RetrieveOutputList()
|
||||
AudioManager::instance()->IsRefreshingOutputs(),
|
||||
AudioManager::instance()->ListOutputDevices(),
|
||||
Config::Current()["AudioOutput"].toString());
|
||||
|
||||
UpdateRefreshButtonEnabled();
|
||||
}
|
||||
|
||||
void PreferencesAudioTab::RetrieveInputList()
|
||||
@@ -159,6 +160,8 @@ void PreferencesAudioTab::RetrieveInputList()
|
||||
AudioManager::instance()->IsRefreshingInputs(),
|
||||
AudioManager::instance()->ListInputDevices(),
|
||||
Config::Current()["AudioInput"].toString());
|
||||
|
||||
UpdateRefreshButtonEnabled();
|
||||
}
|
||||
|
||||
void PreferencesAudioTab::RetrieveDeviceLists()
|
||||
@@ -167,17 +170,22 @@ void PreferencesAudioTab::RetrieveDeviceLists()
|
||||
RetrieveInputList();
|
||||
}
|
||||
|
||||
void PreferencesAudioTab::UpdateRefreshButtonEnabled()
|
||||
{
|
||||
refresh_devices_btn_->setEnabled(audio_output_devices_->isEnabled()
|
||||
&& audio_input_devices_->isEnabled());
|
||||
}
|
||||
|
||||
void PreferencesAudioTab::PopulateComboBox(QComboBox *cb, bool still_refreshing, const QList<QAudioDeviceInfo> &list, const QString& preferred)
|
||||
{
|
||||
cb->clear();
|
||||
|
||||
cb->setEnabled(still_refreshing);
|
||||
cb->setEnabled(!still_refreshing);
|
||||
|
||||
if (still_refreshing) {
|
||||
cb->addItem(tr("Please wait..."));
|
||||
} else {
|
||||
bool found_preferred_device = false;
|
||||
cb->setEnabled(true);
|
||||
|
||||
// Add null default item
|
||||
cb->addItem(tr("Default"), QVariant());
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "preferencestab.h"
|
||||
|
||||
@@ -57,6 +58,11 @@ private:
|
||||
*/
|
||||
QComboBox* recording_combobox_;
|
||||
|
||||
/**
|
||||
* @brief Button that triggers a refresh of the available audio devices
|
||||
*/
|
||||
QPushButton* refresh_devices_btn_;
|
||||
|
||||
private slots:
|
||||
void RefreshDevices();
|
||||
|
||||
@@ -67,6 +73,8 @@ private slots:
|
||||
private:
|
||||
void RetrieveDeviceLists();
|
||||
|
||||
void UpdateRefreshButtonEnabled();
|
||||
|
||||
static void PopulateComboBox(QComboBox* cb, bool still_refreshing, const QList<QAudioDeviceInfo>& list, const QString &preferred);
|
||||
|
||||
};
|
||||
|
||||
@@ -33,18 +33,21 @@ OLIVE_NAMESPACE_ENTER
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent)
|
||||
{
|
||||
#ifdef Q_OS_WINDOWS
|
||||
// Qt on Windows has a bug that "de-maximizes" the window when widgets are added, resizing the window beforehand
|
||||
// works around that issue and we just set it to whatever size is available
|
||||
// Resizes main window to desktop geometry on startup. Fixes the following issues:
|
||||
// * Qt on Windows has a bug that "de-maximizes" the window when widgets are added, resizing the
|
||||
// window beforehand works around that issue and we just set it to whatever size is available.
|
||||
// * On Linux, it seems the window starts off at a vastly different size and then maximizes
|
||||
// which throws off the proportions and makes the resulting layout wonky.
|
||||
resize(qApp->desktop()->availableGeometry(this).size());
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
// Set up taskbar button progress bar (used for some modal tasks like exporting)
|
||||
taskbar_btn_id_ = RegisterWindowMessage("TaskbarButtonCreated");
|
||||
taskbar_interface_ = nullptr;
|
||||
#endif
|
||||
|
||||
// Create empty central widget - we don't actually want a central widget but some of Qt's docking/undocking fails
|
||||
// without it
|
||||
// Create empty central widget - we don't actually want a central widget (so we set its maximum
|
||||
// size to 0,0) but some of Qt's docking/undocking fails without it
|
||||
QWidget* centralWidget = new QWidget(this);
|
||||
centralWidget->setMaximumSize(QSize(0, 0));
|
||||
setCentralWidget(centralWidget);
|
||||
|
||||
Reference in New Issue
Block a user