From 32afa2c28aabe862bfca44dba24083ffd7db6721 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 20 Aug 2016 18:29:52 +0200 Subject: Added configration dialog Database connection options are now configurable. Hopefully it doesn't end up in an infinite loop if the credentials are not corrent... --- torrentwidget.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'torrentwidget.cpp') diff --git a/torrentwidget.cpp b/torrentwidget.cpp index f184324..656870e 100644 --- a/torrentwidget.cpp +++ b/torrentwidget.cpp @@ -28,15 +28,6 @@ #include "torrentdisplay.h" TorrentWidget::TorrentWidget(QWidget *parent) : QWidget(parent), mExt("*.torrent") { - QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL", "shemovdb"); - db.setHostName("hadante.d-tor.org"); - db.setUserName("shemov"); - db.setPassword("shemov"); - db.setDatabaseName("shemov2"); - if(!db.open()){ - QMessageBox::critical(0, tr("Error"), tr("Could not open database!")); - } - setupGui(); gatherData(); } @@ -97,6 +88,9 @@ void TorrentWidget::setupGui(){ void TorrentWidget::gatherData(){ QSqlDatabase db = QSqlDatabase::database("shemovdb"); + if(!db.isOpen()){ + db.open(); + } QSqlQuery q(db); q.prepare("SELECT COUNT(*) FROM metadata WHERE tsubject = :fn"); QDir d(mDir->text()); -- cgit v1.2.3-70-g09d2