Initial implementation of main window + view widget
This commit is contained in:
parent
c1bde86980
commit
1d09d12345
5 changed files with 217 additions and 184 deletions
|
@ -17,44 +17,73 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
||||
***************************************************************************/
|
||||
|
||||
#include "danbooru_clientview.h"
|
||||
#include "settings.h"
|
||||
#include "danbooruclientview.h"
|
||||
|
||||
#include <KLocale>
|
||||
#include <QtGui/QLabel>
|
||||
// Own
|
||||
|
||||
danbooru_clientView::danbooru_clientView(QWidget *)
|
||||
{
|
||||
ui_danbooru_clientview_base.setupUi(this);
|
||||
settingsChanged();
|
||||
setAutoFillBackground(true);
|
||||
}
|
||||
#include "model/danboorupostmodel.h"
|
||||
#include "model/danboorupostdelegate.h"
|
||||
|
||||
danbooru_clientView::~danbooru_clientView()
|
||||
{
|
||||
// Qt
|
||||
|
||||
}
|
||||
#include <QTimer>
|
||||
|
||||
void danbooru_clientView::switchColors()
|
||||
{
|
||||
// switch the foreground/background colors of the label
|
||||
QColor color = Settings::col_background();
|
||||
Settings::setCol_background( Settings::col_foreground() );
|
||||
Settings::setCol_foreground( color );
|
||||
// KDE
|
||||
|
||||
settingsChanged();
|
||||
}
|
||||
#include <KRun>
|
||||
#include <KFileDialog>
|
||||
|
||||
void danbooru_clientView::settingsChanged()
|
||||
{
|
||||
QPalette pal;
|
||||
pal.setColor( QPalette::Window, Settings::col_background());
|
||||
pal.setColor( QPalette::WindowText, Settings::col_foreground());
|
||||
ui_danbooru_clientview_base.kcfg_sillyLabel->setPalette( pal );
|
||||
namespace Danbooru {
|
||||
|
||||
// i18n : internationalization
|
||||
ui_danbooru_clientview_base.kcfg_sillyLabel->setText( i18n("This project is %1 days old",Settings::val_time()) );
|
||||
emit signalChangeStatusbar( i18n("Settings changed") );
|
||||
}
|
||||
DanbooruClientView::DanbooruClientView(QWidget * parent): QWidget(parent),
|
||||
m_model(new DanbooruPostModel(this)),
|
||||
m_delegate(0),
|
||||
m_service(0),
|
||||
m_timer(0)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
#include "danbooru_clientview.moc"
|
||||
m_delegate = new DanbooruPostDelegate(m_listView);
|
||||
|
||||
m_listView->setFlow(QListView::LeftToRight);
|
||||
m_listView->setResizeMode(QListView::Adjust);
|
||||
m_listView->setWrapping(true);
|
||||
m_listView->setViewMode(QListView::IconMode);
|
||||
m_listView->setGridSize(QSize(256,256));
|
||||
|
||||
m_listView->setModel(m_model);
|
||||
m_listView->setItemDelegate(m_delegate);
|
||||
|
||||
// signal-slot connections
|
||||
|
||||
connect(m_delegate, SIGNAL(postDownloadRequested(KUrl)), this,
|
||||
SLOT(slotHandleDownload(KUrl)));
|
||||
connect(m_delegate, SIGNAL(postViewRequested(KUrl)), this,
|
||||
SLOT(slotHandleView(KUrl)));
|
||||
// connect(m_listView, SIGNAL(clicked(const QModelIndex&)), parent(),
|
||||
// SLOT(displayInfo(const QModelIndex&));
|
||||
|
||||
|
||||
}
|
||||
|
||||
DanbooruClientView::~DanbooruClientView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DanbooruClientView::slotHandleDownload(KUrl url)
|
||||
{
|
||||
// TODO
|
||||
Q_UNUSED(url)
|
||||
}
|
||||
|
||||
void DanbooruClientView::slotHandleView(KUrl url)
|
||||
{
|
||||
KRun* runViewer = new KRun(url, this /*window*/, 0 /*mode*/,
|
||||
false /*isLocalFile*/,
|
||||
true /*showProgressInfo*/, "" /*asn*/);
|
||||
runViewer->setAutoDelete(true);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Danbooru
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue