MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { setCaption(tr("IRC Client")); m_tabWidget = new IRCTabWidget(this); QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*))); setCentralWidget(m_tabWidget); setToolBarsMovable(FALSE); QMenuBar *menuBar = new QMenuBar(this); QPopupMenu *irc = new QPopupMenu(this); menuBar->insertItem(tr("IRC"), irc); QAction *a = new QAction( tr("New connection"), Opie::Core::OResource::loadPixmap( "pass", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect(a, SIGNAL(activated()), this, SLOT(newConnection())); a->setWhatsThis(tr("Create a new connection to an IRC server")); a->addTo(irc); a = new QAction( tr("Settings"), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); connect(a, SIGNAL(activated()), this, SLOT(settings())); a->addTo(irc); m_dccTab = 0; loadSettings(); }
ZLQtApplicationWindow::ZLQtApplicationWindow(ZLApplication *application) : ZLDesktopApplicationWindow(application), myFullScreen(false), myWasMaximized(false), myCursorIsHyperlink(false) { QIconFactory::installDefaultFactory(new MyIconFactory()); const std::string iconFileName = ZLibrary::ImageDirectory() + ZLibrary::FileNameDelimiter + ZLibrary::ApplicationName() + ".png"; QPixmap icon(iconFileName.c_str()); setIcon(icon); setWFlags(getWFlags() | WStyle_Customize); myToolBar = new QToolBar(this); myToolBar->setFocusPolicy(NoFocus); myToolBar->boxLayout()->setMargin(5); myToolBar->boxLayout()->setSpacing(3); setToolBarsMovable(false); resize(myWidthOption.value(), myHeightOption.value()); move(myXOption.value(), myYOption.value()); qApp->setMainWidget(this); menuBar()->hide(); show(); }
Help::Help( const QString& home, MainWindow* parent, const char *name ) #if defined(HAVE_KDE) : KMainWindow( 0, name, WType_TopLevel | WDestructiveClose | WGroupLeader ), #else : QMainWindow( 0, name, WType_TopLevel | WDestructiveClose | WGroupLeader ), #endif mainWindow( parent ), helpDialog( 0 ) { bookmarkMenu = 0; browser = new TextBrowser( this ); browser->mimeSourceFactory()->setFilePath( home ); browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); browser->mimeSourceFactory()->addFilePath( QString( getenv( "QTDIR" ) ) + "/tools/designer/manual" ); browser->mimeSourceFactory()->addFilePath( QString( getenv( "QTDIR" ) ) + "/doc/html/designer" ); browser->mimeSourceFactory()->addFilePath( parent->documentationPath() ); connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); setCentralWidget( browser ); #if defined(HAVE_KDE) toolbar = new KToolBar( this ); #else toolbar = new QToolBar( this ); #endif addToolBar( toolbar, tr( "Tools" ) ); setupFileActions(); setupGoActions(); setupBookmarkMenu(); resize( 750,700 ); setToolBarsMovable( FALSE ); }
FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name, WFlags fl) : QMainWindow( parent, name, fl ) { // random seed srand(time(0)); setCaption( tr("Fifteen Pieces") ); QToolBar *toolbar = new QToolBar(this); toolbar->setHorizontalStretchable( FALSE ); QMenuBar *menubar = new QMenuBar( toolbar ); menubar->setMargin(0); QPopupMenu *game = new QPopupMenu( this ); menubar->insertItem( tr( "Game" ), game ); QWidget *spacer = new QWidget( toolbar ); spacer->setBackgroundMode( PaletteButton ); toolbar->setStretchableWidget( spacer ); setToolBarsMovable( FALSE ); QVBox *vbox = new QVBox( this ); PiecesTable *table = new PiecesTable( vbox ); setCentralWidget(vbox); QAction *a = new QAction( tr( "Randomize" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) ); a->addTo( game ); a->addTo( toolbar ); a = new QAction( tr("Configure"), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated()), table, SLOT( slotConfigure()) ); a->addTo( game ); }
KMJobViewer::KMJobViewer(QWidget *parent, const char *name) : KMainWindow(parent,name) { m_view = 0; m_pop = 0; m_jobs.setAutoDelete(false); m_items.setAutoDelete(false); m_printers.setAutoDelete(false); m_type = KMJobManager::ActiveJobs; m_stickybox = 0; m_standalone = ( parent == NULL ); setToolBarsMovable(false); init(); if (m_standalone) { setCaption(i18n("No Printer")); KConfig *conf = KMFactory::self()->printConfig(); QSize defSize( 550, 250 ); conf->setGroup( "Jobs" ); resize( conf->readSizeEntry( "Size", &defSize ) ); } }
MyWidgetView( QWidget *parent=0, const char *name=0 ) :WidgetView(parent, name), s(0) { setToolBarsMovable( TRUE ); }
void ReadMail::init() { setToolBarsMovable(FALSE); QPopupMenu* mailaction=new QPopupMenu(this); bar = new QToolBar(this); bar->setHorizontalStretchable( TRUE ); menu = new QMenuBar( bar ); viewMenu = new QPopupMenu(menu); menu->insertItem( tr( "&View" ), viewMenu); mailMenu = new QPopupMenu(menu); menu->insertItem( tr( "&Mail" ), mailMenu); bar = new QToolBar(this); downloadButton = new QAction( tr( "Download" ), Resource::loadPixmap( "mailit/download" ),QString::null, 0, this, 0 ); connect(downloadButton, SIGNAL(activated()), this, SLOT(download()) ); downloadButton->setWhatsThis(tr("Click here to download the selected mail")); previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); previousButton->addTo(bar); previousButton->addTo(viewMenu); previousButton->setWhatsThis(tr("Read the previous mail in the list")); nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) ); nextButton->addTo(bar); nextButton->addTo(viewMenu); previousButton->setWhatsThis(tr("Read the next mail in the list")); attachmentButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "mailit/attach" ), QString::null, 0, this, 0 ); connect( attachmentButton, SIGNAL( activated() ), this, SLOT( viewAttachments() ) ); attachmentButton->addTo(bar); attachmentButton->addTo(viewMenu); attachmentButton->setWhatsThis(tr("Click here to add attachments to your mail")); plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "DocsIcon" ), QString::null, 0, this, 0, TRUE); connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); plainTextButton->addTo(bar); plainTextButton->addTo(viewMenu); plainTextButton->setWhatsThis(tr("The mail view has 2 modes:\n" "<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>" "<LI><B>Plain</B> shows the mail as standard plain text</LI>" "Click here to switch between those view modes" )); //reply dependant on viewing inbox replyButton = new QToolButton(Resource::loadPixmap("mailit/reply"),tr("reply"),tr("reply to mail"), this,SLOT(reply()),bar); QWhatsThis::add(replyButton,tr("Click here to reply to the selected mail\nPress and hold for more options.")); replyButton->setPopup(mailaction); replyAllButton = new QAction( tr( "Reply all" ), Resource::loadPixmap( "mailit/reply" ),QString::null, 0, this, 0 ); connect(replyAllButton, SIGNAL(activated()), this, SLOT(replyAll())); replyAllButton->setWhatsThis(tr("Click here to reply to the selected mail to CC: addresses also")); replyAllButton->addTo(mailaction); forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), QString::null, 0, this, 0 ); connect(forwardButton, SIGNAL(activated()), this, SLOT(forward())); forwardButton->setWhatsThis(tr("Click here to forward the selected mail")); forwardButton->addTo(mailaction); deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); deleteButton->addTo(bar); deleteButton->addTo(mailMenu); deleteButton->setWhatsThis(tr("Click here to remove the selected mail")); viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); emailView = new QTextView( this, "emailView" ); setCentralWidget(emailView); mime = new QMimeSourceFactory(); emailView->setMimeSourceFactory(mime); }
App::App(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { showFullScreen = false; setCaption("IQNotes"); toolbar = new QPEToolBar(this); toolbar->setVerticalStretchable(false); toolbar->setHorizontalStretchable(false); setToolBarsMovable(false); multiTB = new QToolButton(toolbar); // File menu filePopupMenu = new QPopupMenu(this); menu = new QPEMenuBar(this); int fileID; fileID = menu->insertItem("File", filePopupMenu); #ifndef DEMO newID = filePopupMenu->insertItem("New", this, SLOT(newFile()), SHIFT+Key_N); openID = filePopupMenu->insertItem("Open", this, SLOT(openFile()), SHIFT+Key_O); saveID = filePopupMenu->insertItem("Save", this, SLOT(saveFile()), SHIFT+Key_S); // file->insertItem("Save as", this, SLOT(saveAsFile())); closeID = filePopupMenu->insertItem("Close", this, SLOT(closeFileMenu())); filePopupMenu->insertSeparator(); #endif filePopupMenu->insertItem("Quit", this, SLOT(goodBye())); // Tree menu treePopupMenu = new QPopupMenu(this); treeID = menu->insertItem("Tree", treePopupMenu); searchA = new QAction("Search", ToolBarIcon::prepare("iqnotes/find"), QString::null, Key_F, this, 0 ); connect(searchA, SIGNAL(activated()), this, SLOT(search())); // searchA->addTo(toolbar); searchA->addTo(treePopupMenu); multiTB->setIconSet(ToolBarIcon::prepare("iqnotes/find")); connect(multiTB, SIGNAL(clicked()), this, SLOT(search())); // toolbar->addSeparator(); // no room for this treePopupMenu->insertSeparator(); quickAddA = new QAction("Quick add", ToolBarIcon::prepare("iqnotes/quick_add"), QString::null, Key_Q, this, 0 ); connect(quickAddA, SIGNAL(activated()), this, SLOT(quickAdd())); quickAddA->addTo(toolbar); quickAddA->addTo(treePopupMenu); addBeforeA = new QAction("Add before", ToolBarIcon::prepare("iqnotes/add_before"), QString::null, 0, this, 0 ); connect(addBeforeA, SIGNAL(activated()), this, SLOT(addBefore())); addBeforeA->addTo(toolbar); addBeforeA->addTo(treePopupMenu); addAfterA = new QAction("Add after", ToolBarIcon::prepare("iqnotes/add_after"), QString::null, Key_A, this, 0 ); connect(addAfterA, SIGNAL(activated()), this, SLOT(addAfter())); addAfterA->addTo(toolbar); addAfterA->addTo(treePopupMenu); addChildA = new QAction("Add child", ToolBarIcon::prepare("iqnotes/add_child"), QString::null, Key_E, this, 0 ); connect(addChildA, SIGNAL(activated()), this, SLOT(addChild())); addChildA->addTo(toolbar); addChildA->addTo(treePopupMenu); treePopupMenu->insertSeparator(); sortID = treePopupMenu->insertItem("Sort", this, SLOT(sort())); treePopupMenu->insertSeparator(); expandTreeID = treePopupMenu->insertItem("Expand tree", this, SLOT(expandTree())); collapseTreeID = treePopupMenu->insertItem("Collapse tree", this, SLOT(collapseTree())); treePopupMenu->insertSeparator(); taskListPopupMenu = new QPopupMenu(this); taskListPopupMenu->insertItem("From whole tree", this, SLOT(taskListWholeTree())); taskListPopupMenu->insertItem("From current note down", this, SLOT(taskListCurrent())); eventListPopupMenu = new QPopupMenu(this); eventListPopupMenu->insertItem("From whole tree", this, SLOT(eventListWholeTree())); eventListPopupMenu->insertItem("From current note down", this, SLOT(eventListCurrent())); taskListID = treePopupMenu->insertItem("Task list", taskListPopupMenu); eventListID = treePopupMenu->insertItem("Event list", eventListPopupMenu); treePopupMenu->insertSeparator(); reminderID = treePopupMenu->insertItem("Reminder", this, SLOT(showReminder())); toolbar->addSeparator(); /* closeSearchTreeA = new QAction("Close search tree", Resource::loadPixmap("iqnotes/close_search_tree"), QString::null, 0, this, 0 ); connect(closeSearchTreeA, SIGNAL(activated()), this, SLOT(closeSearchTree())); closeSearchTreeA->addTo(tree);*/ // Note menu notePopupMenu = new QPopupMenu(this); noteID = menu->insertItem("Note", notePopupMenu); renameNoteID = notePopupMenu->insertItem("Rename", this, SLOT(renameNote()), Key_R); editA = new QAction("Edit", ToolBarIcon::prepare("iqnotes/edit"), QString::null, Key_Return, this, 0 ); editA->setToolTip("Edit note"); connect(editA, SIGNAL(activated()), this, SLOT(editNote())); editA->addTo(toolbar); editA->addTo(notePopupMenu); cutA = new QAction("Cut", ToolBarIcon::prepare("iqnotes/bin"), QString::null, Key_X, this, 0 ); cutA->setToolTip("Cut note"); connect(cutA, SIGNAL(activated()), this, SLOT(cutNote())); cutA->addTo(toolbar); cutA->addTo(notePopupMenu); copyNotePopupMenu = new QPopupMenu(this); copyNotePopupMenu->insertItem("Only current note", this, SLOT(copyNoteOnlyCurrent())); copyNotePopupMenu->insertItem("Current note and down", this, SLOT(copyNoteCurrentAndDown())); copyNoteID = notePopupMenu->insertItem("Copy", copyNotePopupMenu); pasteNotePopupMenu = new QPopupMenu(this); pasteNotePopupMenu->insertItem("Before", this, SLOT(pasteNoteBefore())); pasteNotePopupMenu->insertItem("After", this, SLOT(pasteNoteAfter()), SHIFT+Key_A); pasteNotePopupMenu->insertItem("As child", this, SLOT(pasteNoteChild()), SHIFT+Key_E); pasteNoteID = notePopupMenu->insertItem("Paste", pasteNotePopupMenu); notePopupMenu->insertSeparator(); setPictureA = new QAction("Set picture", ToolBarIcon::prepare("iqnotes/set_picture"), QString::null, CTRL+Key_P, this, 0); setPictureA->setToolTip("Set picture"); connect(setPictureA, SIGNAL(activated()), this, SLOT(setPicture())); //setPictureA->addTo(toolbar); setPictureA->addTo(notePopupMenu); notePopupMenu->insertSeparator(); setTaskA = new QAction("Set task", ToolBarIcon::prepare("iqnotes/set_task"), QString::null, CTRL+Key_T, this, 0); setTaskA->setToolTip("Set task"); connect(setTaskA, SIGNAL(activated()), this, SLOT(setTask())); //setTaskA->addTo(toolbar); setTaskA->addTo(notePopupMenu); setEventA = new QAction("Set event", ToolBarIcon::prepare("iqnotes/set_event"), QString::null, CTRL+Key_E, this, 0); setEventA->setToolTip("Set event"); connect(setEventA, SIGNAL(activated()), this, SLOT(setEvent())); //setEventA->addTo(toolbar); setEventA->addTo(notePopupMenu); unsetTaskEventID = notePopupMenu->insertItem("Unset", this, SLOT(unsetTaskEvent())); notePopupMenu->insertSeparator(); setReminderID = notePopupMenu->insertItem("Set reminder", this, SLOT(setReminder())); unsetReminderID = notePopupMenu->insertItem("Unset reminder", this, SLOT(unsetReminder())); // View menu viewPopupMenu = new QPopupMenu(this); viewID = menu->insertItem("View", viewPopupMenu); toolbar->addSeparator(); hideNoteA = new QAction("Hide note", ToolBarIcon::prepare("iqnotes/hide_note"), QString::null, Key_1, this, 0 ); hideNoteA->setToolTip("Hide note"); connect(hideNoteA, SIGNAL(activated()), this, SLOT(hideNote())); hideNoteA->addTo(toolbar); hideNoteA->addTo(viewPopupMenu); hideTreeA = new QAction("Hide tree", ToolBarIcon::prepare("iqnotes/hide_tree"), QString::null, Key_2, this, 0 ); hideTreeA->setToolTip("Hide tree"); connect(hideTreeA, SIGNAL(activated()), this, SLOT(hideTree())); hideTreeA->addTo(toolbar); hideTreeA->addTo(viewPopupMenu); halfViewA = new QAction("Half view", ToolBarIcon::prepare("iqnotes/half_view"), QString::null, Key_3, this, 0 ); halfViewA->setToolTip("Half view"); connect(halfViewA, SIGNAL(activated()), this, SLOT(halfView())); halfViewA->addTo(toolbar); halfViewA->addTo(viewPopupMenu); /* viewPopupMenu->insertSeparator(); toggleToolBarID = viewPopupMenu->insertItem("Toggle toolbar", this, SLOT(toggleToolBar())); toggleFullScreenID = viewPopupMenu->insertItem("Toggle fullscreen", this, SLOT(toggleFullScreen())); */ // Options menu optionsPopupMenu = new QPopupMenu(this); optionsID = menu->insertItem("Options", optionsPopupMenu); optionsPopupMenu->insertItem("Define new entry", this, SLOT(defineNewEntry())); optionsPopupMenu->insertItem("Change entry", this, SLOT(changeEntry())); optionsPopupMenu->insertItem("Delete entry", this, SLOT(deleteEntry())); optionsPopupMenu->insertSeparator(); optionsPopupMenu->insertItem("Preferences", this, SLOT(preferenc())); // Help menu helpPopupMenu = new QPopupMenu(this); menu->insertItem("Help", helpPopupMenu); helpPopupMenu->insertItem("About", this, SLOT(about())); addToolBar(toolbar); IQApp = this; // notes = new Notes(this, "bla"); setCentralWidget(notes); connect(notes, SIGNAL(emptyNoteTree()), this, SLOT(isEmptyNoteTree())); connect(notes, SIGNAL(noEmptyNoteTree()), this, SLOT(isNotEmptyNoteTree())); connect(notes, SIGNAL(searchTreeShown()), this, SLOT(searchTreeShown())); connect(notes, SIGNAL(searchTreeClosed()), this, SLOT(searchTreeClosed())); connect(notes, SIGNAL(taskListShown()), this, SLOT(taskListShown())); connect(notes, SIGNAL(taskListClosed()), this, SLOT(taskListClosed())); connect(notes, SIGNAL(eventListShown()), this, SLOT(eventListShown())); connect(notes, SIGNAL(eventListClosed()), this, SLOT(eventListClosed())); connect(notes, SIGNAL(reminderShown()), this, SLOT(reminderShown())); connect(notes, SIGNAL(reminderClosed()), this, SLOT(reminderClosed())); connect(notes, SIGNAL(noteModified(bool)), this, SLOT(setModified(bool))); readConfig(); changeFont(); noNoteTree(); }
MainView::MainView(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, fl) { setIcon( Resource::loadPixmap( "remote" ) ); setCaption(tr("uBrowser")); setToolBarsMovable( false ); QToolBar *toolbar = new QToolBar(this, "toolbar"); back = new QToolButton(Resource::loadPixmap("ubrowser/back"), 0, 0, 0, 0, toolbar, "back"); forward = new QToolButton(Resource::loadPixmap("ubrowser/forward"), 0, 0, 0, 0, toolbar, "forward"); home = new QToolButton(Resource::loadPixmap("ubrowser/home"), 0, 0, 0, 0, toolbar, "home"); location = new QComboBox(true, toolbar, "location"); go = new QToolButton(Resource::loadPixmap("ubrowser/go"), 0, 0, 0, 0, toolbar, "go"); toolbar->setStretchableWidget(location); toolbar->setHorizontalStretchable(true); location->setAutoCompletion( true ); addToolBar(toolbar); browser = new QTextBrowser(this, "browser"); setCentralWidget(browser); //make the button take you to the location connect(go, SIGNAL(clicked()), this, SLOT(goClicked()) ); connect(location->lineEdit(), SIGNAL(returnPressed()), this, SLOT(goClicked()) ); //make back, forward and home do their thing (isnt QTextBrowser great?) connect(back, SIGNAL(clicked()), browser, SLOT(backward()) ); connect(forward, SIGNAL(clicked()), browser, SLOT(forward()) ); connect(home, SIGNAL(clicked()), browser, SLOT(home()) ); //make back and forward buttons be enabled, only when you can go back or forward (again, i love QTextBrowser) //this doesnt seem to work, but doesnt break anything either... connect(browser, SIGNAL(backwardAvailable(bool)), back, SLOT(setOn(bool)) ); connect(browser, SIGNAL(forwardAvailable(bool)), forward, SLOT(setOn(bool)) ); //notify me when the text of the browser has changed (like when the user clicks a link) connect(browser, SIGNAL(textChanged()), this, SLOT(textChanged()) ); http = new HttpFactory(browser); if( qApp->argc() > 1 ) { char **argv = qApp->argv(); int i = 0; QString *openfile = new QString( argv[0] ); while( openfile->contains( "ubrowser" ) == 0 && i < qApp->argc() ) { i++; *openfile = argv[i]; } *openfile = argv[i+1]; if( !openfile->startsWith( "http://" ) && !openfile->startsWith( "/" ) ) { openfile->insert( 0, QDir::currentDirPath()+"/" ); } location->setEditText( *openfile ); goClicked(); } }
QmvFormTool::QmvFormTool( QmvRelationWidget * rlw, QmvApplication * parent, const char * name ) : QmvToolWindow( rlw->getRelation(), parent, name ) { // ------------------------------------------------------------ // Query Objects // ------------------------------------------------------------ // Form header fh = 0; pagesize = background.size(); if ( rlw ) rlw_form = rlw; else throw( QmvException( QString( "<h3>QmvFormTool::QmvFormTool</h2>" "Failed to build FORM object" ), QmvException::Critical) ); reln_form = rlw->getRelation(); if ( !reln_form ) throw( QmvException( QString( "<h3>QmvFormTool::QmvFormTool</h2>" "Failed to build FORM object" ), QmvException::Critical) ); // Form details. QmvSqlClass * fmdt_existing = (QmvSqlClass *) reln_form->dataBase()->dbRelation( "fmdt" ); if ( fmdt_existing ) reln_fmdt = new QmvSqlClass( *fmdt_existing ); else throw( QmvException( QString( "<h3>QmvFormTool::QmvFormTool</h2>" "Failed to build FMDT object" ), QmvException::Critical) ); // ------------------------------------------- // Mouse Clicks ------------------------------ // ------------------------------------------- // notice button clicks on grid connect( canvasView(), SIGNAL( clicked( QCanvasItem *, const QPoint &, ButtonState, ButtonState ) ), this, SLOT( popupEventDetails( QCanvasItem *, const QPoint &, ButtonState, ButtonState ) ) ); // doubleclick - edit connect( canvasView(), SIGNAL( doubleClicked( QCanvasItem *, const QPoint &, ButtonState, ButtonState ) ), this, SLOT( dataChangeRequested( QCanvasItem *, const QPoint &, ButtonState, ButtonState ) ) ); // notice grid movements connect( canvasView(), SIGNAL( moved( QCanvasItem *, const QPoint &, const QPoint & ) ), this, SLOT( eventLabelMoved( QCanvasItem *, const QPoint &, const QPoint & ) ) ); // notice resizes connect( canvasView(), SIGNAL( resized( QCanvasItem *, const QRect &, const QRect & ) ), this, SLOT( eventLabelResized( QCanvasItem *, const QRect &, const QRect & ) ) ); // --- ACCELERATORS --------------------------------------- // ------------------------------------------------------------ QAccel * ap_accel = new QAccel( this, "forms" ); int a_id; // line down a_id = ap_accel->insertItem( Key_Down ); ap_accel->connectItem( a_id, this, SLOT( slotLineDown() ) ); ap_accel->setWhatsThis( a_id, "Scroll down one line" ); // line up a_id = ap_accel->insertItem( Key_Up ); ap_accel->connectItem( a_id, this, SLOT( slotLineUp() ) ); ap_accel->setWhatsThis( a_id, "Scroll up one line" ); // page down a_id = ap_accel->insertItem( Key_Next ); ap_accel->connectItem( a_id, this, SLOT( slotPageDown() ) ); ap_accel->setWhatsThis( a_id, "Scroll down one page" ); // page up a_id = ap_accel->insertItem( Key_Prior ); ap_accel->connectItem( a_id, this, SLOT( slotPageUp() ) ); ap_accel->setWhatsThis( a_id, "Scroll up one page" ); QAction * ac; QActionGroup * ag_insert = new QActionGroup( this, "ag_insert" ); // ------------------------------------------------------------ // Navigation Toolbar // ------------------------------------------------------------ // clear the navigation toolbar - not needed yet navigationToolBar()->clear(); // ------------------------------------------------------------ // Tool buttons for adding detail objects // ------------------------------------------------------------ ag_insert->setExclusive(TRUE); QSignalMapper *ndt_sigmap = new QSignalMapper( this ); connect( ndt_sigmap, SIGNAL( mapped(int) ), this, SLOT( slotAddNewDetail(int) ) ); // Label ----------------------------------------------------- ac = new QAction( "Text", *stdicons->makeTextPixmap( new QPixmap(stdicons->getPixmap(QmvIcons::BlankPageIcon)), tr("T"), QFont("Times"), QColor( blue ), QRect() ), "Text", ALT+SHIFT+Key_T, ag_insert, "text", FALSE ); ndt_sigmap->setMapping( ac, formDetail::Label ); connect( ac, SIGNAL( activated() ), ndt_sigmap, SLOT( map() ) ); // Field ----------------------------------------------------- ac = new QAction( "Field", *stdicons->makeTextPixmap( new QPixmap(stdicons->getPixmap(QmvIcons::BlankPageIcon)), tr("F"), QFont("Times"), QColor( blue ), QRect() ), "Field", ALT+SHIFT+Key_F, ag_insert, "Field", FALSE ); ndt_sigmap->setMapping( ac, formDetail::Field ); connect( ac, SIGNAL( activated() ), ndt_sigmap, SLOT( map() ) ); // Line ----------------------------------------------------- ac = new QAction( "Line", *stdicons->makeTextPixmap( new QPixmap(stdicons->getPixmap(QmvIcons::BlankPageIcon)), tr("L"), QFont("Times"), QColor( blue ), QRect() ), "Line", ALT+SHIFT+Key_L, ag_insert, "Line", FALSE ); ndt_sigmap->setMapping( ac, formDetail::Line ); connect( ac, SIGNAL( activated() ), ndt_sigmap, SLOT( map() ) ); // Calc ----------------------------------------------------- ac = new QAction( "Calculation", *stdicons->makeTextPixmap( new QPixmap(stdicons->getPixmap(QmvIcons::BlankPageIcon)), tr("C"), QFont("Times"), QColor( blue ), QRect() ), "Calculation", ALT+SHIFT+Key_C, ag_insert, "Calculation", FALSE ); ndt_sigmap->setMapping( ac, formDetail::Calc ); connect( ac, SIGNAL( activated() ), ndt_sigmap, SLOT( map() ) ); // Special ----------------------------------------------------- ac = new QAction( "Special", *stdicons->makeTextPixmap( new QPixmap(stdicons->getPixmap(QmvIcons::BlankPageIcon)), tr("S"), QFont("Times"), QColor( blue ), QRect() ), "Special", ALT+SHIFT+Key_S, ag_insert, "Special", FALSE ); ndt_sigmap->setMapping( ac, formDetail::Special ); connect( ac, SIGNAL( activated() ), ndt_sigmap, SLOT( map() ) ); // Print ------------------------------------------------------ ac = new QAction( "Print", QPixmap( QmvFormToolIcons::print_xpm ), "&Print", Key_P, ag_insert, "form_print", FALSE ); connect( ac, SIGNAL( activated() ), this, SLOT( slotPrint() ) ); // Fax ------------------------------------------------------ ac = new QAction( "Fax", QPixmap( QmvFormToolIcons::fax_xpm ), "Fa&x", Key_X, ag_insert, "form_fax", FALSE ); connect( ac, SIGNAL( activated() ), this, SLOT( slotFax() ) ); // Email ------------------------------------------------------ ac = new QAction( "Email", QPixmap( QmvFormToolIcons::email_xpm ), "&Email", Key_E, ag_insert, "form_email", FALSE ); connect( ac, SIGNAL( activated() ), this, SLOT( slotEmail() ) ); // Add actiongroup to toolbar otherToolBar()->clear(); new QLabel( "Add new detail: ", otherToolBar(), "display_label" ); ag_insert->addTo( otherToolBar() ); // prepare for display setToolBarsMovable(FALSE); adjustSize(); updateGeometry(); setFocus(); // adjust canvas to the base magnification. setCanvasSize(); }
void MainWindow::initUI() { // Build menu and tool bars setToolBarsMovable( false ); m_menuBar.setHorizontalStretchable( true ); QMenuBar *mb = new QMenuBar( &m_menuBar ); mb->setMargin( 0 ); // Find toolbar addToolBar( &m_findBar, QMainWindow::Top, true ); m_findBar.setHorizontalStretchable( true ); m_findEdit = new QLineEdit( &m_findBar ); QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); m_findBar.setStretchableWidget( m_findEdit ); connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) ); // Packages menu QPopupMenu *popup = new QPopupMenu( this ); QAction *a = new QAction( tr( "Update lists" ), Opie::Core::OResource::loadPixmap( "packagemanager/update", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to update package lists from servers." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); a->addTo( popup ); a->addTo( &m_toolBar ); QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Opie::Core::OResource::loadPixmap( "packagemanager/upgrade", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) ); connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); actionUpgrade->addTo( popup ); actionUpgrade->addTo( &m_toolBar ); QPixmap iconDownload = Opie::Core::OResource::loadPixmap( "packagemanager/download", Opie::Core::OResource::SmallIcon ); QPixmap iconRemove = Opie::Core::OResource::loadPixmap( "packagemanager/remove", Opie::Core::OResource::SmallIcon ); QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); #ifndef USE_LIBOPKG actionDownload->addTo( popup ); actionDownload->addTo( &m_toolBar ); #endif a = new QAction( tr( "Apply changes" ), Opie::Core::OResource::loadPixmap( "packagemanager/apply", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); a->addTo( popup ); a->addTo( &m_toolBar ); a = new QAction( tr( "Install local package" ), Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to install a package file located on device." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) ); a->addTo( popup ); //a->addTo( &m_toolBar ); popup->insertSeparator(); a = new QAction( tr( "Configure" ), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to configure this application." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); a->addTo( popup ); mb->insertItem( tr( "Actions" ), popup ); // View menu popup = new QPopupMenu( this ); m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); m_actionShowNotInstalled->setToggleAction( true ); m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) ); connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); m_actionShowNotInstalled->addTo( popup ); m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); m_actionShowInstalled->setToggleAction( true ); m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) ); connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); m_actionShowInstalled->addTo( popup ); m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); m_actionShowUpdated->setToggleAction( true ); m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); m_actionShowUpdated->addTo( popup ); popup->insertSeparator(); m_actionFilter = new QAction( tr( "Filter" ), Opie::Core::OResource::loadPixmap( "packagemanager/filter", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); m_actionFilter->setToggleAction( true ); m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); m_actionFilter->addTo( popup ); a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); a->addTo( popup ); popup->insertSeparator(); a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); a->addTo( popup ); m_actionFindNext = new QAction( tr( "Find next" ), Opie::Core::OResource::loadPixmap( "next", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); m_actionFindNext->setEnabled( false ); m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); m_actionFindNext->addTo( popup ); m_actionFindNext->addTo( &m_findBar ); mb->insertItem( tr( "View" ), popup ); // Finish find toolbar creation a = new QAction( QString::null, Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); a->addTo( &m_findBar ); m_findBar.hide(); }
void MainWindow::makeMenu() { QToolBar *toolBar = new QToolBar( this ); QToolBar *searchBar = new QToolBar(this); QMenuBar *menuBar = new QMenuBar( toolBar ); QPopupMenu *searchMenu = new QPopupMenu( menuBar ); // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); setToolBarsMovable( false ); toolBar->setHorizontalStretchable( true ); menuBar->insertItem( tr( "Search" ), searchMenu ); menuBar->insertItem( tr( "Settings" ), cfgMenu ); //SETTINGS MENU cfgMenu->insertItem( tr( "Search" ), searchOptions ); QPopupMenu *pop; for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ pop = s->popupMenu(); if (pop){ cfgMenu->insertItem( s->text(0), pop ); } } //SEARCH SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); SearchAllAction->setIconSet( Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ) ); // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); SearchAllAction->addTo( searchMenu ); searchMenu->insertItem( tr( "Options" ), searchOptions ); //SEARCH OPTIONS //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); //actionWholeWordsOnly->addTo( searchOptions ); actionCaseSensitiv = new QAction( tr("Case sensitive"),QString::null, 0, this, 0, true ); actionCaseSensitiv->addTo( searchOptions ); actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); actionWildcards->addTo( searchOptions ); //SEARCH BAR LabelEnterText = new QLabel( searchBar, "Label" ); LabelEnterText->setAutoMask( FALSE ); LabelEnterText->setText( tr( "Search for: " ) ); LabelEnterText->setFrameStyle( QFrame::NoFrame ); LabelEnterText->setBackgroundMode( PaletteButton ); addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); searchEdit->setFocus(); searchBar->setHorizontalStretchable( TRUE ); searchBar->setStretchableWidget( searchEdit ); //Search button SearchAllAction->addTo( searchBar ); //Clear text ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); ClearSearchText->setText( "" ); ClearSearchText->setPixmap( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) ); connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) ); connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); }