📄 launcher.cpp.bak
字号:
/****************************************************************************** $Id: qt/examples/launcher/launcher.cpp 2.3.8 edited 2004-08-05 $**** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.**** This file is part of an example program for Qt. This example** program may be used, distributed and modified without limitation.*******************************************************************************/#include <qapplication.h>#include <qvbox.h>#include <qpushbutton.h>#include <qradiobutton.h>#include <qcheckbox.h>#include <qlabel.h>#include <qimage.h>#include <qtimer.h>#include <qlistbox.h>#include <qgroupbox.h>#include <qvbuttongroup.h>#include <qwindowsystem_qws.h>#include <stdlib.h>#ifndef _OS_WIN32_#include <unistd.h>#endif#ifdef _OS_WIN32_void unsetenv( const char * ) {}void setenv( const char *, const char *, int ) {}#endif/* We should really have more specific #ifdef checks for some of these example, this rough partitioning is sufficient though for the sample qconfig-*.h files.*/struct { const char* label; const char* file;} command[] = {#ifndef QT_NO_TEXTBROWSER { "Help Text Browser", "(cd ../helpviewer; exec ../helpviewer/helpviewer)" },#endif#ifndef QT_NO_CANVAS { "Canvas - alpha-blending", "( cd ../canvas; exec ./canvas )" },#endif#ifndef QT_NO_WIDGETS { "Text Editor", "exec ../qwerty/qwerty ../qwerty/unicode.txt" },#endif#ifndef QT_NO_FILEDIALOG { "Scribble Editor", "exec ../scribble/scribble" },#endif#ifndef QT_NO_TRANSLATION { "Internationalization", "( cd ../i18n; exec ./i18n all )" },#endif#ifndef QT_NO_TRANSFORMATIONS { "Magnifier", "exec ../qmag/qmag" },#endif { 0, 0 }};struct { const char* label; const char* file;} other_command[] = {#ifndef QT_NO_TRANSFORMATIONS { "aclock", "( cd ../aclock; exec ./aclock; )" },#endif#if !defined(QT_NO_TABDIALOG) && !defined(QT_NO_FILEDIALOG) { "addressbook", "( cd ../addressbook; exec ./addressbook; )" },#endif#ifndef QT_NO_WIDGETS { "buttongroups", "( cd ../buttongroups; exec ./buttongroups; )" }, { "checklists", "( cd ../checklists; exec ./checklists; )" }, { "cursor", "( cd ../cursor; exec ./cursor; )" }, { "customlayout", "( cd ../customlayout; exec ./customlayout; )" }, { "dclock", "( cd ../dclock; exec ./dclock; )" },#endif#ifndef QT_NO_DRAGANDDROP { "dirview", "( cd ../dirview; exec ./dirview; )" },#endif //{ "drawdemo", "( cd ../drawdemo; exec ./drawdemo; )" }, { "drawlines", "( cd ../drawlines; exec ./drawlines; )" }, //{ "forever", "( cd ../forever; exec ./forever; )" }, { "hello", "( cd ../hello; exec ./hello; )" },#ifndef QT_NO_WIDGETS { "layout", "( cd ../layout; exec ./layout; )" }, { "life", "( cd ../life; exec ./life; )" }, { "lineedits", "( cd ../lineedits; exec ./lineedits; )" }, { "listbox", "( cd ../listbox; exec ./listbox; )" }, { "listboxcombo", "( cd ../listboxcombo; exec ./listboxcombo; )" },#endif#ifndef QT_NO_WORKSPACE { "mdi", "( cd ../mdi; exec ./mdi; )" },#endif#ifndef QT_NO_WIDGETS { "menu", "( cd ../menu; exec ./menu; )" },#endif#ifndef QT_NO_MOVIE { "movies", "( cd ../movies; exec ./movies; )" },#endif#ifndef QT_NO_WIDGETS //{ "picture", "( cd ../picture; exec ./picture; )" }, { "popup", "( cd ../popup; exec ./popup; )" },#endif#ifndef QT_NO_PROGRESSDIALOG { "progress", "( cd ../progress; exec ./progress; )" },#endif#ifndef QT_NO_WIDGETS { "progressbar", "( cd ../progressbar; exec ./progressbar; )" }, { "qfd", "( cd ../qfd; exec ./qfd; )" }, { "rangecontrols", "( cd ../rangecontrols; exec ./rangecontrols; )" }, { "richtext", "( cd ../richtext; exec ./richtext; )" }, { "scrollview", "( cd ../scrollview; exec ./scrollview; )" },#endif#ifndef QT_NO_FILEDIALOG { "showimg", "( cd ../showimg; exec ./showimg; )" },#endif#ifndef QT_NO_WIDGETS //{ "sound", "( cd ../sound; exec ./sounds; )" }, { "splitter", "( cd ../splitter; exec ./splitter; )" }, { "tabdialog", "( cd ../tabdialog; exec ./tabdialog; )" },#endif#ifndef QT_NO_TRANSFORMATIONS { "table", "( cd ../table; exec ./table; )" },#endif#ifndef QT_NO_WIDGETS { "tetrix", "( cd ../tetrix; exec ./tetrix; )" }, { "tictac", "( cd ../tictac; exec ./tictac; )" }, { "tooltip", "( cd ../tooltip; exec ./tooltip; )" }, { "validator", "( cd ../validator; exec ./validator; )" },#endif#if !defined(QT_NO_MOVIE) && !defined(QT_NO_TRANSFORMATIONS) // (etc.!) { "widgets", "( cd ../widgets; exec ./widgets; )" },#endif#ifndef QT_NO_WIZARD { "wizard", "( cd ../wizard; exec ./wizard; )" }, //{ "xform", "( cd ../xform; exec ./xform; )" },#endif { 0, 0 }};class Launcher : public QHBox { Q_OBJECTpublic: Launcher() : QHBox(0,0,WStyle_Tool | WStyle_Customize) { setSpacing(10); setMargin(10); QMimeSourceFactory::defaultFactory() ->setImage("qtlogo",QImage("qtlogo.png")); QMimeSourceFactory::defaultFactory() ->setImage("face",QImage("face.png")); QVBox* vb; vb = new QVBox(this); setStretchFactor(vb,1); QLabel* label = new QLabel( "<center><h1><img src=qtlogo><img src=face><br>" "Qt/Embedded</h1>" "</center>""This display is a simple Qt/Embedded launcher application, running directly\n""on the Linux console. The buttons and listbox\n""to the right invoke additional applications.<p><br><hr>" , vb); info = new QLabel(vb); info->setFont(QFont("smoothtimes",17)); info->setBackgroundColor(white); info->setAlignment(AlignTop); nextInfo(); QTimer* infotimer = new QTimer(this); connect(infotimer,SIGNAL(timeout()),this,SLOT(nextInfo())); infotimer->start(20000); setBackgroundColor(white); label->setBackgroundColor(white); vb = new QVBox(this); vb->setBackgroundColor(white); QPushButton *pb=0; int i; for (i=0; command[i].label; i++) { pb = new QPushButton(command[i].label,vb,command[i].file); connect(pb, SIGNAL(clicked()), this, SLOT(execute())); } QListBox *lb = new QListBox(vb); lb->setFont(QFont("smoothtimes",17)); for (i=0; other_command[i].label; i++) { lb->insertItem(other_command[i].label); } lb->setMaximumHeight(pb->height()*8); connect(lb, SIGNAL(highlighted(int)), this, SLOT(executeOther(int))); connect(lb, SIGNAL(selected(int)), this, SLOT(executeOther(int)));#if !defined(QT_NO_QWS_TRANSFORMED) QRadioButton *rb; QVButtonGroup *bg = new QVButtonGroup("Orientation", vb); connect( bg, SIGNAL(pressed(int)), this, SLOT(setRotation(int)) ); bg->setBackgroundColor(white); bg->setExclusive( TRUE ); rb = new QRadioButton( "No Rotation", bg ); rb->setBackgroundColor(white); bg->insert( rb ); rb = new QRadioButton( "Rotate 90deg", bg ); rb->setBackgroundColor(white); bg->insert( rb ); rb = new QRadioButton( "Rotate 180deg", bg ); rb->setBackgroundColor(white); bg->insert( rb ); rb = new QRadioButton( "Rotate 270deg", bg ); rb->setBackgroundColor(white); bg->insert( rb ); bg->setButton(0);#endif QHBox* hb = new QHBox(vb); hb->setBackgroundColor(white); pb = new QPushButton("Restart",hb); connect(pb, SIGNAL(clicked()), this, SLOT(quit3())); pb = new QPushButton("Quit",hb); connect(pb, SIGNAL(clicked()), qApp, SLOT(quit())); hb->setSpacing(10); hb->setFixedHeight(hb->sizeHint().height()); }private slots: void nextInfo() { static int i = 0; static const char* infotext[] = { "<h2>What is it?</h2>\n" "\n" "The Qt/Embedded product provides you with all you need to\n" "create stunning graphical user interfaces for embedded devices.\n" "Qt/Embedded installs and runs with a very small memory footprint on any\n" "device running embedded Linux - without using X11.\n", "\n" "<h2>Trust the promises</h2>\n" "\n" "Qt/Embedded features the same API as the excellent\n" "Qt/Windows and Qt/X11 versions. Imagine writing your Qt application in\n" "your favourite desktop environment and just recompiling to move it to\n" "your embedded device. It saves you heaps of development effort and\n" "allows you to work productively in your favorite programming\n" "environment from day one. You can start today.\n", "\n" "<h2>Less is more</h2>\n" "\n" "Qt/Embedded is modular and scalable. You can assemble the\n" "Qt features you really need and leave the others out. Since Qt/Embedded\n" "is not based on X11 it has substantially lower memory requirements than\n" "X11. By picking and choosing features, the memory demands of\n" "Qt/Embedded can be tuned from 1 Mb to 3 Mb in ROM (Intel x86).\n" "Furthermore,applications written with Qt are known to have a small\n" "memory footprint compared to applications written with other toolkits.\n" "Qt scales from the smallest embedded device to high-end workstations.\n", "\n" "<h2>The source will be with you</h2>\n" "\n" "You know the value of source code availability. All Qt\n" "releases are delivered with source code. Qt/Embedded is no exception.\n" "You get a better understanding of how Qt works and it helps you debug\n" "and tune your code. Customer feedback allows us to continually improve\n" "the source code for better usability and performance.\n", "\n" "<h2>Add your touch</h2>\n" "\n" "Qt's clean object oriented design makes it easy to extend and\n" "enhance the standard widgets. You can create specialized widgets for the\n" "limited space offered by embedded screen devices. You can benefit from the\n" "wealth of available third-party Qt software. It is easy to add the killer\n" "feature you need.\n", "\n"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -