File indexing completed on 2024-07-21 04:35:17

0001 /*
0002     SPDX-FileCopyrightText: 2004 Ace Jones acejones @users.sourceforge.net
0003 
0004     This file is part of libalkimia.
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #include "alkquotereceiver.h"
0010 #include "alkonlinequote.h"
0011 
0012 #include <QtDebug>
0013 
0014 convertertest::AlkQuoteReceiver::AlkQuoteReceiver(AlkOnlineQuote *q, QObject *parent)
0015     : QObject(parent)
0016 {
0017     connect(q, SIGNAL(quote(QString,QString,QDate,double)),
0018             this, SLOT(slotGetQuote(QString,QString,QDate,double)));
0019     connect(q, SIGNAL(status(QString)),
0020             this, SLOT(slotStatus(QString)));
0021     connect(q, SIGNAL(error(QString)),
0022             this, SLOT(slotError(QString)));
0023 }
0024 
0025 convertertest::AlkQuoteReceiver::~AlkQuoteReceiver()
0026 {
0027 }
0028 
0029 void convertertest::AlkQuoteReceiver::slotGetQuote(const QString &a, const QString &b,
0030                                                    const QDate &d, const double &m)
0031 {
0032     if (m_verbose) {
0033         qDebug() << "test::AlkQuoteReceiver::slotGetQuote( , " << a << " , " << b << " , " << d
0034                  << " , " << m << " )";
0035     }
0036     m_price = AlkValue(m);
0037     m_date = d;
0038 }
0039 
0040 void convertertest::AlkQuoteReceiver::slotStatus(const QString &msg)
0041 {
0042     if (m_verbose) {
0043         qDebug() << "test::AlkQuoteReceiver::slotStatus( " << msg << " )";
0044     }
0045 
0046     m_statuses += msg;
0047 }
0048 
0049 void convertertest::AlkQuoteReceiver::slotError(const QString &msg)
0050 {
0051     if (m_verbose) {
0052         qDebug() << "test::AlkQuoteReceiver::slotError( " << msg << " )";
0053     }
0054 
0055     m_errors += msg;
0056 }