From 54186e5dcbc84636abe205f8e25483d982433095 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 17 Jun 2015 01:43:01 +0200 Subject: [PATCH] Fix layout issues --- apps/Launcher/syncwidget.cpp | 39 +++++++++++++++++----- include/openspace/engine/downloadmanager.h | 3 -- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/apps/Launcher/syncwidget.cpp b/apps/Launcher/syncwidget.cpp index f02363257b..e2810681d4 100644 --- a/apps/Launcher/syncwidget.cpp +++ b/apps/Launcher/syncwidget.cpp @@ -97,13 +97,31 @@ SyncWidget::SyncWidget(QWidget* parent, Qt::WindowFlags f) } { - QWidget* downloadBox = new QGroupBox; - downloadBox->setMinimumSize(450, 1000); - _downloadLayout = new QVBoxLayout; - downloadBox->setLayout(_downloadLayout); - QScrollArea* area = new QScrollArea; - area->setWidget(downloadBox); + area->setWidgetResizable(true); + + QWidget* w = new QWidget; + area->setWidget(w); + + _downloadLayout = new QVBoxLayout(w); + _downloadLayout->addStretch(100); + + + + //QGroupBox* downloadBox = new QGroupBox; + + //QWidget* + + //_downloadLayout = new QVBoxLayout(area); + //area->setWidget(_downloadLayout) + + + + ////downloadBox->setMinimumSize(450, 1000); + //downloadBox->setLayout(_downloadLayout); + + //QScrollArea* area = new QScrollArea; + //area->setWidget(downloadBox); layout->addWidget(area); } @@ -191,7 +209,8 @@ void SyncWidget::handleDirectFiles() { ); if (future) { InfoWidget* w = new InfoWidget(f.destination); - _downloadLayout->addWidget(w); + _downloadLayout->insertWidget(_downloadLayout->count() - 1, w); + //_downloadLayout->addWidget(w); _futures.push_back(future); _futureInfoWidgetMap[future] = w; @@ -276,7 +295,8 @@ void SyncWidget::handleTorrentFiles() { libtorrent::size_type s = h.status().total_wanted; InfoWidget* w = new InfoWidget(f.file, h.status().total_wanted); - _downloadLayout->addWidget(w); + _downloadLayout->insertWidget(_downloadLayout->count() - 1, w); + //_downloadLayout->addWidget(w); _torrentInfoWidgetMap[h] = w; FileSys.setCurrentDirectory(d); @@ -505,7 +525,8 @@ void SyncWidget::handleTimer() { while (_mutex.test_and_set()) {} for (openspace::DownloadManager::FileFuture* f : _futuresToAdd) { InfoWidget* w = new InfoWidget(QString::fromStdString(f->filePath), -1); - _downloadLayout->addWidget(w); + _downloadLayout->insertWidget(_downloadLayout->count() - 1, w); + //_downloadLayout->addWidget(w); _futureInfoWidgetMap[f] = w; _futures.push_back(f); diff --git a/include/openspace/engine/downloadmanager.h b/include/openspace/engine/downloadmanager.h index 4e61136bd9..7aeb3f32ed 100644 --- a/include/openspace/engine/downloadmanager.h +++ b/include/openspace/engine/downloadmanager.h @@ -81,9 +81,6 @@ public: DownloadProgressCallback progressCallback = DownloadProgressCallback() ); - // TODO: Add async version of downloadRequestFiles that returns a filefuture - // that can be used to call an additional function - void downloadRequestFilesAsync( const std::string& identifier, const ghoul::filesystem::Directory& destination,