Skip to content

Instantly share code, notes, and snippets.

@PureSingh
Last active December 21, 2015 01:48
Show Gist options
  • Save PureSingh/6229981 to your computer and use it in GitHub Desktop.
Save PureSingh/6229981 to your computer and use it in GitHub Desktop.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring-updates/Release.gpg Connection failed [IP: 91.189.91.13 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring-security/Release.gpg Connection failed [IP: 91.189.92.156 80]
W: Failed to fetch http://ppa.launchpad.net/librecad-dev/librecad-daily/ubuntu/dists/raring/Release.gpg Connection failed
W: Failed to fetch http://ppa.launchpad.net/u-szeged/sedkit/ubuntu/dists/raring/Release.gpg Connection failed
W: Failed to fetch cdrom://Ubuntu 13.04 _Raring Ringtail_ - Release amd64 (20130424)/dists/raring/main/binary-amd64/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
W: Failed to fetch cdrom://Ubuntu 13.04 _Raring Ringtail_ - Release amd64 (20130424)/dists/raring/restricted/binary-amd64/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
W: Failed to fetch cdrom://Ubuntu 13.04 _Raring Ringtail_ - Release amd64 (20130424)/dists/raring/main/binary-i386/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
W: Failed to fetch cdrom://Ubuntu 13.04 _Raring Ringtail_ - Release amd64 (20130424)/dists/raring/restricted/binary-i386/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/raring/universe/i18n/Translation-en_IN Connection failed [IP: 91.189.92.176 80]
W: Failed to fetch http://ppa.launchpad.net/u-szeged/sedkit/ubuntu/dists/raring/main/source/Sources 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/u-szeged/sedkit/ubuntu/dists/raring/main/binary-amd64/Packages 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/u-szeged/sedkit/ubuntu/dists/raring/main/binary-i386/Packages 404 Not Found
errors while updating
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WText>
#include <Wt/WImage>
#include <Wt/WMenu>
#include <Wt/WStackedWidget>
#include <Wt/WVideo>
#include <Wt/WBreak>
#include <Wt/WTabWidget>
#include <Wt/WLineEdit>
#include <Wt/WMessageBox>
#include <Wt/WNavigationBar>
#include <Wt/WPopupMenu>
#include <Wt/WPopupMenuItem>
using namespace Wt;
class webpage : public WApplication
{
public:
webpage(const WEnvironment &env);
private:
};
webpage::webpage(const WEnvironment& env)
: WApplication(env)
{
Wt::WContainerWidget *container = new Wt::WContainerWidget();
// Create a navigation bar with a link to a web page.
Wt::WNavigationBar *navigation = new Wt::WNavigationBar(container);
navigation->setTitle("Corpy Inc.",
"http://www.google.com/search?q=corpy+inc");
navigation->setResponsive(true);
Wt::WStackedWidget *contentsStack = new Wt::WStackedWidget(container);
contentsStack->addStyleClass("contents");
// Setup a Left-aligned menu.
Wt::WMenu *leftMenu = new Wt::WMenu(contentsStack, container);
navigation->addMenu(leftMenu);
Wt::WText *searchResult = new Wt::WText("Buy or Sell... Bye!");
leftMenu->addItem("Home", new Wt::WText("There is no better place!"));
leftMenu->addItem("Layout", new Wt::WText("Layout contents"))
->setLink(Wt::WLink(Wt::WLink::InternalPath, "/layout"));
leftMenu->addItem("Sales", searchResult);
// Setup a Right-aligned menu.
Wt::WMenu *rightMenu = new Wt::WMenu();
navigation->addMenu(rightMenu, Wt::AlignRight);
// Create a popup submenu for the Help menu.
Wt::WPopupMenu *popup = new Wt::WPopupMenu();
popup->addItem("Contents");
popup->addItem("Index");
popup->addSeparator();
popup->addItem("About");
popup->itemSelected().connect(std::bind([=] (Wt::WMenuItem *item) {
Wt::WMessageBox *messageBox = new Wt::WMessageBox
("Help",
Wt::WString::fromUTF8("<p>Showing Help: {1}</p>").arg(item->text()),
Wt::Information, Wt::Ok);
messageBox->buttonClicked().connect(std::bind([=] () {
delete messageBox;
}));
messageBox->show();
}, std::placeholders::_1));
Wt::WMenuItem *item = new Wt::WMenuItem("Help");
item->setMenu(popup);
rightMenu->addItem(item);
// Add a Search control.
Wt::WLineEdit *edit = new Wt::WLineEdit();
edit->setEmptyText("Enter a search item");
edit->enterPressed().connect(std::bind([=] () {
leftMenu->select(2); // is the index of the "Sales"
searchResult->setText(Wt::WString("Nothing found for {1}.")
.arg(edit->text()));
}));
navigation->addSearch(edit, Wt::AlignRight);
container->addWidget(contentsStack);
}
Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
return new webpage(env);
}
int main(int argc, char **argv)
{
return Wt::WRun(argc, argv, &createApplication);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment