From d565e01870d1bd3f89e1f854e63af3abee5f5926 Mon Sep 17 00:00:00 2001 From: Matthieu Gicquel Date: Tue, 6 Oct 2009 19:53:04 +0200 Subject: better homepage with nav bar on top --- data/CMakeLists.txt | 2 +- data/category.png | Bin 0 -> 695 bytes data/home.html | 86 ++++++++++++++++++++++++++++++++++++++-------------- src/homepage.cpp | 52 +++++++++++++++++++++++-------- src/homepage.h | 2 +- 5 files changed, 105 insertions(+), 37 deletions(-) create mode 100644 data/category.png diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 9eb59933..34676cf0 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,5 +1,5 @@ INSTALL( - FILES bg.png bot.gif busywidget.gif closed.png loading.mng open.png tile.gif top.png webkit-icon.png + FILES bg.png bot.gif busywidget.gif closed.png loading.mng open.png tile.gif top.png webkit-icon.png category.png DESTINATION ${DATA_INSTALL_DIR}/rekonq/pics ) diff --git a/data/category.png b/data/category.png new file mode 100644 index 00000000..52df230d Binary files /dev/null and b/data/category.png differ diff --git a/data/home.html b/data/home.html index d709a1dc..c2953e40 100644 --- a/data/home.html +++ b/data/home.html @@ -9,17 +9,16 @@ /* ------------------------------------------------------- */ /* generic styles */ -html{ +html, body, div, h1, h2, h3, h4, a, p{ margin:0; padding:0; +border:0; } body{ background: url(%1/tile.gif) repeat-x #fff; -margin:0; -padding:0; font-family: sans-serif; -font-size: 100%; +font-size: 90%; text-align: center; } @@ -28,7 +27,8 @@ font: normal bold 2em sans-serif; text-align:right; color: #3F7AB7; margin-right:3%; -margin-bottom: 20px; +margin-top: 0.5%; +float:right; } h2{ @@ -37,6 +37,27 @@ color: #3F7AB7; margin-top: 2em; } +h3{ +background: url(%1/category.png) no-repeat; +padding: 0.2em; +margin-top: 1em; +margin-bottom: 0.5em; +padding-left: 0.4em; +} + +h4{ +font-size: 1em; +margin-top: 0.5em; +} + +a{ +color: #3F7AB7; +text-decoration: none; +} +a:hover{ +color: black; +} + /* ------------------------------------------------------- */ /* page sections */ @@ -45,47 +66,58 @@ width: 100%; } #navigation { -float: right; -width: 20%; -text-align:center; +margin-top: 1%; +text-align: center; } #content { -width: 80%; text-align: left; -margin: 20px; +margin: 2%; } -.link { -width:96%; -margin: 10px 0; -background-color:#3F7AB7; -} /* -------------------------------------------------------- */ /* div navigations styles */ -div.link a{ -color:#FFF; +.link{ +display: inline-block; +padding: 0 2%; +} + +.link img{ +float:left; +} + +.link a{ +color: black; text-decoration:none; font: normal bold 1.2em/2.5em sans-serif; +vertical-align: middle; } -div.link a:hover{ -color: #ff0; +#navigation .link:not(.current):not(.link:hover){ +-webkit-opacity: 0.3; } + /* -------------------------------------------------------- */ /* Thumbnail class */ .thumbnail { -background: url(%1/bg.png) no-repeat; text-align: center; float:left; -width:228px; -padding: 11px 0px 0px 0px; -margin: 10px 10px 10px 0; +width: 25%; +min-width: 235px; +margin-bottom: 3%; } +.thumbnail object{ +background: url(%1/bg.png) no-repeat; +text-align: center; +padding: 14px 16px; +-webkit-background-size: 100% 100%; +-webkit-background-clip: padding; +cursor: pointer; +} .thumbnail a { display: block; text-align: center; @@ -94,6 +126,14 @@ font-size: 0.8em; text-decoration:none; } +/* -------------------------------------------------------- */ +/* Bookmarks page*/ + +.bookfolder{ +margin-left: 2em; +margin-bottom: 0.5em; +} + /* -------------------------------------------------------- */ diff --git a/src/homepage.cpp b/src/homepage.cpp index 723e670c..bd0fb22b 100644 --- a/src/homepage.cpp +++ b/src/homepage.cpp @@ -72,7 +72,7 @@ QString HomePage::rekonqHomePage(const KUrl &url) } QString imagesPath = QString("file://") + KGlobal::dirs()->findResourceDir("data", "rekonq/pics/bg.png") + QString("rekonq/pics"); - QString menu = homePageMenu(); + QString menu = homePageMenu(url); QString speed; if(url == KUrl("rekonq:lastSites")) @@ -99,7 +99,7 @@ QString HomePage::fillFavorites() QStringList names = ReKonfig::previewNames(); QStringList urls = ReKonfig::previewUrls(); - QString speed = "

Favorites

"; + QString speed; for(int i=0; i<8; ++i) { QString text = names.at(i); @@ -124,7 +124,7 @@ QString HomePage::lastVisitedSites() { HistoryTreeModel *model = Application::historyManager()->historyTreeModel(); - QString last = "

Last Visited Sites

"; + QString last; int sites = 0; int i = 0; do @@ -160,13 +160,41 @@ QString HomePage::lastVisitedSites() } -QString HomePage::homePageMenu() +QString HomePage::homePageMenu(KUrl currentUrl) { QString menu = ""; - menu += "
Last Visited Sites
"; - menu += "
History
"; - menu += "
Bookmarks
"; - menu += "
Favorites
"; + + KIconLoader *loader = KIconLoader::global(); + + menu += "
"; + menu += "iconPath("edit-undo", KIconLoader::Desktop) + "\" />"; + menu += "Last Visited
"; + + menu += "
"; + menu += "iconPath("view-history", KIconLoader::Desktop) + "\" />"; + menu += "History
"; + + menu += "
"; + menu += "iconPath("bookmarks-organize", KIconLoader::Desktop) + "\" />"; + menu += "Bookmarks
"; + + menu += "
"; + menu += "iconPath("rating", KIconLoader::Desktop) + "\" />"; + menu += "Favorites
"; + + return menu; } @@ -175,7 +203,7 @@ QString HomePage::fillHistory() { HistoryTreeModel *model = Application::historyManager()->historyTreeModel(); - QString history = "

History

"; + QString history; int i = 0; do { @@ -210,7 +238,7 @@ QString HomePage::fillBookmarks() return QString("Error retrieving bookmarks!"); } - QString str = "

Bookmarks

"; + QString str; KBookmark bookmark = bookGroup.first(); while (!bookmark.isNull()) { @@ -228,8 +256,8 @@ QString HomePage::createBookItem(const KBookmark &bookmark) QString result = QString(""); KBookmarkGroup group = bookmark.toGroup(); KBookmark bm = group.first(); - result += "

" + bookmark.text() + "

"; - result += "

"; + result += "

" + bookmark.text() + "

"; + result += "

"; while (!bm.isNull()) { result += createBookItem(bm); diff --git a/src/homepage.h b/src/homepage.h index b1202cb0..73bb5859 100644 --- a/src/homepage.h +++ b/src/homepage.h @@ -48,7 +48,7 @@ public: ~HomePage(); QString rekonqHomePage(const KUrl &url = KUrl("rekonq:home")); - QString homePageMenu(); + QString homePageMenu(KUrl currentUrl); private: QString fillFavorites(); -- cgit v1.2.1