diff options
author | Chris Xiong <chirs241097@gmail.com> | 2020-05-12 00:58:40 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2020-05-12 00:58:40 +0800 |
commit | a7407edaf81c685d4a389785a405a53a5de4b148 (patch) | |
tree | e6e4f2d85f2172c94ac83a6e8f01e1e90a78ede9 /qmidiplayer-desktop/qmpcustomizewindow.cpp | |
parent | 437b7b16c322a8e53ac55a5f831098494d9a7073 (diff) | |
download | QMidiPlayer-a7407edaf81c685d4a389785a405a53a5de4b148.tar.xz |
Format EVERYTHING.
Hopefully this will make the source code less horrendous and actually
readable.
The command used was:
```
astyle --suffix=none --style=allman --attach-extern-c --attach-closing-while --indent-switches --indent-after-parens --pad-oper --pad-header --unpad-paren --align-pointer=name --recursive './*.cpp,*.hpp'
```
Diffstat (limited to 'qmidiplayer-desktop/qmpcustomizewindow.cpp')
-rw-r--r-- | qmidiplayer-desktop/qmpcustomizewindow.cpp | 103 |
1 files changed, 53 insertions, 50 deletions
diff --git a/qmidiplayer-desktop/qmpcustomizewindow.cpp b/qmidiplayer-desktop/qmpcustomizewindow.cpp index 0ea3228..f4346b4 100644 --- a/qmidiplayer-desktop/qmpcustomizewindow.cpp +++ b/qmidiplayer-desktop/qmpcustomizewindow.cpp @@ -9,83 +9,86 @@ #include "ui_qmpcustomizewindow.h" qmpCustomizeWindow::qmpCustomizeWindow(QWidget *parent): - QDialog(parent), - ui(new Ui::qmpCustomizeWindow) + QDialog(parent), + ui(new Ui::qmpCustomizeWindow) { - ui->setupUi(this); + ui->setupUi(this); } qmpCustomizeWindow::~qmpCustomizeWindow() { - delete ui; + delete ui; } void qmpCustomizeWindow::load(void *data) { - ui->lwAvail->clear(); - ui->lwEnabled->clear(); - QList<QVariant> list=static_cast<QVariant*>(data)->toList(); - std::vector<std::string> v; - for(auto i:list) - v.push_back(i.toString().toStdString()); - std::map<std::string,qmpFuncPrivate>& m=qmpMainWindow::getInstance()->getFunc(); - std::set<std::string> s; - for(auto i=v.begin();i!=v.end();++i) - { - if(m.find(*i)==m.end())continue; - s.insert(*i); - QListWidgetItem* it=new QListWidgetItem( - m[*i].icon(), - QString(m[*i].desc().c_str()) - ); - it->setToolTip(i->c_str()); - ui->lwEnabled->addItem(it); - } - for(auto i=m.begin();i!=m.end();++i) - { - if(s.find(i->first)==s.end()) - { - QListWidgetItem* it=new QListWidgetItem( - i->second.icon(), - QString(i->second.desc().c_str()) - ); - it->setToolTip(i->first.c_str()); - ui->lwAvail->addItem(it); - } - } + ui->lwAvail->clear(); + ui->lwEnabled->clear(); + QList<QVariant> list = static_cast<QVariant *>(data)->toList(); + std::vector<std::string> v; + for (auto i : list) + v.push_back(i.toString().toStdString()); + std::map<std::string, qmpFuncPrivate> &m = qmpMainWindow::getInstance()->getFunc(); + std::set<std::string> s; + for (auto i = v.begin(); i != v.end(); ++i) + { + if (m.find(*i) == m.end()) + continue; + s.insert(*i); + QListWidgetItem *it = new QListWidgetItem( + m[*i].icon(), + QString(m[*i].desc().c_str()) + ); + it->setToolTip(i->c_str()); + ui->lwEnabled->addItem(it); + } + for (auto i = m.begin(); i != m.end(); ++i) + { + if (s.find(i->first) == s.end()) + { + QListWidgetItem *it = new QListWidgetItem( + i->second.icon(), + QString(i->second.desc().c_str()) + ); + it->setToolTip(i->first.c_str()); + ui->lwAvail->addItem(it); + } + } } void *qmpCustomizeWindow::save() { - QList<QVariant> ret; - for(int i=0;i<ui->lwEnabled->count();++i) - { - ret.push_back(QVariant(ui->lwEnabled->item(i)->toolTip())); - } - return new QVariant(ret); + QList<QVariant> ret; + for (int i = 0; i < ui->lwEnabled->count(); ++i) + { + ret.push_back(QVariant(ui->lwEnabled->item(i)->toolTip())); + } + return new QVariant(ret); } void qmpCustomizeWindow::on_tbAdd_clicked() { - if(!ui->lwAvail->currentItem())return; - ui->lwEnabled->addItem(ui->lwAvail->takeItem(ui->lwAvail->currentRow())); - ui->lwAvail->removeItemWidget(ui->lwAvail->currentItem()); + if (!ui->lwAvail->currentItem()) + return; + ui->lwEnabled->addItem(ui->lwAvail->takeItem(ui->lwAvail->currentRow())); + ui->lwAvail->removeItemWidget(ui->lwAvail->currentItem()); } void qmpCustomizeWindow::on_tbRemove_clicked() { - if(!ui->lwEnabled->currentItem())return; - ui->lwAvail->addItem(ui->lwEnabled->takeItem(ui->lwEnabled->currentRow())); + if (!ui->lwEnabled->currentItem()) + return; + ui->lwAvail->addItem(ui->lwEnabled->takeItem(ui->lwEnabled->currentRow())); } void qmpCustomizeWindow::on_buttonBox_accepted() { - accept(); - close(); + accept(); + close(); } void qmpCustomizeWindow::on_buttonBox_rejected() { - reject(); - close(); + reject(); + close(); } |