aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--smolbote.qbs20
-rw-r--r--src/browser.cpp7
-rw-r--r--src/browser.h6
-rw-r--r--src/forms/bookmarkswidget.cpp29
-rw-r--r--src/forms/bookmarkswidget.h16
-rw-r--r--src/forms/downloaddialog.ui134
-rw-r--r--src/forms/downloadsform.ui81
-rw-r--r--src/forms/downloadswidget.cpp (renamed from src/forms/downloaddialog.cpp)20
-rw-r--r--src/forms/downloadswidget.h (renamed from src/forms/downloaddialog.h)8
-rw-r--r--src/mainwindow.cpp23
-rw-r--r--src/mainwindow.h2
-rw-r--r--src/widgets/dockingwidget.cpp82
-rw-r--r--src/widgets/dockingwidget.h55
-rw-r--r--src/widgets/downloaditemform.ui (renamed from src/webengine/downloaditemform.ui)0
-rw-r--r--src/widgets/downloaditemwidget.cpp (renamed from src/webengine/downloaditemform.cpp)16
-rw-r--r--src/widgets/downloaditemwidget.h (renamed from src/webengine/downloaditemform.h)6
16 files changed, 291 insertions, 214 deletions
diff --git a/smolbote.qbs b/smolbote.qbs
index 46af2d5..7e7c61b 100644
--- a/smolbote.qbs
+++ b/smolbote.qbs
@@ -87,6 +87,18 @@ Project {
]
}
+ Group {
+ name: "downloads"
+ files: [
+ "src/forms/downloadsform.ui",
+ "src/forms/downloadswidget.cpp",
+ "src/forms/downloadswidget.h",
+ "src/widgets/downloaditemform.ui",
+ "src/widgets/downloaditemwidget.cpp",
+ "src/widgets/downloaditemwidget.h",
+ ]
+ }
+
files: [
"data/resources.qrc",
"src/blocker/blockermanager.cpp",
@@ -99,23 +111,19 @@ Project {
"src/blocker/regexp.h",
"src/blocker/subscriptiondialog.ui",
"src/blocker/subscriptionform.ui",
- "src/forms/downloaddialog.cpp",
- "src/forms/downloaddialog.h",
- "src/forms/downloaddialog.ui",
"src/forms/profiledialog.cpp",
"src/forms/profiledialog.h",
"src/forms/profiledialog.ui",
"src/settings.cpp",
"src/settings.h",
- "src/webengine/downloaditemform.cpp",
- "src/webengine/downloaditemform.h",
- "src/webengine/downloaditemform.ui",
"src/webengine/urlinterceptor.cpp",
"src/webengine/urlinterceptor.h",
"src/webengine/webengineprofile.cpp",
"src/webengine/webengineprofile.h",
"src/webengine/webview.cpp",
"src/webengine/webview.h",
+ "src/widgets/dockingwidget.cpp",
+ "src/widgets/dockingwidget.h",
"src/widgets/loadingbar.cpp",
"src/widgets/loadingbar.h",
"src/widgets/urllineedit.cpp",
diff --git a/src/browser.cpp b/src/browser.cpp
index f96a881..0135a4c 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -100,7 +100,7 @@ bool Browser::preLaunch(QStringList urls)
m_networkAccessManager = new QNetworkAccessManager();
m_bookmarksManager = new BookmarksWidget;
- m_downloadManager = new DownloadDialog;
+ m_downloadManager = new DownloadsWidget;
QtWebEngine::initialize();
@@ -127,7 +127,7 @@ BookmarksWidget *Browser::bookmarks()
return m_bookmarksManager;
}
-DownloadDialog *Browser::downloads()
+DownloadsWidget *Browser::downloads()
{
return m_downloadManager;
}
@@ -150,8 +150,7 @@ void Browser::setConfigPath(const QString &path)
#ifdef Q_OS_LINUX
else if(QFile::exists("/usr/share/smolbote/poi.conf")) {
m_settings = new Settings("/usr/share/smolbote/poi.conf");
- }
- else if(QFile::exists("/usr/local/share/smolbote/poi.conf")) {
+ } else if(QFile::exists("/usr/local/share/smolbote/poi.conf")) {
m_settings = new Settings("/usr/local/share/smolbote/poi.conf");
}
#endif
diff --git a/src/browser.h b/src/browser.h
index 41a55f3..9d75036 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -24,7 +24,7 @@
#include <QApplication>
#include <QVector>
#include "forms/bookmarkswidget.h"
-#include "forms/downloaddialog.h"
+#include "forms/downloadswidget.h"
#include <QLocalServer>
#include "settings.h"
#include <QNetworkAccessManager>
@@ -55,7 +55,7 @@ public:
Settings *settings();
QNetworkAccessManager *network();
BookmarksWidget *bookmarks();
- DownloadDialog *downloads();
+ DownloadsWidget *downloads();
void setConfigPath(const QString &path);
void addWindow(MainWindow* window);
@@ -73,7 +73,7 @@ private:
QVector<MainWindow*> m_windows;
QNetworkAccessManager *m_networkAccessManager;
BookmarksWidget *m_bookmarksManager;
- DownloadDialog *m_downloadManager;
+ DownloadsWidget *m_downloadManager;
};
diff --git a/src/forms/bookmarkswidget.cpp b/src/forms/bookmarkswidget.cpp
index ee945cb..63062a2 100644
--- a/src/forms/bookmarkswidget.cpp
+++ b/src/forms/bookmarkswidget.cpp
@@ -23,19 +23,8 @@
#include "browser.h"
#include <QTreeWidget>
-DockWidget::DockWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags) :
- QDockWidget(title, parent, flags)
-{
-}
-
-void DockWidget::closeEvent(QCloseEvent *event)
-{
- setParent(0);
- event->ignore();
-}
-
BookmarksWidget::BookmarksWidget(QWidget *parent) :
- QWidget(parent),
+ DockingWidget(tr("Bookmarks"), parent),
ui(new Ui::BookmarksDialog)
{
// make sure this dialog does not get deleted on close
@@ -44,11 +33,6 @@ BookmarksWidget::BookmarksWidget(QWidget *parent) :
ui->setupUi(this);
ui->treeWidget->header()->setSectionResizeMode(QHeaderView::Stretch);
- window = nullptr;
- dock = new DockWidget(tr("Bookmarks"), 0);
- dock->setWidget(this);
- dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
-
QStyle *style = ui->treeWidget->style();
ui->addFolder_toolButton->setIcon(style->standardPixmap(QStyle::SP_DirIcon));
ui->addBookmark_toolButton->setIcon(style->standardPixmap(QStyle::SP_FileIcon));
@@ -91,17 +75,8 @@ void BookmarksWidget::show()
{
// show() gets called by a QAction in MainWindow
window = qobject_cast<MainWindow *>(sender()->parent());
- if(window) {
-
- // dockable widgets
- dock->setParent(window);
- window->addDockWidget(Qt::RightDockWidgetArea, dock);
-
- } else {
- qWarning("BookmarksWidget not called by MainWindow");
- }
- QWidget::show();
+ DockingWidget::show();
}
void BookmarksWidget::deleteCurrentItem()
diff --git a/src/forms/bookmarkswidget.h b/src/forms/bookmarkswidget.h
index ca0889b..19c49e5 100644
--- a/src/forms/bookmarkswidget.h
+++ b/src/forms/bookmarkswidget.h
@@ -21,27 +21,16 @@
#ifndef BOOKMARKSDIALOG_H
#define BOOKMARKSDIALOG_H
-#include <QWidget>
+#include "widgets/dockingwidget.h"
#include <QDockWidget>
#include "xbel.h"
#include "mainwindow.h"
-class DockWidget : public QDockWidget
-{
- Q_OBJECT
-
-public:
- explicit DockWidget(const QString &title, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
-
-protected:
- void closeEvent(QCloseEvent *event);
-};
-
namespace Ui {
class BookmarksDialog;
}
-class BookmarksWidget : public QWidget
+class BookmarksWidget : public DockingWidget
{
Q_OBJECT
@@ -65,7 +54,6 @@ private slots:
private:
MainWindow *window;
- DockWidget *dock;
Ui::BookmarksDialog *ui;
Xbel *xbel;
};
diff --git a/src/forms/downloaddialog.ui b/src/forms/downloaddialog.ui
deleted file mode 100644
index 2e21106..0000000
--- a/src/forms/downloaddialog.ui
+++ /dev/null
@@ -1,134 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>DownloadDialog</class>
- <widget class="QDialog" name="DownloadDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>820</width>
- <height>480</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Downloads</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QListWidget" name="listWidget"/>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="minimumSize">
- <size>
- <width>250</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>250</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="title">
- <string>Details</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="mimeType">
- <property name="text">
- <string>Type</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="mimeType_label">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="filePath">
- <property name="text">
- <string>Path</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="fileSize">
- <property name="text">
- <string>Size</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="fileSize_label">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="filePath_label">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Close</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>DownloadDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>DownloadDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/src/forms/downloadsform.ui b/src/forms/downloadsform.ui
new file mode 100644
index 0000000..5ab770f
--- /dev/null
+++ b/src/forms/downloadsform.ui
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DownloadDialog</class>
+ <widget class="QWidget" name="DownloadDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>420</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>420</width>
+ <height>600</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Downloads</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QListWidget" name="listWidget"/>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Details</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="mimeType">
+ <property name="text">
+ <string>Type</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="mimeType_label">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="filePath">
+ <property name="text">
+ <string>Path</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="fileSize">
+ <property name="text">
+ <string>Size</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="fileSize_label">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="filePath_label">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/forms/downloaddialog.cpp b/src/forms/downloadswidget.cpp
index d182076..45c458d 100644
--- a/src/forms/downloaddialog.cpp
+++ b/src/forms/downloadswidget.cpp
@@ -18,19 +18,19 @@
**
******************************************************************************/
-#include "downloaddialog.h"
-#include "ui_downloaddialog.h"
+#include "downloadswidget.h"
+#include "ui_downloadsform.h"
#include <QWebEngineDownloadItem>
#include <QUrl>
#include <QFileDialog>
#include <QListWidget>
#include <QLabel>
-#include "webengine/downloaditemform.h"
+#include "widgets/downloaditemwidget.h"
#include "browser.h"
-DownloadDialog::DownloadDialog(QWidget *parent) :
- QDialog(parent),
+DownloadsWidget::DownloadsWidget(QWidget *parent) :
+ DockingWidget(tr("Downloads"), parent),
ui(new Ui::DownloadDialog)
{
ui->setupUi(this);
@@ -39,12 +39,12 @@ DownloadDialog::DownloadDialog(QWidget *parent) :
connect(ui->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(showItemDetails(int)));
}
-DownloadDialog::~DownloadDialog()
+DownloadsWidget::~DownloadsWidget()
{
delete ui;
}
-void DownloadDialog::addDownload(QWebEngineDownloadItem *item)
+void DownloadsWidget::addDownload(QWebEngineDownloadItem *item)
{
QString filepath = QFileDialog::getSaveFileName(this, tr("Save"), sSettings->value("downloads.path").toString() + "/" + QFileInfo(item->path()).fileName());
@@ -60,7 +60,7 @@ void DownloadDialog::addDownload(QWebEngineDownloadItem *item)
int rowIndex = ui->listWidget->count();
ui->listWidget->insertItem(rowIndex, listItem);
- DownloadItemForm *form = new DownloadItemForm(item, this);
+ DownloadItemWidget *form = new DownloadItemWidget(item, this);
listItem->setSizeHint(form->size());
ui->listWidget->setItemWidget(listItem, form);
@@ -68,9 +68,9 @@ void DownloadDialog::addDownload(QWebEngineDownloadItem *item)
this->show();
}
-void DownloadDialog::showItemDetails(int index)
+void DownloadsWidget::showItemDetails(int index)
{
- DownloadItemForm *form = qobject_cast<DownloadItemForm *>(ui->listWidget->itemWidget(ui->listWidget->item(index)));
+ DownloadItemWidget *form = qobject_cast<DownloadItemWidget *>(ui->listWidget->itemWidget(ui->listWidget->item(index)));
ui->mimeType_label->setText(form->item()->mimeType());
ui->filePath_label->setText(form->item()->path());
ui->fileSize_label->setText(QString("%1 bytes").arg(form->item()->totalBytes()));
diff --git a/src/forms/downloaddialog.h b/src/forms/downloadswidget.h
index 9a74cf0..1ae29ee 100644
--- a/src/forms/downloaddialog.h
+++ b/src/forms/downloadswidget.h
@@ -21,20 +21,20 @@
#ifndef DOWNLOADDIALOG_H
#define DOWNLOADDIALOG_H
-#include <QDialog>
+#include "widgets/dockingwidget.h"
namespace Ui {
class DownloadDialog;
}
class QWebEngineDownloadItem;
-class DownloadDialog : public QDialog
+class DownloadsWidget : public DockingWidget
{
Q_OBJECT
public:
- explicit DownloadDialog(QWidget *parent = 0);
- ~DownloadDialog();
+ explicit DownloadsWidget(QWidget *parent = 0);
+ ~DownloadsWidget();
public slots:
void addDownload(QWebEngineDownloadItem *item);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 5cf9590..eaf061e 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -41,6 +41,9 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) :
{
// set up UI
ui->setupUi(this);
+ setDockOptions(dockOptions() | AllowTabbedDocks | ForceTabbedDocks);
+ setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);
+ setTabPosition(Qt::RightDockWidgetArea, QTabWidget::North);
QMenuBar *menuBar = new QMenuBar(this);
menuBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
@@ -59,6 +62,7 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) :
QMenu *toolsMenu = new QMenu(tr("Tools"), menuBar);
menuBar->addMenu(toolsMenu);
QAction *downloadsAction = toolsMenu->addAction(tr("Downloads"), Browser::instance()->downloads(), SLOT(show()));
+ downloadsAction->setParent(this);
downloadsAction->setShortcut(QKeySequence::fromString(sSettings->value("downloads.dialogShortcut").toString()));
QAction *bookmarksAction = toolsMenu->addAction(tr("Bookmarks"), Browser::instance()->bookmarks(), SLOT(show()));
bookmarksAction->setParent(this);
@@ -125,10 +129,27 @@ MainWindow::MainWindow(const QStringList urlList, QWidget *parent) :
MainWindow::~MainWindow()
{
- qApp->bookmarks()->setParent(0);
delete ui;
}
+void MainWindow::addTabbedDock(Qt::DockWidgetArea area, QDockWidget *widget)
+{
+ QList<QDockWidget*> allDockWidgets = findChildren<QDockWidget*>();
+ QVector<QDockWidget*> areaDockWidgets;
+ for(QDockWidget *w : allDockWidgets) {
+ if(dockWidgetArea(w) == area) {
+ areaDockWidgets.append(w);
+ }
+ }
+
+ if(areaDockWidgets.empty()) {
+ // no other widgets
+ addDockWidget(area, widget);
+ } else {
+ tabifyDockWidget(areaDockWidgets.last(), widget);
+ }
+}
+
void MainWindow::addNewTab(const QUrl &url)
{
if(!url.isEmpty()) {
diff --git a/src/mainwindow.h b/src/mainwindow.h
index da2b429..c032d5a 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -46,6 +46,8 @@ public:
MainWindow(const QStringList urlList, QWidget *parent = 0);
~MainWindow();
+ void addTabbedDock(Qt::DockWidgetArea area, QDockWidget *widget);
+
void loadProfile(const QString &name);
public slots:
diff --git a/src/widgets/dockingwidget.cpp b/src/widgets/dockingwidget.cpp
new file mode 100644
index 0000000..d7f7d30
--- /dev/null
+++ b/src/widgets/dockingwidget.cpp
@@ -0,0 +1,82 @@
+/** LICENSE ********************************************************************
+ **
+ ** smolbote: yet another qute browser
+ ** Copyright (C) 2017 Xian Nox
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **
+ ******************************************************************************/
+
+#include "dockingwidget.h"
+#include "mainwindow.h"
+
+#include <QApplication>
+
+DockWidget::DockWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags) :
+ QDockWidget(title, parent, flags)
+{
+}
+
+void DockWidget::closeEvent(QCloseEvent *event)
+{
+ setParent(0);
+ event->ignore();
+}
+
+DockingWidget::DockingWidget(const QString &title, QWidget *parent) :
+ QWidget(parent)
+{
+ window = nullptr;
+ dock = new DockWidget(title, 0);
+ dock->setWidget(this);
+ dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+
+ connect(qApp, &QApplication::aboutToQuit, [this]() {
+ this->setParent(0);
+ });
+}
+
+DockingWidget::~DockingWidget()
+{
+ // If the dock has a parent, it will take care of it
+ // calling delete later here if the dock has a parent causes a crash
+ if(!dock->parent()) {
+ dock->deleteLater();
+ }
+}
+
+void DockingWidget::show()
+{
+ MainWindow *caller = qobject_cast<MainWindow *>(sender()->parent());
+ // if already shown and on the same window - hide the widget
+ if(isVisible() && window == caller) {
+ dock->setParent(0);
+ return;
+ }
+
+ // show() gets called by a QAction in MainWindow
+ window = caller;
+ if(window) {
+
+ // dockable widgets
+ dock->setParent(window);
+ //window->addDockWidget(Qt::RightDockWidgetArea, dock);
+ window->addTabbedDock(Qt::RightDockWidgetArea, dock);
+
+ } else {
+ qWarning("DockingWidget not called by MainWindow");
+ }
+
+ QWidget::show();
+}
diff --git a/src/widgets/dockingwidget.h b/src/widgets/dockingwidget.h
new file mode 100644
index 0000000..bd1d210
--- /dev/null
+++ b/src/widgets/dockingwidget.h
@@ -0,0 +1,55 @@
+/** LICENSE ********************************************************************
+ **
+ ** smolbote: yet another qute browser
+ ** Copyright (C) 2017 Xian Nox
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **
+ ******************************************************************************/
+
+#ifndef DOCKINGWIDGET_H
+#define DOCKINGWIDGET_H
+
+#include <QWidget>
+#include <QDockWidget>
+
+// Subclass DockWidget to disable QDockWidget from committing sudoku when closing
+class DockWidget : public QDockWidget
+{
+ Q_OBJECT
+
+public:
+ explicit DockWidget(const QString &title, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
+
+protected:
+ void closeEvent(QCloseEvent *event);
+};
+
+class MainWindow;
+class DockingWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit DockingWidget(const QString &title, QWidget *parent = 0);
+ ~DockingWidget();
+
+public slots:
+ void show();
+
+private:
+ MainWindow *window;
+ DockWidget *dock;
+};
+
+#endif // DOCKINGWIDGET_H
diff --git a/src/webengine/downloaditemform.ui b/src/widgets/downloaditemform.ui
index 8a8d148..8a8d148 100644
--- a/src/webengine/downloaditemform.ui
+++ b/src/widgets/downloaditemform.ui
diff --git a/src/webengine/downloaditemform.cpp b/src/widgets/downloaditemwidget.cpp
index 61d954d..78b8a7c 100644
--- a/src/webengine/downloaditemform.cpp
+++ b/src/widgets/downloaditemwidget.cpp
@@ -18,13 +18,13 @@
**
******************************************************************************/
-#include "downloaditemform.h"
+#include "downloaditemwidget.h"
#include "ui_downloaditemform.h"
#include <QUrl>
#include <QLabel>
-DownloadItemForm::DownloadItemForm(QWebEngineDownloadItem *item, QWidget *parent) :
+DownloadItemWidget::DownloadItemWidget(QWebEngineDownloadItem *item, QWidget *parent) :
QWidget(parent),
ui(new Ui::DownloadItemForm)
{
@@ -38,17 +38,17 @@ DownloadItemForm::DownloadItemForm(QWebEngineDownloadItem *item, QWidget *parent
connect(item, SIGNAL(finished()), this, SLOT(updateFinished()));
}
-DownloadItemForm::~DownloadItemForm()
+DownloadItemWidget::~DownloadItemWidget()
{
delete ui;
}
-QWebEngineDownloadItem *DownloadItemForm::item() const
+QWebEngineDownloadItem *DownloadItemWidget::item() const
{
return m_item;
}
-QString DownloadItemForm::sizeString(int size) const
+QString DownloadItemWidget::sizeString(int size) const
{
if(size < 1024) {
return QString("%1 bytes").arg(size);
@@ -65,7 +65,7 @@ QString DownloadItemForm::sizeString(int size) const
return QString("%1 GB").arg(size / (1024 * 1024 * 1024));
}
-void DownloadItemForm::updateState(QWebEngineDownloadItem::DownloadState state)
+void DownloadItemWidget::updateState(QWebEngineDownloadItem::DownloadState state)
{
switch (state) {
case QWebEngineDownloadItem::DownloadRequested:
@@ -88,14 +88,14 @@ void DownloadItemForm::updateState(QWebEngineDownloadItem::DownloadState state)
}
}
-void DownloadItemForm::updateProgress(qint64 value, qint64 total)
+void DownloadItemWidget::updateProgress(qint64 value, qint64 total)
{
ui->progressBar->setMaximum(total);
ui->progressBar->setValue(value);
ui->filesize_label->setText(QString("%1 / %2").arg(sizeString(value)).arg(sizeString(total)));
}
-void DownloadItemForm::updateFinished()
+void DownloadItemWidget::updateFinished()
{
ui->progressBar->setMaximum(100);
ui->progressBar->setValue(100);
diff --git a/src/webengine/downloaditemform.h b/src/widgets/downloaditemwidget.h
index b4cb0e5..a27f9a8 100644
--- a/src/webengine/downloaditemform.h
+++ b/src/widgets/downloaditemwidget.h
@@ -28,13 +28,13 @@ namespace Ui {
class DownloadItemForm;
}
-class DownloadItemForm : public QWidget
+class DownloadItemWidget : public QWidget
{
Q_OBJECT
public:
- explicit DownloadItemForm(QWebEngineDownloadItem *item, QWidget *parent = 0);
- ~DownloadItemForm();
+ explicit DownloadItemWidget(QWebEngineDownloadItem *item, QWidget *parent = 0);
+ ~DownloadItemWidget();
QWebEngineDownloadItem *item() const;
QString sizeString(int size) const;