Commit a3dd810b authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Fix several memory leaks

parent 1a18decb
......@@ -25,6 +25,7 @@ Collection::Collection(QUrl *url, QObject* parent)
Collection::~Collection()
{
qDeleteAll(m_allTestEntries);
}
KEduVocDocument *Collection::eduVocDocument()
......
......@@ -145,9 +145,9 @@ void CollectionWidget::setupWidget(WordCount *dueWords)
m_thumbnail = new QLabel(this);
m_thumbnail->setFixedSize(COLLWIDTH - 10, COLLHEIGHT1 - COLLHEIGHT2 + 10);
QPixmap *pixmap = new QPixmap(m_thumbnail->size());
pixmap->fill(Qt::lightGray);
m_thumbnail->setPixmap(*pixmap);
QPixmap pixmap(m_thumbnail->size());
pixmap.fill(Qt::lightGray);
m_thumbnail->setPixmap(pixmap);
int percentageCompleted = dueWords->percentageCompleted();
if (percentageCompleted != 100) {
......
......@@ -47,44 +47,43 @@ Dashboard::Dashboard(ParleyMainWindow *parent)
m_widget->setKeepAspectRatio(Qt::IgnoreAspectRatio);
m_widget->setFadingEnabled(false);
m_ui = new Ui::Dashboard();
m_ui->setupUi(m_widget);
m_ui.setupUi(m_widget);
setCentralWidget(m_widget);
QFont font = m_ui->recentLabel->font();
QFont font = m_ui.recentLabel->font();
font.setBold(true);
m_ui->recentLabel->setFont(font);
font = m_ui->completedLabel->font();
m_ui.recentLabel->setFont(font);
font = m_ui.completedLabel->font();
font.setBold(true);
m_ui->completedLabel->setFont(font);
m_ui.completedLabel->setFont(font);
m_ui->newButton->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
m_ui->openButton->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
m_ui->ghnsButton->setIcon(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")));
m_ui.newButton->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
m_ui.openButton->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
m_ui.ghnsButton->setIcon(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")));
GradeReferenceWidget *gradeReferenceWidget = new GradeReferenceWidget();
gradeReferenceWidget->setMinimumSize(m_widget->width(), 50);
m_ui->gridLayout->addWidget(gradeReferenceWidget, 1, 0, 1, ROWSIZE, Qt::AlignCenter);
m_ui.gridLayout->addWidget(gradeReferenceWidget, 1, 0, 1, ROWSIZE, Qt::AlignCenter);
m_subGridLayout = new QGridLayout();
m_subGridLayout->setHorizontalSpacing(50);
m_subGridLayout->setVerticalSpacing(30);
m_ui->gridLayout_2->addLayout(m_subGridLayout, 2, 0, 1, 1);
m_ui.gridLayout_2->addLayout(m_subGridLayout, 2, 0, 1, 1);
m_completedGridLayout = new QGridLayout();
m_completedGridLayout->setHorizontalSpacing(50);
m_completedGridLayout->setVerticalSpacing(30);
m_ui->gridLayout_2->addLayout(m_completedGridLayout, 6, 0, 1, 1);
m_ui.gridLayout_2->addLayout(m_completedGridLayout, 6, 0, 1, 1);
populateMap();
populateGrid();
// Signals from the main buttons.
ParleyDocument* doc = m_mainWindow->parleyDocument();
connect(m_ui->newButton, &QAbstractButton::clicked, m_mainWindow, &ParleyMainWindow::slotFileNew);
connect(m_ui->openButton, &QAbstractButton::clicked, doc, &ParleyDocument::slotFileOpen);
connect(m_ui->ghnsButton, &QAbstractButton::clicked, doc, &ParleyDocument::slotGHNS);
connect(m_ui.newButton, &QAbstractButton::clicked, m_mainWindow, &ParleyMainWindow::slotFileNew);
connect(m_ui.openButton, &QAbstractButton::clicked, doc, &ParleyDocument::slotFileOpen);
connect(m_ui.ghnsButton, &QAbstractButton::clicked, doc, &ParleyDocument::slotGHNS);
KConfigGroup cfg(KSharedConfig::openConfig(QStringLiteral("parleyrc")), objectName());
applyMainWindowSettings(cfg);
......@@ -237,14 +236,14 @@ void Dashboard::populateGrid()
m_subGridLayout->addItem(new QSpacerItem(50,1,QSizePolicy::Expanding, QSizePolicy::Fixed),
m_subGridLayout->rowCount() - 1, m_subGridLayout->columnCount());
if (k - kc) {
m_ui->recentLabel->setText(i18n("Active Collections"));
m_ui.recentLabel->setText(i18n("Active Collections"));
} else {
m_ui->recentLabel->clear();
m_ui.recentLabel->clear();
}
if (kc) {
m_ui->completedLabel->setText(i18n("Completed Collections"));
m_ui.completedLabel->setText(i18n("Completed Collections"));
} else {
m_ui->completedLabel->clear();
m_ui.completedLabel->clear();
}
}
......
......@@ -56,7 +56,7 @@ private slots:
void updateBackground();
private:
Ui::Dashboard *m_ui;
Ui::Dashboard m_ui;
ParleyMainWindow *m_mainWindow;
StatisticsMainWindow *m_statisticsWidget;
Practice::ThemedBackgroundRenderer *m_themedBackgroundRenderer;
......
......@@ -478,6 +478,7 @@ void EditorWindow::startSearch()
void EditorWindow::slotShowScriptManager()
{
ScriptDialog * dialog = new ScriptDialog(m_scriptManager);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
......
......@@ -66,6 +66,7 @@ GuiFrontend::GuiFrontend(QWidget *parent)
GuiFrontend::~GuiFrontend()
{
delete m_widget;
delete m_ui;
}
QVariant GuiFrontend::userInput()
......
......@@ -20,7 +20,8 @@
using namespace Editor;
ScriptManager::ScriptManager(EditorWindow * editor)
: m_editor(editor)
: QObject(editor)
, m_editor(editor)
{
//add Scripting::Parley
m_scriptingParley = new Scripting::Parley(editor);
......@@ -30,6 +31,7 @@ ScriptManager::ScriptManager(EditorWindow * editor)
ScriptManager::~ScriptManager()
{
m_scriptingParley->deleteLater();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment