Added initial stuff for web browsing.

This commit is contained in:
Martin Rotter 2013-07-08 20:58:24 +02:00
parent 1dbd947bc1
commit 73dd31e285
10 changed files with 150 additions and 198 deletions

View File

@ -167,6 +167,8 @@ set(APP_SOURCES
src/gui/shortcutcatcher.cpp
src/gui/shortcutbutton.cpp
src/gui/dynamicshortcutswidget.cpp
src/gui/webbrowser.cpp
src/gui/basewebview.cpp
# CORE sources.
src/core/debugging.cpp
@ -199,6 +201,8 @@ set(APP_HEADERS
src/gui/shortcutcatcher.h
src/gui/shortcutbutton.h
src/gui/dynamicshortcutswidget.h
src/gui/webbrowser.h
src/gui/basewebview.h
# CORE headers.
src/core/basenetworkaccessmanager.h

View File

@ -1,6 +1,15 @@
#include <QNetworkProxy>
#include "core/settings.h"
#include "core/defs.h"
#include "core/basenetworkaccessmanager.h"
BaseNetworkAccessManager::BaseNetworkAccessManager(QObject *parent)
: QNetworkAccessManager(parent) {
}
void BaseNetworkAccessManager::loadSettings() {
QNetworkProxy new_proxy;
// TODO: Continue here.
}

View File

@ -12,7 +12,7 @@ class BaseNetworkAccessManager : public QNetworkAccessManager {
signals:
public slots:
void loadSettings();
};
#endif // BASENETWORKACCESSMANAGER_H

5
src/gui/basewebview.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "gui/basewebview.h"
BaseWebView::BaseWebView(QWidget *parent) : QWebView(parent) {
}

18
src/gui/basewebview.h Normal file
View 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

View File

@ -1,5 +1,7 @@
#include <QFormLayout>
#include <QGridLayout>
#include <QAction>
#include <QLabel>
#include <QSpacerItem>
#include "gui/dynamicshortcutswidget.h"
#include "gui/shortcutcatcher.h"
@ -7,7 +9,7 @@
DynamicShortcutsWidget::DynamicShortcutsWidget(QWidget *parent) : QWidget(parent) {
// Create layout for this control and set is as active.
m_layout = new QFormLayout(this);
m_layout = new QGridLayout(this);
m_layout->setMargin(0);
setLayout(m_layout);
@ -26,6 +28,10 @@ void DynamicShortcutsWidget::updateShortcuts() {
void DynamicShortcutsWidget::populate(const QList<QAction *> actions) {
m_actionBindings.clear();
// TODO: Make labels smaller correctly and review this method.
int row_id = 0;
bool second_column = false;
foreach (QAction *action, actions) {
// Create shortcut catcher for this action and set default shortcut.
ShortcutCatcher *catcher = new ShortcutCatcher(this);
@ -40,6 +46,25 @@ void DynamicShortcutsWidget::populate(const QList<QAction *> actions) {
m_actionBindings << new_binding;
// 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);
}

View File

@ -4,7 +4,7 @@
#include <QWidget>
class QFormLayout;
class QGridLayout;
class ShortcutCatcher;
typedef QPair<QAction*, ShortcutCatcher*> ActionBinding;
@ -29,7 +29,7 @@ class DynamicShortcutsWidget : public QWidget {
void populate(const QList<QAction*> actions);
private:
QFormLayout *m_layout;
QGridLayout *m_layout;
QList<ActionBinding> m_actionBindings;
};

View File

@ -14,198 +14,66 @@
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QToolButton" name="toolButton">
<property name="geometry">
<rect>
<x>40</x>
<y>20</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 class="QToolButton" name="toolButton_2">
<property name="geometry">
<rect>
<x>140</x>
<y>120</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>20</width>
<height>20</height>
</size>
</property>
</widget>
<widget class="QToolButton" name="toolButton_3">
<property name="geometry">
<rect>
<x>170</x>
<y>30</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>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>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Tab 1</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="widget" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Tab 2</string>
</attribute>
<widget class="QToolButton" name="toolButton">
<property name="geometry">
<rect>
<x>140</x>
<y>110</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>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="m_menuBar">
<property name="geometry">

5
src/gui/webbrowser.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "gui/webbrowser.h"
WebBrowser::WebBrowser(QWidget *parent) : QWidget(parent) {
}

18
src/gui/webbrowser.h Normal file
View 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