change: change code style to Linux style except indent.
This commit is contained in:
@@ -26,81 +26,85 @@
|
||||
|
||||
#include "ui/humanstrings.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
using namespace core;
|
||||
|
||||
class SampleFormatComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
class SampleFormatComboBox : public QComboBox {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SampleFormatComboBox(QWidget* parent = nullptr) :
|
||||
QComboBox(parent),
|
||||
attempt_to_restore_format_(true)
|
||||
{
|
||||
}
|
||||
SampleFormatComboBox(QWidget *parent = nullptr)
|
||||
: QComboBox(parent)
|
||||
, attempt_to_restore_format_(true)
|
||||
{
|
||||
}
|
||||
|
||||
void SetAttemptToRestoreFormat(bool e) { attempt_to_restore_format_ = e; }
|
||||
void SetAttemptToRestoreFormat(bool e)
|
||||
{
|
||||
attempt_to_restore_format_ = e;
|
||||
}
|
||||
|
||||
void SetAvailableFormats(const std::vector<SampleFormat> &formats)
|
||||
{
|
||||
SampleFormat tmp = SampleFormat::INVALID;
|
||||
void SetAvailableFormats(const std::vector<SampleFormat> &formats)
|
||||
{
|
||||
SampleFormat tmp = SampleFormat::INVALID;
|
||||
|
||||
if (attempt_to_restore_format_) {
|
||||
tmp = GetSampleFormat();
|
||||
}
|
||||
if (attempt_to_restore_format_) {
|
||||
tmp = GetSampleFormat();
|
||||
}
|
||||
|
||||
clear();
|
||||
foreach (const SampleFormat &of, formats) {
|
||||
AddFormatItem(of);
|
||||
}
|
||||
clear();
|
||||
foreach (const SampleFormat &of, formats) {
|
||||
AddFormatItem(of);
|
||||
}
|
||||
|
||||
if (attempt_to_restore_format_) {
|
||||
SetSampleFormat(tmp);
|
||||
}
|
||||
}
|
||||
if (attempt_to_restore_format_) {
|
||||
SetSampleFormat(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void SetPackedFormats()
|
||||
{
|
||||
SampleFormat tmp = SampleFormat::INVALID;
|
||||
void SetPackedFormats()
|
||||
{
|
||||
SampleFormat tmp = SampleFormat::INVALID;
|
||||
|
||||
if (attempt_to_restore_format_) {
|
||||
tmp = GetSampleFormat();
|
||||
}
|
||||
if (attempt_to_restore_format_) {
|
||||
tmp = GetSampleFormat();
|
||||
}
|
||||
|
||||
clear();
|
||||
for (int i=SampleFormat::PACKED_START; i<SampleFormat::PACKED_END; i++) {
|
||||
AddFormatItem(static_cast<SampleFormat::Format>(i));
|
||||
}
|
||||
clear();
|
||||
for (int i = SampleFormat::PACKED_START; i < SampleFormat::PACKED_END;
|
||||
i++) {
|
||||
AddFormatItem(static_cast<SampleFormat::Format>(i));
|
||||
}
|
||||
|
||||
if (attempt_to_restore_format_) {
|
||||
SetSampleFormat(tmp);
|
||||
}
|
||||
}
|
||||
if (attempt_to_restore_format_) {
|
||||
SetSampleFormat(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
SampleFormat GetSampleFormat() const
|
||||
{
|
||||
return static_cast<SampleFormat::Format>(this->currentData().toInt());
|
||||
}
|
||||
SampleFormat GetSampleFormat() const
|
||||
{
|
||||
return static_cast<SampleFormat::Format>(this->currentData().toInt());
|
||||
}
|
||||
|
||||
void SetSampleFormat(SampleFormat fmt)
|
||||
{
|
||||
for (int i=0; i<this->count(); i++) {
|
||||
if (this->itemData(i).toInt() == fmt) {
|
||||
this->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void SetSampleFormat(SampleFormat fmt)
|
||||
{
|
||||
for (int i = 0; i < this->count(); i++) {
|
||||
if (this->itemData(i).toInt() == fmt) {
|
||||
this->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void AddFormatItem(SampleFormat f)
|
||||
{
|
||||
this->addItem(HumanStrings::FormatToString(f), static_cast<SampleFormat::Format>(f));
|
||||
}
|
||||
|
||||
bool attempt_to_restore_format_;
|
||||
void AddFormatItem(SampleFormat f)
|
||||
{
|
||||
this->addItem(HumanStrings::FormatToString(f),
|
||||
static_cast<SampleFormat::Format>(f));
|
||||
}
|
||||
|
||||
bool attempt_to_restore_format_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user