#include "taskswidget.h"
#include "ui_taskswidget.h"

TasksWidget::TasksWidget(InterfaceDataBaseLMS* dbLMS, QWidget *parent) :
    QWidget(parent),    
    ui(new Ui::TasksWidget),
    dbLMS(dbLMS)
{
    ui->setupUi(this);
}

TasksWidget::~TasksWidget()
{
    delete ui;
}

void TasksWidget::slot_traineeSelected(QString login)
{
    viewListTasksForTrainee(login);
}

void TasksWidget::slot_LanguageChanged(QString language)
{
    qtLanguageTranslator.load(QString(QStringLiteral("translations/InstructorsAndTrainees_")) + language, QStringLiteral("."));
    qApp->installTranslator(&qtLanguageTranslator);
}

void TasksWidget::viewListTasksForTrainee(QString login)
{
    /*
    QList<QString> listTasks;
    QStringList strListTasks;

    listTasks = pDbTrainees->getTasks(login);

    ui->listWidgetTasks->clear();
    ui->listWidgetTasks->addItems(listTasks);
    */
}

void TasksWidget::changeEvent(QEvent *event)
{
    // В случае получения события изменения языка приложения
    if (event->type() == QEvent::LanguageChange)
    {
        ui->retranslateUi(this);    // переведём окно заново
    }
}
