#include "mainwindow.h"

#include "bucketlist.h"

#include <QLabel>
#include <QBoxLayout>
#include <QtWebKit>
#include <QSettings>
#include <QInputDialog>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    QWidget *central = new QWidget;
    setCentralWidget(central);

    QBoxLayout *topLayout = new QHBoxLayout(central);

    BucketList *bucketList = new BucketList;
    topLayout->addWidget(bucketList);

    m_view = new QWebView;
    topLayout->addWidget(m_view);

    getServerPath();

    connect(&m_server, SIGNAL(started()), SLOT(loadView()));
    m_server.start();
}

MainWindow::~MainWindow()
{
    m_server.stop();
}

void MainWindow::getServerPath()
{
    QSettings settings;

    QString path = settings.value("view/path").toString();
    if (path.isEmpty()) {
        path = QInputDialog::getText(this, "View path", "Enter base path of view for web server");
    }
    settings.setValue("view/path", path);

    m_server.setPath(path);
}

void MainWindow::loadView()
{
    m_view->setUrl(QUrl("http://localhost:8765"));
    m_view->show();
}

#include "mainwindow.h"

#include "bucketlist.h"

#include <QLabel>
#include <QBoxLayout>
#include <QtWebKit>
#include <QSettings>
#include <QInputDialog>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    QWidget *central = new QWidget;
    setCentralWidget(central);

    QBoxLayout *topLayout = new QHBoxLayout(central);

    BucketList *bucketList = new BucketList;
    topLayout->addWidget(bucketList);

    m_view = new QWebView;
    topLayout->addWidget(m_view, 1);
    m_view->setMinimumSize(1000, 540);

    getServerPath();

    connect(&m_server, SIGNAL(started()), SLOT(loadView()));
    m_server.start();
}

MainWindow::~MainWindow()
{
    m_server.stop();
}

void MainWindow::getServerPath()
{
    QSettings settings;

    QString path = settings.value("view/path").toString();
    if (path.isEmpty()) {
        path = QInputDialog::getText(this, "View path", "Enter base path of view for web server");
    }
    settings.setValue("view/path", path);

    m_server.setPath(path);
}

void MainWindow::loadView()
{
    m_view->setUrl(QUrl("http://localhost:8765"));
    m_view->show();
}

Make widget always fit the view
Make widget always fit the view
