danbooru-client/src/mainwindow.cpp
2013-12-24 09:33:06 +01:00

116 lines
3.7 KiB
C++

/***************************************************************************
* Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}> *
* *
* 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 2 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include "mainwindow.h"
#include "danbooruclientview.h"
#include "model/danboorupostmodel.h"
#include <KConfigDialog>
#include <KStatusBar>
#include <KAction>
#include <KActionCollection>
#include <KStandardAction>
#include <KLocale>
namespace Danbooru {
DanbooruMainWindow::DanbooruMainWindow()
: KXmlGuiWindow(),
m_view(new DanbooruClientView(this)),
m_service(0),
m_model(new(DanbooruPostModel(this)))
{
// tell the KXmlGuiWindow that this is indeed the main widget
setCentralWidget(m_view);
// then, setup our actions
setupActions();
// add a status bar
statusBar()->show();
// a call to KXmlGuiWindow::setupGUI() populates the GUI
// with actions, using KXMLGUI.
// It also applies the saved mainwindow settings, if any, and ask the
// mainwindow to automatically save settings if changed: window size,
// toolbar position, icon size, etc.
setupGUI();
}
DanbooruMainWindow::~DanbooruMainWindow()
{
}
void DanbooruMainWindow::setupActions()
{
KAction* connectAction = new KAction(
KIcon(QLatin1String("document-open-remote")),
i18n("Connect..."),
this);
KAction* fetchAction = new KAction(KIcon(QLatin1String("download")),
i18n("Download"), this);
connectAction->setShortcut(KStandardShortcut::open());
fetchAction->setShortcut(KStandardShortcut::find());
fetchAction->setEnabled(false);
actionCollection()->addAction(QLatin1String("connect"), connectAction);
actionCollection()->addAction(QLatin1String("fetch"), fetchAction);
// actionCollection()->removeAction(actionCollection()->action("help_contents"));
KStandardAction::quit(qApp, SLOT(close()), actionCollection());
connect(connectAction, SIGNAL(triggered(bool)), this,
SLOT(connectToBoard()));
connect(fetch, SIGNAL(triggered(bool)), this, SLOT(downloadPosts()));
}
void DanbooruMainWindow::connectToBoard()
{
if (!m_view) {
return;
}
}
void DanbooruMainWindow::downloadPosts()
{
if (!m_service) {
return;
}
}
void DanbooruMainWindow::optionsPreferences()
{
}
} // namespace Danbooru
#include "DanbooruMainWindow.moc"