Added initial stuff for web browsing.
This commit is contained in:
parent
1dbd947bc1
commit
73dd31e285
@ -167,6 +167,8 @@ set(APP_SOURCES
|
|||||||
src/gui/shortcutcatcher.cpp
|
src/gui/shortcutcatcher.cpp
|
||||||
src/gui/shortcutbutton.cpp
|
src/gui/shortcutbutton.cpp
|
||||||
src/gui/dynamicshortcutswidget.cpp
|
src/gui/dynamicshortcutswidget.cpp
|
||||||
|
src/gui/webbrowser.cpp
|
||||||
|
src/gui/basewebview.cpp
|
||||||
|
|
||||||
# CORE sources.
|
# CORE sources.
|
||||||
src/core/debugging.cpp
|
src/core/debugging.cpp
|
||||||
@ -199,6 +201,8 @@ set(APP_HEADERS
|
|||||||
src/gui/shortcutcatcher.h
|
src/gui/shortcutcatcher.h
|
||||||
src/gui/shortcutbutton.h
|
src/gui/shortcutbutton.h
|
||||||
src/gui/dynamicshortcutswidget.h
|
src/gui/dynamicshortcutswidget.h
|
||||||
|
src/gui/webbrowser.h
|
||||||
|
src/gui/basewebview.h
|
||||||
|
|
||||||
# CORE headers.
|
# CORE headers.
|
||||||
src/core/basenetworkaccessmanager.h
|
src/core/basenetworkaccessmanager.h
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
|
#include <QNetworkProxy>
|
||||||
|
|
||||||
|
#include "core/settings.h"
|
||||||
|
#include "core/defs.h"
|
||||||
#include "core/basenetworkaccessmanager.h"
|
#include "core/basenetworkaccessmanager.h"
|
||||||
|
|
||||||
|
|
||||||
BaseNetworkAccessManager::BaseNetworkAccessManager(QObject *parent)
|
BaseNetworkAccessManager::BaseNetworkAccessManager(QObject *parent)
|
||||||
: QNetworkAccessManager(parent) {
|
: QNetworkAccessManager(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseNetworkAccessManager::loadSettings() {
|
||||||
|
QNetworkProxy new_proxy;
|
||||||
|
// TODO: Continue here.
|
||||||
|
}
|
||||||
|
@ -12,7 +12,7 @@ class BaseNetworkAccessManager : public QNetworkAccessManager {
|
|||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void loadSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BASENETWORKACCESSMANAGER_H
|
#endif // BASENETWORKACCESSMANAGER_H
|
||||||
|
5
src/gui/basewebview.cpp
Normal file
5
src/gui/basewebview.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "gui/basewebview.h"
|
||||||
|
|
||||||
|
|
||||||
|
BaseWebView::BaseWebView(QWidget *parent) : QWebView(parent) {
|
||||||
|
}
|
18
src/gui/basewebview.h
Normal file
18
src/gui/basewebview.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef BASEWEBVIEW_H
|
||||||
|
#define BASEWEBVIEW_H
|
||||||
|
|
||||||
|
#include <QWebView>
|
||||||
|
|
||||||
|
|
||||||
|
class BaseWebView : public QWebView {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit BaseWebView(QWidget *parent = 0);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BASEWEBVIEW_H
|
@ -1,5 +1,7 @@
|
|||||||
#include <QFormLayout>
|
#include <QGridLayout>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QSpacerItem>
|
||||||
|
|
||||||
#include "gui/dynamicshortcutswidget.h"
|
#include "gui/dynamicshortcutswidget.h"
|
||||||
#include "gui/shortcutcatcher.h"
|
#include "gui/shortcutcatcher.h"
|
||||||
@ -7,7 +9,7 @@
|
|||||||
|
|
||||||
DynamicShortcutsWidget::DynamicShortcutsWidget(QWidget *parent) : QWidget(parent) {
|
DynamicShortcutsWidget::DynamicShortcutsWidget(QWidget *parent) : QWidget(parent) {
|
||||||
// Create layout for this control and set is as active.
|
// Create layout for this control and set is as active.
|
||||||
m_layout = new QFormLayout(this);
|
m_layout = new QGridLayout(this);
|
||||||
m_layout->setMargin(0);
|
m_layout->setMargin(0);
|
||||||
|
|
||||||
setLayout(m_layout);
|
setLayout(m_layout);
|
||||||
@ -26,6 +28,10 @@ void DynamicShortcutsWidget::updateShortcuts() {
|
|||||||
void DynamicShortcutsWidget::populate(const QList<QAction *> actions) {
|
void DynamicShortcutsWidget::populate(const QList<QAction *> actions) {
|
||||||
m_actionBindings.clear();
|
m_actionBindings.clear();
|
||||||
|
|
||||||
|
// TODO: Make labels smaller correctly and review this method.
|
||||||
|
int row_id = 0;
|
||||||
|
bool second_column = false;
|
||||||
|
|
||||||
foreach (QAction *action, actions) {
|
foreach (QAction *action, actions) {
|
||||||
// Create shortcut catcher for this action and set default shortcut.
|
// Create shortcut catcher for this action and set default shortcut.
|
||||||
ShortcutCatcher *catcher = new ShortcutCatcher(this);
|
ShortcutCatcher *catcher = new ShortcutCatcher(this);
|
||||||
@ -40,6 +46,25 @@ void DynamicShortcutsWidget::populate(const QList<QAction *> actions) {
|
|||||||
m_actionBindings << new_binding;
|
m_actionBindings << new_binding;
|
||||||
|
|
||||||
// Add new catcher to our control.
|
// Add new catcher to our control.
|
||||||
m_layout->addRow(action->text(), catcher);
|
QLabel *label = new QLabel(this);
|
||||||
|
label->setText(action->text().remove('&'));
|
||||||
|
label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||||
|
|
||||||
|
if (second_column) {
|
||||||
|
m_layout->addWidget(label, row_id, 2);
|
||||||
|
m_layout->addWidget(catcher, row_id, 3);
|
||||||
|
second_column = false;
|
||||||
|
|
||||||
|
// Continue to the next row.
|
||||||
|
row_id++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_layout->addWidget(label, row_id, 0);
|
||||||
|
m_layout->addWidget(catcher, row_id, 1);
|
||||||
|
second_column = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure that "spacer" is added.
|
||||||
|
m_layout->setRowStretch(row_id, 1);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
||||||
class QFormLayout;
|
class QGridLayout;
|
||||||
class ShortcutCatcher;
|
class ShortcutCatcher;
|
||||||
|
|
||||||
typedef QPair<QAction*, ShortcutCatcher*> ActionBinding;
|
typedef QPair<QAction*, ShortcutCatcher*> ActionBinding;
|
||||||
@ -29,7 +29,7 @@ class DynamicShortcutsWidget : public QWidget {
|
|||||||
void populate(const QList<QAction*> actions);
|
void populate(const QList<QAction*> actions);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QFormLayout *m_layout;
|
QGridLayout *m_layout;
|
||||||
QList<ActionBinding> m_actionBindings;
|
QList<ActionBinding> m_actionBindings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14,198 +14,66 @@
|
|||||||
<string>MainWindow</string>
|
<string>MainWindow</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<widget class="QToolButton" name="toolButton">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="geometry">
|
<item>
|
||||||
<rect>
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<x>40</x>
|
<property name="currentIndex">
|
||||||
<y>20</y>
|
<number>0</number>
|
||||||
<width>61</width>
|
</property>
|
||||||
<height>51</height>
|
<widget class="QWidget" name="tab">
|
||||||
</rect>
|
<attribute name="title">
|
||||||
</property>
|
<string>Tab 1</string>
|
||||||
<property name="text">
|
</attribute>
|
||||||
<string>...</string>
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
</property>
|
<property name="leftMargin">
|
||||||
<property name="icon">
|
<number>0</number>
|
||||||
<iconset theme="application-exit">
|
</property>
|
||||||
<normaloff/>
|
<property name="topMargin">
|
||||||
</iconset>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="rightMargin">
|
||||||
<size>
|
<number>0</number>
|
||||||
<width>32</width>
|
</property>
|
||||||
<height>32</height>
|
<property name="bottomMargin">
|
||||||
</size>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_2">
|
<widget class="QWidget" name="widget" native="true"/>
|
||||||
<property name="geometry">
|
</item>
|
||||||
<rect>
|
</layout>
|
||||||
<x>140</x>
|
</widget>
|
||||||
<y>120</y>
|
<widget class="QWidget" name="tab_2">
|
||||||
<width>61</width>
|
<attribute name="title">
|
||||||
<height>51</height>
|
<string>Tab 2</string>
|
||||||
</rect>
|
</attribute>
|
||||||
</property>
|
<widget class="QToolButton" name="toolButton">
|
||||||
<property name="text">
|
<property name="geometry">
|
||||||
<string>...</string>
|
<rect>
|
||||||
</property>
|
<x>140</x>
|
||||||
<property name="icon">
|
<y>110</y>
|
||||||
<iconset theme="application-exit">
|
<width>61</width>
|
||||||
<normaloff/>
|
<height>51</height>
|
||||||
</iconset>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="text">
|
||||||
<size>
|
<string>...</string>
|
||||||
<width>20</width>
|
</property>
|
||||||
<height>20</height>
|
<property name="icon">
|
||||||
</size>
|
<iconset theme="application-exit">
|
||||||
</property>
|
<normaloff/>
|
||||||
</widget>
|
</iconset>
|
||||||
<widget class="QToolButton" name="toolButton_3">
|
</property>
|
||||||
<property name="geometry">
|
<property name="iconSize">
|
||||||
<rect>
|
<size>
|
||||||
<x>170</x>
|
<width>32</width>
|
||||||
<y>30</y>
|
<height>32</height>
|
||||||
<width>61</width>
|
</size>
|
||||||
<height>51</height>
|
</property>
|
||||||
</rect>
|
</widget>
|
||||||
</property>
|
</widget>
|
||||||
<property name="text">
|
</widget>
|
||||||
<string>...</string>
|
</item>
|
||||||
</property>
|
</layout>
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="application-exit">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolButton" name="toolButton_4">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>40</x>
|
|
||||||
<y>200</y>
|
|
||||||
<width>171</width>
|
|
||||||
<height>141</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="application-exit">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>48</width>
|
|
||||||
<height>48</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolButton" name="toolButton_5">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>400</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>61</width>
|
|
||||||
<height>51</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="application-exit">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>64</width>
|
|
||||||
<height>64</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolButton" name="toolButton_6">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>250</x>
|
|
||||||
<y>190</y>
|
|
||||||
<width>231</width>
|
|
||||||
<height>161</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="application-exit">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>96</width>
|
|
||||||
<height>96</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolButton" name="toolButton_7">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>520</x>
|
|
||||||
<y>160</y>
|
|
||||||
<width>161</width>
|
|
||||||
<height>151</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="application-exit">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>128</width>
|
|
||||||
<height>128</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolButton" name="toolButton_8">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>540</x>
|
|
||||||
<y>60</y>
|
|
||||||
<width>61</width>
|
|
||||||
<height>51</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="application-exit">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="m_menuBar">
|
<widget class="QMenuBar" name="m_menuBar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
5
src/gui/webbrowser.cpp
Normal file
5
src/gui/webbrowser.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "gui/webbrowser.h"
|
||||||
|
|
||||||
|
|
||||||
|
WebBrowser::WebBrowser(QWidget *parent) : QWidget(parent) {
|
||||||
|
}
|
18
src/gui/webbrowser.h
Normal file
18
src/gui/webbrowser.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef FORMBROWSER_H
|
||||||
|
#define FORMBROWSER_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
||||||
|
class WebBrowser : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit WebBrowser(QWidget *parent = 0);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FORMBROWSER_H
|
Loading…
x
Reference in New Issue
Block a user