void MainWindow::create_actions()
{
readAction
= new QAction(tr
("Read new deck"),
this);
QObject::connect(readAction,
SIGNAL(triggered
()),
this,
SLOT(read_deck
(const QString &fileName
)));
*** point of error
refreshAction
= new QAction(tr
("Reload current deck"),
this);
QObject::connect(refreshAction,
SIGNAL(triggered
()),
this,
SLOT(refresh_deck
()));
//saveAction = new QAction(tr("Save results to file"), this);
// QObject::connect(saveAction, SIGNAL(triggered()), this, SLOT(save_analysis()));
analyzeAction
= new QAction(tr
("Perform deck analysis"),
this);
QObject::connect(analyzeAction,
SIGNAL(triggered
()),
this,
SLOT(analyze_deck
()));
QObject::connect(exitAction,
SIGNAL(triggered
()),
qApp,
SLOT(quit
()));
}
void MainWindow::create_actions()
{
readAction = new QAction(tr("Read new deck"), this);
QObject::connect(readAction, SIGNAL(triggered()), this, SLOT(read_deck(const QString &fileName))); *** point of error
refreshAction = new QAction(tr("Reload current deck"), this);
QObject::connect(refreshAction, SIGNAL(triggered()), this, SLOT(refresh_deck()));
//saveAction = new QAction(tr("Save results to file"), this);
// QObject::connect(saveAction, SIGNAL(triggered()), this, SLOT(save_analysis()));
analyzeAction = new QAction(tr("Perform deck analysis"), this);
QObject::connect(analyzeAction, SIGNAL(triggered()), this, SLOT(analyze_deck()));
QObject::connect(exitAction,SIGNAL(triggered()), qApp, SLOT(quit()));
QObject::connect(btns_a[0], SIGNAL(QPushButton::clicked()), this, SLOT(m_b()));
QObject::connect(btns_a[1], SIGNAL(QPushButton::clicked()), this, SLOT(m_g()));
QObject::connect(btns_a[2], SIGNAL(QPushButton::clicked()), this, SLOT(b_m()));
QObject::connect(btns_a[3], SIGNAL(QPushButton::clicked()), this, SLOT(b_g()));
QObject::connect(btns_a[4], SIGNAL(QPushButton::clicked()), this, SLOT(g_m()));
QObject::connect(btns_a[5], SIGNAL(QPushButton::clicked()), this, SLOT(g_b()));
}
To copy to clipboard, switch view to plain text mode
void MainWindow
::read_deck(const QString &fileName
) {
list_sizes[0] = 0;
list_sizes[1] = 0;
list_sizes[2] = 0;
int monster_count = 0;
int spell_count = 0;
int trap_count = 0;
current_file = fileName;
std::string file = fileName.toStdString();
std::string current_card;
std::ifstream infile("file.txt");
int passed_main = 0;
std::string line;
while(std::getline(infile, line))
{
if(line == "#main")
{
passed_main++;
}
else if(line == "#extra")
{
passed_main++;
}
else if(passed_main == 1)
{
current_card = read_name(line);
current_card_q
= QString::fromUtf8(current_card.
c_str());
new_item->setText((current_card_q));
mn_lst->QListWidget::addItem(new_item);
list_sizes[0]++;
read_type(current_card);
}
}
}
void MainWindow::read_deck(const QString &fileName)
{
list_sizes[0] = 0;
list_sizes[1] = 0;
list_sizes[2] = 0;
int monster_count = 0;
int spell_count = 0;
int trap_count = 0;
current_file = fileName;
std::string file = fileName.toStdString();
std::string current_card;
QString current_card_q;
std::ifstream infile("file.txt");
int passed_main = 0;
std::string line;
while(std::getline(infile, line))
{
if(line == "#main")
{
passed_main++;
}
else if(line == "#extra")
{
passed_main++;
}
else if(passed_main == 1)
{
current_card = read_name(line);
current_card_q = QString::fromUtf8(current_card.c_str());
QListWidgetItem *new_item = new QListWidgetItem;
new_item->setText((current_card_q));
mn_lst->QListWidget::addItem(new_item);
list_sizes[0]++;
read_type(current_card);
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks