File: loadfromamp.cpp

package info (click to toggle)
mustang-plug 1.2-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 744 kB
  • sloc: cpp: 6,853; xml: 27; makefile: 7
file content (57 lines) | stat: -rw-r--r-- 1,423 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "loadfromamp.h"
#include "ui_loadfromamp.h"

#include "mainwindow.h"

LoadFromAmp::LoadFromAmp(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::LoadFromAmp)
{
    ui->setupUi(this);

    QSettings settings;
    restoreGeometry(settings.value("Windows/loadAmpPresetWindowGeometry").toByteArray());

    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(load()));
    connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(close()));
}

LoadFromAmp::~LoadFromAmp()
{
    QSettings settings;
    settings.setValue("Windows/loadAmpPresetWindowGeometry", saveGeometry());
    delete ui;
}

void LoadFromAmp::load()
{
    QSettings settings;

    dynamic_cast<MainWindow*>(parent())->load_from_amp(ui->comboBox->currentIndex());
    dynamic_cast<MainWindow*>(parent())->set_index(ui->comboBox->currentIndex());
    if(!settings.value("Settings/keepWindowsOpen").toBool())
        this->close();
}

void LoadFromAmp::load_names(char names[][32])
{
    for(int i = 0; i < 100; i++)
    {
        if(names[i][0] == 0x00)
            break;
        ui->comboBox->addItem(QString("[%1] %2").arg(i+1).arg(names[i]));
    }
}

void LoadFromAmp::delete_items()
{
    int j = ui->comboBox->count();
    for(int i = 0; i < j; i++)
        ui->comboBox->removeItem(0);
}

void LoadFromAmp::change_name(int slot, QString *name)
{
    ui->comboBox->setItemText(slot, *name);
    ui->comboBox->setCurrentIndex(slot);
}