void TextEdit::setupEditActions() { QToolBar *tb = new QToolBar( this ); tb->setLabel( "Edit Actions" ); QPopupMenu *menu = new QPopupMenu( this ); menuBar()->insertItem( tr( "&Edit" ), menu ); QAction *a; a = new QAction( QPixmap::fromMimeSource( "editundo.xpm" ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" ); connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( QPixmap::fromMimeSource( "editredo.xpm" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) ); a->addTo( tb ); a->addTo( menu ); menu->insertSeparator(); a = new QAction( QPixmap::fromMimeSource( "editcopy.xpm" ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" ); connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( QPixmap::fromMimeSource( "editcut.xpm" ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" ); connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( QPixmap::fromMimeSource( "editpaste.xpm" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" ); connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); a->addTo( tb ); a->addTo( menu ); }
void TextEdit::setupEditActions() { QToolBar *tb = new QToolBar( this ); QPopupMenu *menu = new QPopupMenu( this ); menuBar()->insertItem( tr( "&Edit" ), menu ); QAction *a; a = new QAction( tr( "Undo" ), QPixmap( "textdrawing/undo.png" ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" ); connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( tr( "Redo" ), QPixmap( "textdrawing/redo.png" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" ); connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) ); a->addTo( tb ); a->addTo( menu ); menu->insertSeparator(); a = new QAction( tr( "Cut" ), QPixmap( "textdrawing/editcut.png" ), tr( "&Cut" ), CTRL + Key_X, this, "editCut" ); connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( tr( "Copy" ), QPixmap( "textdrawing/editcopy.png" ), tr( "C&opy" ), CTRL + Key_C, this, "editCopy" ); connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( tr( "Paste" ), QPixmap( "textdrawing/editpaste.png" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" ); connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); a->addTo( tb ); a->addTo( menu ); }
void TextEdit::setupFileActions() { QToolBar *tb = new QToolBar( this ); QPopupMenu *menu = new QPopupMenu( this ); menuBar()->insertItem( tr( "&File" ), menu ); QAction *a; a = new QAction( tr( "New" ), QPixmap( "textdrawing/filenew.png" ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" ); connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( tr( "Open" ), QPixmap( "textdrawing/fileopen.png" ), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" ); connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); a->addTo( tb ); a->addTo( menu ); menu->insertSeparator(); a = new QAction( tr( "Save" ), QPixmap( "textdrawing/filesave.png" ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" ); connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( tr( "Save As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" ); connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) ); a->addTo( menu ); menu->insertSeparator(); a = new QAction( tr( "Print" ), QPixmap( "textdrawing/print.png" ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" ); connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( tr( "Close" ), QPixmap(), tr( "&Close" ), 0, this, "fileClose" ); connect( a, SIGNAL( activated() ), this, SLOT( fileClose() ) ); a->addTo( menu ); }
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(); }
/* * init tool bars layout and so on */ void MainWindow::initUI() { setToolBarsMovable( false ); m_toolBar = new QToolBar( this ); m_toolBar->setHorizontalStretchable( TRUE ); m_itemNewAction->addTo( m_toolBar ); m_popTemplate = new QPopupMenu( this ); m_popTemplate->setCheckable( TRUE ); connect( m_popTemplate, SIGNAL(activated(int) ), this, SLOT(slotNewFromTemplate(int) ) ); //X m_popView->insertItem(tr("New from template"), m_popTemplate, -1, 0); m_toolBar->addSeparator(); QAction *a = new QAction( tr("Today" ), Opie::Core::OResource::loadPixmap( "datebook/to_day", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->addTo( m_toolBar ); connect(a, SIGNAL( activated() ), this, SLOT( slotGoToNow() ) ); m_toolBar->addSeparator(); m_viewsBar = new QToolBar( this ); m_viewsBar->setHorizontalStretchable( FALSE ); m_toolBar2 = new QToolBar( this ); m_toolBar2->setHorizontalStretchable( TRUE ); m_toolBar2->addSeparator(); a = new QAction( tr("Find"), Opie::Core::OResource::loadPixmap( "mag", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->addTo( m_toolBar2 ); connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); m_configureAction->addTo( m_toolBar2 ); if ( Ir::supported() ) { m_itemBeamOccurrenceAction = new QAction( tr( "Beam this occurrence" ), QString::null, 0, this, 0 ); connect( m_itemBeamOccurrenceAction, SIGNAL(activated()), this, SLOT(slotItemBeamOccurrence()) ); m_itemBeamOccurrenceAction->setWhatsThis( tr( "Transmit the specific occurrence of the selected recurring item." ) ); } /*X a = new QAction( tr("Configure Templates"), QString::null, 0, 0 ); a->addTo( m_popSetting ); connect(a, SIGNAL( activated() ), this, SLOT(slotConfigureTemp() ) ); */ connect( qApp, SIGNAL(clockChanged(bool) ), this, SLOT(slotClockChanged(bool) ) ); connect( qApp, SIGNAL(weekChanged(bool) ), this, SLOT(slotWeekChanged(bool) ) ); m_stack = new QWidgetStack( this ); setCentralWidget( m_stack ); }
void MainWindow::initUI() { /* * We want to provde a File Menu with Quit as option * and a Fire Toolbutton ( QAction ) * So we need two actions * A toolbar and a popupMenu */ setToolBarsMovable( false ); /* *We don't want the static toolbar but share it with the * toolbar on small screens */ QToolBar *menuBarHolder = new QToolBar( this ); /* we allow the menubarholder to become bigger than * the screen width and to offer a > for the additional items */ menuBarHolder->setHorizontalStretchable( true ); QMenuBar *mb = new QMenuBar( menuBarHolder ); QToolBar *tb = new QToolBar( this ); QPopupMenu *fileMenu = new QPopupMenu( this ); /* * we create our first action with the Text Quit * a IconSet, no menu name, no acceleration ( keyboard shortcut ), * with parent this, and name "quit_action" */ /* * Note if you want a picture out of the inline directory * you musn't prefix inline/ inline means these pics are built in * into libqpe so the name without ending and directory is enough */ QAction *a = new QAction( tr("Quit"), Opie::Core::OResource::loadPixmap("quit_icon", Opie::Core::OResource::SmallIcon), QString::null, 0, this, "quit_action" ); /* * Connect quit to the QApplication quit slot */ connect(a, SIGNAL(activated() ), qApp, SLOT(quit() ) ); a->addTo( fileMenu ); a = new QAction(tr("Fire"), Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon), QString::null, 0, this, "fire_button"); /* see the power? */ a->addTo( fileMenu ); a->addTo( tb ); m_fire = a; mb->insertItem(tr("File"), fileMenu ); }
void Help::setupFileActions() { QPopupMenu* menu = new QPopupMenu( this ); menuBar()->insertItem( tr( "&File" ), menu ); QAction *a; a = new QAction( tr( "Print" ), createIconSet( "print.xpm" ), tr( "&Print" ), CTRL + Key_P, this ); a->addTo( menu ); a->addTo( toolbar ); connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) ); a = new QAction( tr( "Close" ), tr( "&Close" ), 0, this ); a->addTo( menu ); connect( a, SIGNAL( activated() ), this, SLOT( close() ) ); }
void aToolBar::ReadTool( aCfgItem &obj ) { aCfgItem aobj, apix; // action and pixmap XML data QString aKey; // key sequence long pid; // action id aobj = md->firstChild( obj ); //from first child action while ( !aobj.isNull() ) { // foreach not null aKey = md->sText ( aobj, md_key ); //key sequence pid = md->id( aobj ); // action id apix = md->findChild( md->find( md->text( md->findChild( aobj, md_comaction, 0 ) ).toLong() ), md_active_picture, 0 ); // first action pixmap cfg object QPixmap pix( md->binary( apix ) ); // pixmap QAction *a = new QAction( QIconSet(pix), // pixmap md->attr( aobj, mda_name), // name aKey, // key sequence this, // owner md->attr( aobj, mda_name) // name ); // create new action actions.insert( pid, a ); // add action to dict a->addTo( this ); // put action into toolbar connect( a, SIGNAL(activated()), this, SLOT(on_Item()) ); // connect to slot aobj = md->nextSibling( aobj ); // get next action } }
moduleMC::moduleMC(OpenMFGGUIClient *Pparent) : QObject(Pparent, "mcModule") { QAction *actThis; parent = Pparent; // Currencies currenciesMenu = new QPopupMenu(); actThis = new QAction(tr("New Currency..."), 0, currenciesMenu); connect(actThis, SIGNAL(activated()), SLOT(sNewCurrency())); actThis->addTo(currenciesMenu); actThis = new QAction(tr("Currencies..."), 0, currenciesMenu); connect(actThis, SIGNAL(activated()), SLOT(sCurrencies())); actThis->addTo(currenciesMenu); // Exchange Rates exchangeRatesMenu = new QPopupMenu(); actThis = new QAction(tr("Post Exchange Rate..."), 0, exchangeRatesMenu); connect(actThis, SIGNAL(activated()), SLOT(sPostExchangeRate())); actThis->addTo(exchangeRatesMenu); // Displays displaysMenu = new QPopupMenu(); // Reports reportsMenu = new QPopupMenu(); mainMenu = new QPopupMenu(); mainMenu->insertItem(tr("Currencies"), currenciesMenu); mainMenu->insertItem(tr("Exchange Rates"), exchangeRatesMenu); mainMenu->insertItem(tr("Displays"), displaysMenu); mainMenu->insertItem(tr("Reports"), reportsMenu); parent->menuBar()->insertItem(tr("M/C"), mainMenu); }
void DesignerFormWindowImpl::addToolBarSeparator( const QString &tbn ) { if ( !::qt_cast<QMainWindow*>(formWindow->mainContainer()) ) return; QMainWindow *mw = (QMainWindow*)formWindow->mainContainer(); QDesignerToolBar *tb = (QDesignerToolBar*)mw->child( tbn, "QDesignerToolBar" ); if ( !tb ) return; QAction *a = new QSeparatorAction( 0 ); a->addTo( tb ); tb->addAction( a ); }
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 ); }
void Help::setupGoActions() { QPopupMenu* menu = new QPopupMenu( this ); menuBar()->insertItem( tr( "&Go" ), menu ); QAction *a; a = new QAction( tr( "Home" ), createIconSet( "home.xpm" ), ( "&Home" ), ALT + Key_Home, this ); a->addTo( menu ); a->addTo( toolbar ); connect( a, SIGNAL( activated() ), this, SLOT( goHome() ) ); a = new QAction( tr( "Qt Reference Documentation" ), createIconSet( "customwidget.xpm" ), ( "&Qt Reference Documentation" ), ALT + SHIFT + Key_Home, this ); a->addTo( menu ); a->addTo( toolbar ); connect( a, SIGNAL( activated() ), this, SLOT( goQt() ) ); menu->insertSeparator(); a = new QAction( tr( "Backward" ), createIconSet( "left.xpm" ), ( "&Backward" ), ALT + Key_Left, this ); a->addTo( menu ); a->addTo( toolbar ); connect( a, SIGNAL( activated() ), browser, SLOT( backward() ) ); connect( browser, SIGNAL( backwardAvailable( bool ) ), a, SLOT( setEnabled( bool ) ) ); a = new QAction( tr( "Forward" ), createIconSet( "right.xpm" ), tr( "&Forward" ), ALT + Key_Right, this ); a->addTo( menu ); a->addTo( toolbar ); connect( a, SIGNAL( activated() ), browser, SLOT( forward() ) ); connect( browser, SIGNAL( forwardAvailable( bool ) ), a, SLOT( setEnabled( bool ) ) ); menu->insertSeparator(); a = new QAction( tr( "Topics/Index" ), createIconSet( "help.xpm" ), tr( "&Topics/Index..." ), CTRL + Key_T, this ); a->addTo( menu ); a->addTo( toolbar ); connect( a, SIGNAL( activated() ), this, SLOT( goTopics() ) ); }
QTExamWindow::QTExamWindow( QWidget* parent, const char* name, WFlags f ) : QMainWindow( parent, name, f ) { setCaption("QTExam"); QAction *actFileNew = new QAction( "New", "&New", CTRL+Key_N, this, "new" ); QAction *actFileQuit = new QAction( "Quit", "&Quit", CTRL+Key_Q, this, "quit" ); connect( actFileNew, SIGNAL( activated() ), this, SLOT( newDocument() ) ); connect( actFileQuit, SIGNAL( activated() ), qApp, SLOT( quit() ) ); QPopupMenu *menuFile = new QPopupMenu( this ); actFileNew->addTo( menuFile ); menuFile->insertSeparator(); actFileQuit->addTo( menuFile ); QMenuBar *menuMain = menuBar(); menuMain->insertItem( "&File", menuFile ); table = new QTable( 52, 12, this ); table->setFocus(); setCentralWidget( table ); }
void MruDocuments::reconnectActionsToPopupMenu() { // reconnect actions, now that they have been sorted, to popup menu QStringList list; for (QAction* pAction = m_mruDocuments.first(); pAction; pAction = m_mruDocuments.next()) { pAction->addTo(m_pPopup); list.append(pAction->text()); } // update settings DefaultSettings::instance().setMruDocuments(list); }
CMDIWindow::CMDIWindow(QWidget* parent) : CMyWindow(parent, 0, true, WType_TopLevel) { #ifdef DEBUG qDebug("CMDIWindow::CMDIWindow()"); #endif setName("MainWindow"); setMinimumSize(320, 240); setCaption(QString(APPLICATION) + " " + QString(VERSION) + QString(BRANCH)); setIcon(getPixmapIcon("applicationIcon")); setCentralWidget( new QWidget( this, "qt_central_widget" ) ); CMDIWindowLayout = new QGridLayout( centralWidget(), 1, 1, 2, 2, "CMDIWindowLayout"); myApp()->createWorkspace(centralWidget()); myApp()->workSpace()->setScrollBarsEnabled(true); CMDIWindowLayout->addWidget(myApp()->workSpace(), 0, 0); consoleMenu = new QPopupMenu(this, "ConsoleMenu"); QAction * consoleExitAction = new QAction (tr("Exit"), getPixmapIcon("exitIcon"), tr("E&xit"), 0, this, "consoleExitAction"); //Exit should not be CAction consoleExitAction->addTo(consoleMenu); connect(consoleExitAction, SIGNAL(activated()), this, SLOT(close())); menuBar()->insertItem(tr("&Console"), consoleMenu); new COptionsMenu(this, menuBar(), "OptionsMenu"); #ifndef NO_MYSQLCC_PLUGINS new CPluginsMenu(this, menuBar(), "PluginsMenu"); #endif new CHotKeyEditorMenu(this, menuBar(), "HotKeyEditor"); windowMenu = new QPopupMenu(this, "WindowMenu"); windowMenu->setCheckable(true); menuBar()->insertItem(tr("&Window"), windowMenu); new CHelpMenu(this, menuBar(), "HelpMenu"); if (!loadWindowSettings()) setGeometry((int)(myApp()->desktop()->width() - (myApp()->desktop()->width() - (myApp()->desktop()->width() / 2)) * 1.5) / 2, (int)(myApp()->desktop()->height() - (myApp()->desktop()->height() - (myApp()->desktop()->height() / 2)) * 1.5) / 2, (int)((myApp()->desktop()->width() - (myApp()->desktop()->width() / 2)) * 1.5), (int)((myApp()->desktop()->height() - (myApp()->desktop()->height() / 2)) * 1.5)); consoleWindow = 0; connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(windowMenuAboutToShow())); }
/*! * \en * Constuct object * \_en * \ru * Создает объект * \_ru */ aReportBrowser::aReportBrowser( QWidget *parent, const char *name, WFlags f ) :QMainWindow( parent, name, f ) { QAction *a; QToolBar *t = new QToolBar( this, "ReportTool" ); a = new QAction( QPixmap::fromMimeSource("print.png"), tr("Print"), QKeySequence("Ctrl+P"), t, tr("Print report") ); a->addTo( t ); connect( a, SIGNAL( activated() ), this, SLOT( print() ) ); a = new QAction( QPixmap::fromMimeSource("filesave.png"), tr("Save As"), QKeySequence("Ctrl+S"), t, tr("Save report to file") ); a->addTo( t ); connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); t->show(); textBrowser = new QTextBrowser( this, "textBrowser" ); textBrowser->setTextFormat( QTextBrowser::RichText ); textBrowser->setFocus(); // textBrowser->showMaximized(); setCentralWidget( textBrowser ); // if ( layout() ) delete layout(); // QGridLayout *l = new QGridLayout( this ); // l->addWidget( textBrowser, 1, 0 ); languageChange(); }
/** * Funcion encargada de crear la GUI. * @b NOTA: esta funcion hace parte del motor de creacion de GUI en base a archivos XML. */ void sbgui::GUIMdiMainWindow::crearGUI() { if( parser ) { QStringList nombres = parser->obtenerNombres(); HashMenu menusInfo = parser->obtenerMenus(); for(uint i = 0; i < nombres.count(); i++) { QToolBar *toolBarTmp = new QToolBar(this, nombres[i]); moveDockWindow(toolBarTmp, Qt::DockTop); toolBarTmp->show(); QStringList *strlistTmp = menusInfo.find((nombres)[i]); if (strlistTmp == 0) { std::cout << "GADMainWindow::crearGUI(): Error" << std::endl; return; } for (uint j = 0; j < strlistTmp->count(); j+=3) { QAction *actTmp = new QAction(toolBarTmp, (*strlistTmp)[j]); connect( actTmp, SIGNAL( activated() ) , this, SLOT( slotPrincipal() ) ); // FIXME: colocar la ruta bien. QPixmap pm( sbqpack::GUIDATADIR + (*strlistTmp)[j+1]); if ( ! pm.isNull() ) actTmp->setIconSet( pm ); actTmp->setToolTip( (*strlistTmp)[j+2] ); actTmp->addTo(toolBarTmp); } } } }
void QDesignerToolBar::reInsert() { QAction *a = 0; actionMap.clear(); clear(); for ( a = actionList.first(); a; a = actionList.next() ) { a->addTo( this ); if ( ::qt_cast<QActionGroup*>(a) ) { actionMap.insert( ( (QDesignerActionGroup*)a )->widget(), a ); if ( ( (QDesignerActionGroup*)a )->widget() ) ( (QDesignerActionGroup*)a )->widget()->installEventFilter( this ); } else if ( ::qt_cast<QDesignerAction*>(a) ) { actionMap.insert( ( (QDesignerAction*)a )->widget(), a ); ( (QDesignerAction*)a )->widget()->installEventFilter( this ); } else if ( ::qt_cast<QSeparatorAction*>(a) ) { actionMap.insert( ( (QSeparatorAction*)a )->widget(), a ); ( (QSeparatorAction*)a )->widget()->installEventFilter( this ); } } QApplication::sendPostedEvents(); adjustSize(); }
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(); }
DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ ) : QMainWindow(parent, name, WStyle_ContextHelp) { // init members connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) ); m_pDrawPadCanvas = new DrawPadCanvas(this, this); connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); setCentralWidget(m_pDrawPadCanvas); // init menu setToolBarsMovable(false); QToolBar* menuToolBar = new QToolBar(this); QMenuBar* menuBar = new QMenuBar(menuToolBar); QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); deleteAllAction->addTo(toolsPopupMenu); toolsPopupMenu->insertSeparator(); QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); importPageAction->addTo(toolsPopupMenu); QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); exportPageAction->addTo(toolsPopupMenu); toolsPopupMenu->insertSeparator(); QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); thumbnailViewAction->addTo(toolsPopupMenu); QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); pageInformationAction->addTo(toolsPopupMenu); toolsPopupMenu->insertSeparator(); m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); m_pAntiAliasingAction->setToggleAction(true); m_pAntiAliasingAction->addTo(toolsPopupMenu); menuBar->insertItem(tr("Tools"), toolsPopupMenu); // init page toolbar QToolBar* pageToolBar = new QToolBar(this); QAction* newPageAction = new QAction(tr("New Page"), Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon), QString::null, 0, this); connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); newPageAction->addTo(pageToolBar); newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); QAction* clearPageAction = new QAction(tr("Clear Page"), Opie::Core::OResource::loadPixmap("drawpad/clear", Opie::Core::OResource::SmallIcon), QString::null, 0, this); connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); clearPageAction->addTo(pageToolBar); clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); QAction* deletePageAction = new QAction(tr("Delete Page"), Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon), QString::null, 0, this); connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); deletePageAction->addTo(pageToolBar); deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); QToolBar* emptyToolBar = new QToolBar(this); emptyToolBar->setHorizontalStretchable(true); // init navigation toolbar QToolBar* navigationToolBar = new QToolBar(this); m_pUndoAction = new QAction(tr("Undo"), Opie::Core::OResource::loadPixmap("undo", Opie::Core::OResource::SmallIcon), QString::null, 0, this); connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); m_pUndoAction->addTo(navigationToolBar); m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); m_pRedoAction = new QAction(tr("Redo"), Opie::Core::OResource::loadPixmap("redo", Opie::Core::OResource::SmallIcon), QString::null, 0, this); connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); m_pRedoAction->addTo(navigationToolBar); m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); m_pFirstPageAction = new QAction(tr("First Page"), Opie::Core::OResource::loadPixmap("fastback", Opie::Core::OResource::SmallIcon), QString::null, 0, this); connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); m_pFirstPageAction->addTo(navigationToolBar); m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); m_pPreviousPageAction = new QAction(tr("Previous Page"), Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon), QString::null, 0, this); connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); m_pPreviousPageAction->addTo(navigationToolBar); m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); m_pNextPageAction = new QAction(tr("Next Page"), Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon), QString::null, 0, this); connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); m_pNextPageAction->addTo(navigationToolBar); m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); m_pLastPageAction = new QAction(tr("Last Page"), Opie::Core::OResource::loadPixmap("fastforward", Opie::Core::OResource::SmallIcon), QString::null, 0, this); connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); m_pLastPageAction->addTo(navigationToolBar); m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); // init draw mode toolbar QToolBar* drawModeToolBar = new QToolBar(this); m_pLineToolButton = new QToolButton(drawModeToolBar); m_pLineToolButton->setToggleButton(true); QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) ); QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton); m_pPointToolAction = new QAction(tr("Draw Point"), Opie::Core::OResource::loadPixmap("drawpad/point", Opie::Core::OResource::SmallIcon), "", 0, this); connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool())); m_pPointToolAction->addTo(linePopupMenu); m_pLineToolAction = new QAction(tr("Draw Line"), Opie::Core::OResource::loadPixmap("drawpad/line", Opie::Core::OResource::SmallIcon), "", 0, this); connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool())); m_pLineToolAction->addTo(linePopupMenu); m_pLineToolButton->setPopup(linePopupMenu); m_pLineToolButton->setPopupDelay(0); m_pRectangleToolButton = new QToolButton(drawModeToolBar); m_pRectangleToolButton->setToggleButton(true); QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) ); QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton); m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Opie::Core::OResource::loadPixmap("drawpad/rectangle", Opie::Core::OResource::SmallIcon), "", 0, this); connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); m_pRectangleToolAction->addTo(rectanglePopupMenu); m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Opie::Core::OResource::loadPixmap("drawpad/filledrectangle", Opie::Core::OResource::SmallIcon), "", 0, this); connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); m_pRectangleToolButton->setPopup(rectanglePopupMenu); m_pRectangleToolButton->setPopupDelay(0); m_pEllipseToolButton = new QToolButton(drawModeToolBar); m_pEllipseToolButton->setToggleButton(true); QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) ); QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton); m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Opie::Core::OResource::loadPixmap("drawpad/ellipse", Opie::Core::OResource::SmallIcon), "", 0, this); connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool())); m_pEllipseToolAction->addTo(ellipsePopupMenu); m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Opie::Core::OResource::loadPixmap("drawpad/filledellipse", Opie::Core::OResource::SmallIcon), "", 0, this); connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool())); m_pFilledEllipseToolAction->addTo(ellipsePopupMenu); m_pEllipseToolButton->setPopup(ellipsePopupMenu); m_pEllipseToolButton->setPopupDelay(0); m_pTextToolAction = new QAction(tr("Insert Text"), Opie::Core::OResource::loadPixmap("drawpad/text", Opie::Core::OResource::SmallIcon), QString::null, 0, this); m_pTextToolAction->setToggleAction(true); connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool())); m_pTextToolAction->addTo(drawModeToolBar); m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) ); m_pFillToolAction = new QAction(tr("Fill Region"), Opie::Core::OResource::loadPixmap("drawpad/fill", Opie::Core::OResource::SmallIcon), QString::null, 0, this); m_pFillToolAction->setToggleAction(true); connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool())); m_pFillToolAction->addTo(drawModeToolBar); m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) ); m_pEraseToolAction = new QAction(tr("Erase Point"), Opie::Core::OResource::loadPixmap("drawpad/erase", Opie::Core::OResource::SmallIcon), QString::null, 0, this); m_pEraseToolAction->setToggleAction(true); connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool())); m_pEraseToolAction->addTo(drawModeToolBar); m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) ); m_pTool = 0; setRectangleTool(); setEllipseTool(); setPointTool(); emptyToolBar = new QToolBar(this); emptyToolBar->setHorizontalStretchable(true); emptyToolBar->addSeparator(); // init draw parameters toolbar QToolBar* drawParametersToolBar = new QToolBar(this); m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar); connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int))); QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width")); m_pPenWidthSpinBox->setValue(1); m_pPenWidthSpinBox->setFocusPolicy(QWidget::NoFocus); QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) ); bool useBigIcon = qApp->desktop()->size().width() > 330; m_pPenColorToolButton = new QToolButton(drawParametersToolBar); m_pPenColorToolButton->setUsesBigPixmap( useBigIcon ); m_pPenColorToolButton->setPixmap(Opie::Core::OResource::loadPixmap("drawpad/pencolor", Opie::Core::OResource::SmallIcon)); QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) ); Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, m_pPenColorToolButton); connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); m_pPenColorToolButton->setPopup(penColorPopupMenu); m_pPenColorToolButton->setPopupDelay(0); changePenColor(Qt::black); m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); m_pBrushColorToolButton->setUsesBigPixmap( useBigIcon ); m_pBrushColorToolButton->setPixmap(Opie::Core::OResource::loadPixmap("drawpad/brushcolor", Opie::Core::OResource::SmallIcon)); QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) ); Opie::OColorPopupMenu* brushColorPopupMenu = new Opie::OColorPopupMenu(Qt::white, m_pBrushColorToolButton); connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); m_pBrushColorToolButton->setPopup(brushColorPopupMenu); m_pBrushColorToolButton->setPopupDelay(0); changeBrushColor(Qt::white); // delay the rest of the initialization and do it from within the mainloop // if we don't do this, the widget layout may not be constructed upon // and we will end up with a wrong QScrollview page size (Mickeyl) QTimer::singleShot( 100, this, SLOT( finishStartup() ) ); }
/* Constructor setups the GUI. */ QucsLib::QucsLib() { // set application icon setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm")); setCaption("Qucs Library Tool " PACKAGE_VERSION); QMenuBar * menuBar = new QMenuBar (this); // create file menu QPopupMenu * fileMenu = new QPopupMenu (); QAction * manageLib = new QAction ("Manage User Libraries...", tr("Manage User &Libraries..."), CTRL+Key_M, this); manageLib->addTo (fileMenu); connect(manageLib, SIGNAL(activated()), SLOT(slotManageLib())); fileMenu->insertSeparator(); QAction * fileQuit = new QAction ("Quit", tr("&Quit"), CTRL+Key_Q, this); fileQuit->addTo (fileMenu); connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit())); // create help menu QPopupMenu * helpMenu = new QPopupMenu (); QAction * helpHelp = new QAction (tr("Help"), tr("&Help"), Key_F1, this); helpHelp->addTo (helpMenu); connect(helpHelp, SIGNAL(activated()), SLOT(slotHelp())); QAction * helpAbout = new QAction (tr("About"), tr("About"), 0, helpMenu); helpAbout->addTo (helpMenu); connect(helpAbout, SIGNAL(activated()), SLOT(slotAbout())); // setup menu bar menuBar->insertItem (tr("&File"), fileMenu); menuBar->insertSeparator (); menuBar->insertItem (tr("&Help"), helpMenu); // main box QVBoxLayout * all = new QVBoxLayout (this); all->setSpacing (0); all->setMargin (0); // reserve space for menubar QWidget * Space = new QWidget (this); Space->setFixedSize(5, menuBar->height() + 2); all->addWidget (Space); // main layout QHBox * h = new QHBox (this); h->setSpacing (5); h->setMargin (3); all->addWidget (h); // library and component choice QVGroupBox * LibGroup = new QVGroupBox (tr("Component Selection"), h); Library = new QComboBox (LibGroup); connect(Library, SIGNAL(activated(int)), SLOT(slotSelectLibrary(int))); CompList = new QListBox(LibGroup); connect(CompList, SIGNAL(highlighted(QListBoxItem*)), SLOT(slotShowComponent(QListBoxItem*))); QHBox * h1 = new QHBox (LibGroup); QPushButton * SearchButton = new QPushButton (tr("Search..."), h1); connect(SearchButton, SIGNAL(clicked()), SLOT(slotSearchComponent())); h1->setStretchFactor(new QWidget(h1), 5); // stretchable placeholder // component display QVGroupBox *CompGroup = new QVGroupBox (tr("Component"), h); CompDescr = new QTextEdit(CompGroup); CompDescr->setTextFormat(Qt::PlainText); CompDescr->setReadOnly(true); CompDescr->setWordWrap(QTextEdit::NoWrap); Symbol = new SymbolWidget (CompGroup); QHBox * h2 = new QHBox (CompGroup); QPushButton * CopyButton = new QPushButton (tr("Copy to clipboard"), h2); connect(CopyButton, SIGNAL(clicked()), SLOT(slotCopyToClipBoard())); QPushButton * ShowButton = new QPushButton (tr("Show Model"), h2); connect(ShowButton, SIGNAL(clicked()), SLOT(slotShowModel())); // ...................................................... putLibrariesIntoCombobox(); }
void TextEdit::setupFileActions() { QToolBar *tb = new QToolBar( this ); tb->setLabel( "File Actions" ); QPopupMenu *menu = new QPopupMenu( this ); menuBar()->insertItem( tr( "&File" ), menu ); QAction *a; a = new QAction( QPixmap::fromMimeSource( "filenew.xpm" ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" ); connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( QPixmap::fromMimeSource( "fileopen.xpm" ), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" ); connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); a->addTo( tb ); a->addTo( menu ); menu->insertSeparator(); a = new QAction( QPixmap::fromMimeSource( "filesave.xpm" ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" ); connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( tr( "Save &As..." ), 0, this, "fileSaveAs" ); connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) ); a->addTo( menu ); menu->insertSeparator(); a = new QAction( QPixmap::fromMimeSource( "fileprint.xpm" ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" ); connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) ); a->addTo( tb ); a->addTo( menu ); a = new QAction( tr( "&Close" ), 0, this, "fileClose" ); connect( a, SIGNAL( activated() ), this, SLOT( fileClose() ) ); a->addTo( menu ); a = new QAction( tr( "E&xit" ), 0, this, "fileExit" ); connect( a, SIGNAL( activated() ), this, SLOT( fileExit() ) ); a->addTo( menu ); }
//Create a CGLWin widget CGLWin::CGLWin(void): QMainWindow( 0, "View3D", WDestructiveClose), m_pListViews(NULL) { int i; // Data members; CGLDrawParms tDraw; _drawParms = tDraw; m_nTimeDelay = 0; for (i=0; i<VIEW3D_MAX_OBJ_COUNT; i++) _pCia3dObjs[i] = NULL; // setup printer m_pPrinter = new QPrinter; // GUI members, create a toolbar; m_pToolBar = _createToolBar(); // populate a menu with all actions m_pMenuBar = menuBar(); assert(m_pMenuBar!=NULL); //====================File options ========================== { QPopupMenu * file = new QPopupMenu( this ); menuBar()->insertItem( "&File ", file ); _fileNewAction->addTo( file ); _fileOpenAction->addTo( file ); _fileSaveAction->addTo( file ); file->insertSeparator(); file->insertItem( "Open Background", this, SLOT(openBackgroundImage()), NULL); file->insertItem( "Load Camera", this, SLOT(loadCamera()), NULL); file->insertItem( "Save Camera", this, SLOT(saveCamera()), NULL); file->insertSeparator(); //=========================== file->insertItem( "Export Povray", this, SLOT(exportPovray()), NULL); file->insertItem( "Export STL", this, SLOT(saveSTLFile()), NULL); file->insertItem( "Export TXT", this, SLOT(saveTXTFile()), NULL); file->insertItem( "Export EPS", this, SLOT(exportEps()), NULL); file->insertSeparator(); //=========================== _filePrintAction->addTo( file ); file->insertSeparator(); //=========================== file->insertItem( "E&xit", qApp, SLOT(closeAllWindows()), NULL); } //================ Tools Options ================================ { QPopupMenu * pMenuTools = new QPopupMenu( this ); menuBar()->insertItem( "&Tools", pMenuTools ); pMenuTools->insertItem( "Show Entire Scene", this, SLOT(show_entirescene())); pMenuTools->insertItem( "Dupe Current Object", this, SLOT(dupe_currentobj())); pMenuTools->insertItem( "Dupe Current Object N", this, SLOT(dupe_currentobjN())); {// Animation options pMenuTools->insertSeparator(); //======================= QPopupMenu * pAnimOption = new QPopupMenu( this ); pMenuTools->insertItem( "&Prepare Animation", pAnimOption); pAnimOption->insertItem( "Setup", this, SLOT(create_animation())); QAction* startAction = new QAction(QPixmap(play_xpm), "&Start Animation", Qt::Key_F10, this); connect(startAction, SIGNAL(activated()), this, SLOT(startAnimation())); startAction->addTo( pAnimOption ); pAnimOption->insertItem( "Stop Animation", this, SLOT(stopAnimation()), Qt::Key_F11); pAnimOption->insertItem( "Change Delay Time", this, SLOT(editDelayTime())); {//toggle fast draw mode m_pActRepeatPlay = new QAction("Repeat", CTRL+Key_T, this); connect(m_pActRepeatPlay, SIGNAL(activated()), this, SLOT(toggleRepeatPlay())); m_pActRepeatPlay->setToggleAction(true); m_pActRepeatPlay->setOn(false); m_pActRepeatPlay->addTo( pAnimOption ); } } pMenuTools->insertSeparator(); //======================= {// Stereo options QPopupMenu * pStereoOption = new QPopupMenu( this ); pMenuTools->insertItem( "&Stereo", pStereoOption); QAction* m_pActToggleStereo = new QAction("Stereo Mode", Qt::Key_F12, this); connect(m_pActToggleStereo, SIGNAL(activated()), this, SLOT(toggleStereo())); m_pActToggleStereo->setToggleAction(true); m_pActToggleStereo->setOn(false); m_pActToggleStereo->addTo( pStereoOption ); pStereoOption->insertItem( "Increase Eye Distance", this, SLOT(incEyeDistance()), Qt::Key_Plus); pStereoOption->insertItem( "Decrease Eye Distance", this, SLOT(decEyeDistance()), Qt::Key_Minus); } //pMenuTools->insertItem( "Rotation Axis", this, SLOT(InputRotationAxis()), NULL); //pMenuTools->insertItem( "Mirror Plane", this, SLOT(InputMirrorPlane()), NULL); //pMenuTools->insertSeparator(); //pMenuTools->insertItem( "Vector Hidden Line Removal", this, SLOT(hidden_line()), CTRL+Key_H); //pMenuTools->insertSeparator(); //======================= pMenuTools->insertSeparator(); //======================= pMenuTools->insertItem( "Set Mirror Plane", this, SLOT(InputMirrorPlane())); pMenuTools->insertItem( "Set Rotation Axis", this, SLOT(InputRotationAxis())); } //================ Rendering options ================================ { QPopupMenu * pMenuOption = new QPopupMenu( this ); menuBar()->insertItem( "&Options", pMenuOption ); pMenuOption->insertItem( "Global Setting", this, SLOT(OptionGlobalSetting())); pMenuOption->insertItem( "Surface Rendering", this, SLOT(OptionRendering())); pMenuOption->insertItem( "Volume Rendering", this, SLOT(OptionVolumeRendering())); pMenuOption->insertSeparator(); //======================= { QPopupMenu * pPickOption = new QPopupMenu( this ); pMenuOption->insertItem( "&Picking Types", pPickOption); pPickOption->insertItem( "Pick an Object", this, SLOT(set_obj_picking())); pPickOption->insertItem( "Pick a Polygon", this, SLOT(set_face_picking())); pPickOption->insertItem( "Pick a Line", this, SLOT(set_line_picking())); } QAction* act_mirroring = new QAction("Mirroring", 0, this); connect( act_mirroring, SIGNAL(activated()), this, SLOT(OptionMirroring())); act_mirroring->setToggleAction(true); act_mirroring->setOn(false); act_mirroring->addTo( pMenuOption ); m_pMirroringAction = act_mirroring; QPopupMenu * pRotOption = new QPopupMenu( this ); pMenuOption->insertItem( "&Rotation Types", pRotOption); QAction* act_rot0obj = new QAction("Rotate 90 Degree", 0, this); connect( act_rot0obj, SIGNAL(activated()), this, SLOT(OptionRotate90())); act_rot0obj->addTo( pRotOption ); QAction* act_rot1obj = new QAction("Rotate 180 Degree", 0, this); connect( act_rot1obj, SIGNAL(activated()), this, SLOT(OptionRotate180())); act_rot1obj->addTo( pRotOption ); QAction* act_rot2obj = new QAction("Rotate 270 Degree", 0, this); connect( act_rot2obj, SIGNAL(activated()), this, SLOT(OptionRotate270())); act_rot2obj->addTo( pRotOption ); m_pRot90Action = act_rot0obj; m_pRot180Action = act_rot1obj; m_pRot270Action = act_rot2obj; m_pRot90Action->setToggleAction(true); m_pRot90Action->setOn(false); m_pRot180Action->setToggleAction(true); m_pRot180Action->setOn(false); m_pRot270Action->setToggleAction(true); m_pRot270Action->setOn(false); //show background image buttion QAction* act_showbgimg = new QAction("Background Image", 0, this); connect( act_showbgimg, SIGNAL(activated()), this, SLOT(ShowBackgroundImage())); act_showbgimg->setToggleAction(true); act_showbgimg->setOn(false); act_showbgimg->addTo( pMenuOption ); m_pBGImageAction = act_showbgimg; //show floor plane buttion QAction* act_showfloor = new QAction(QString::fromLocal8Bit("Floor Plane"), 0, this); connect( act_showfloor, SIGNAL(activated()), this, SLOT(ShowFloor())); act_showfloor->setToggleAction(true); act_showfloor->setOn(false); act_showfloor->addTo( pMenuOption ); m_pFloorAction = act_showfloor; {//Toggle fast draw mode m_pActFastDraw = new QAction("Fast Drawing", 0, this); connect(m_pActFastDraw, SIGNAL(activated()), this, SLOT(toggleFastDraw())); m_pActFastDraw->setToggleAction(true); m_pActFastDraw->setOn(false); m_pActFastDraw->addTo( pMenuOption ); } } //========change opengl window size ========================== { QPopupMenu * pMenuGLWinsize = new QPopupMenu( this ); menuBar()->insertItem( "&Window", pMenuGLWinsize ); pMenuGLWinsize->insertItem( "320x200", this, SLOT(setGLWinSize320x200()), CTRL+Qt::Key_3); pMenuGLWinsize->insertItem( "400x400", this, SLOT(setGLWinSize400x400()), CTRL+Qt::Key_4); pMenuGLWinsize->insertItem( "500x400", this, SLOT(setGLWinSize500x400()), CTRL+Qt::Key_5); pMenuGLWinsize->insertItem( "500x500", this, SLOT(setGLWinSize500x500()), CTRL+Qt::Key_2 ); pMenuGLWinsize->insertItem( "640x480", this, SLOT(setGLWinSize640x480()), CTRL+Qt::Key_6); pMenuGLWinsize->insertItem( "800x600", this, SLOT(setGLWinSize800x600()), CTRL+Qt::Key_8); pMenuGLWinsize->insertItem( "1024x768", this, SLOT(setGLWinSize1024x768()), CTRL+Qt::Key_1); pMenuGLWinsize->insertSeparator(); pMenuGLWinsize->insertItem( "Swap Width/Height", this, SLOT(swapWidthHeight()), CTRL+Key_W); pMenuGLWinsize->insertItem( "Input Width/Height", this, SLOT(inputWidthHeight()), CTRL+Key_I); } /* { QPopupMenu * pPopMenu = new QPopupMenu( this ); menuBar()->insertItem( "&My Research", pPopMenu ); pPopMenu->insertItem( "Bar Recons", this, SLOT(detail_recon_bar())); pPopMenu->insertItem( "Vase Recons", this, SLOT(detail_recon_vase())); pPopMenu->insertSeparator(); pPopMenu->insertItem( "Letter Size Plate", this, SLOT(detail_recon_a4plate())); pPopMenu->insertSeparator(); pPopMenu->insertItem( "Detail Recon Dialog", this, SLOT(detail_recon_anyobj())); } */ //================ end Rendering options ================================ QGLFormat format; format.setStereo( true ); m_pGLUIWin = new Viewer(format, this, "Viewer3D"); assert(m_pGLUIWin!=NULL); statusBar()->setFixedHeight( fontMetrics().height() + 6 ); statusBar()->message( "Viewer ready", 3000 ); setCentralWidget(m_pGLUIWin); m_pGLUIWin->setDrawingData(&_drawParms); m_pGLUIWin->m_SceneGraph.hookObject(m_pGLUIWin); m_pGLUIWin->m_SceneGraph.hookGLWindow(m_pGLUIWin); //================ dock window================== QString appDir; m_pFemBar=_createDockWidgetBar(this, appDir); }
ApplicationWindow::ApplicationWindow() : QMainWindow( 0, "example application main window", WDestructiveClose ) { #ifndef QT_NO_PRINTER printer = new QPrinter( QPrinter::HighResolution ); #endif QAction * fileNewAction; QAction * fileOpenAction; QAction * fileSaveAction, * fileSaveAsAction, * filePrintAction; QAction * fileCloseAction, * fileQuitAction; fileNewAction = new QAction( "&New", CTRL+Key_N, this, "new" ); connect( fileNewAction, SIGNAL( activated() ) , this, SLOT( newDoc() ) ); fileOpenAction = new QAction( QPixmap( fileopen ), "&Open...", CTRL+Key_O, this, "open" ); connect( fileOpenAction, SIGNAL( activated() ) , this, SLOT( choose() ) ); const char * fileOpenText = "<p><img source=\"fileopen\"> " "Click this button to open a <em>new file</em>. <br>" "You can also select the <b>Open</b> command " "from the <b>File</b> menu.</p>"; QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", fileOpenAction->iconSet().pixmap() ); fileOpenAction->setWhatsThis( fileOpenText ); fileSaveAction = new QAction( QPixmap( filesave ), "&Save", CTRL+Key_S, this, "save" ); connect( fileSaveAction, SIGNAL( activated() ) , this, SLOT( save() ) ); const char * fileSaveText = "<p>Click this button to save the file you " "are editing. You will be prompted for a file name.\n" "You can also select the <b>Save</b> command " "from the <b>File</b> menu.</p>"; fileSaveAction->setWhatsThis( fileSaveText ); fileSaveAsAction = new QAction( "Save File As", "Save &As...", 0, this, "save as" ); connect( fileSaveAsAction, SIGNAL( activated() ) , this, SLOT( saveAs() ) ); fileSaveAsAction->setWhatsThis( fileSaveText ); #ifndef QT_NO_PRINTER filePrintAction = new QAction( "Print File", QPixmap( fileprint ), "&Print...", CTRL+Key_P, this, "print" ); connect( filePrintAction, SIGNAL( activated() ) , this, SLOT( print() ) ); const char * filePrintText = "Click this button to print the file you " "are editing.\n You can also select the Print " "command from the File menu."; filePrintAction->setWhatsThis( filePrintText ); #else Q_UNUSED( filePrintAction ) #endif fileCloseAction = new QAction( "Close", "&Close", CTRL+Key_W, this, "close" ); connect( fileCloseAction, SIGNAL( activated() ) , this, SLOT( close() ) ); fileQuitAction = new QAction( "Quit", "&Quit", CTRL+Key_Q, this, "quit" ); connect( fileQuitAction, SIGNAL( activated() ) , qApp, SLOT( closeAllWindows() ) ); // populate a tool bar with some actions QToolBar * fileTools = new QToolBar( this, "file operations" ); fileTools->setLabel( "File Operations" ); fileOpenAction->addTo( fileTools ); fileSaveAction->addTo( fileTools ); #ifndef QT_NO_PRINTER filePrintAction->addTo( fileTools ); #endif (void)QWhatsThis::whatsThisButton( fileTools ); // populate a menu with all actions QPopupMenu * file = new QPopupMenu( this ); menuBar()->insertItem( "&File", file ); fileNewAction->addTo( file ); fileOpenAction->addTo( file ); fileSaveAction->addTo( file ); fileSaveAsAction->addTo( file ); #ifndef QT_NO_PRINTER file->insertSeparator(); filePrintAction->addTo( file ); #endif file->insertSeparator(); fileCloseAction->addTo( file ); fileQuitAction->addTo( file ); menuBar()->insertSeparator(); // add a help menu QPopupMenu * help = new QPopupMenu( this ); menuBar()->insertItem( "&Help", help ); help->insertItem( "&About", this, SLOT(about()), Key_F1 ); help->insertItem( "About &Qt", this, SLOT(aboutQt()) ); help->insertSeparator(); help->insertItem( "What's &This", this, SLOT(whatsThis()), SHIFT+Key_F1 ); // create and define the central widget e = new QTextEdit( this, "editor" ); e->setFocus(); setCentralWidget( e ); statusBar()->message( "Ready", 2000 ); resize( 450, 600 ); }
void QucsHelp::setupActions() { QToolBar *toolbar = new QToolBar(this,"main_toolbar"); this->addToolBar(toolbar); QMenuBar *bar = menuBar(); const QKeySequence ks = QKeySequence(); QAction *quitAction = new QAction(QIcon((":/bitmaps/quit.png")), tr("&Quit"), (const QKeySequence&)Qt::CTRL+Qt::Key_Q, this,""); QAction *backAction = new QAction(QIcon((":/bitmaps/back.png")), tr("&Back"), Qt::ALT+Qt::Key_Left, this,""); QAction *forwardAction = new QAction(QIcon((":/bitmaps/forward.png")), tr("&Forward"), Qt::ALT+Qt::Key_Right, this,""); QAction *homeAction = new QAction(QIcon((":/bitmaps/home.png")), tr("&Home"),Qt::CTRL+Qt::Key_H,this,""); previousAction = new QAction(QIcon((":/bitmaps/previous.png")),tr("&Previous"), ks, this,""); nextAction = new QAction(QIcon((":/bitmaps/next.png")), tr("&Next"), ks, this,""); viewBrowseDock = new QAction(tr("&Table of Contents"), 0, this,""); viewBrowseDock->setToggleAction(true); viewBrowseDock->setOn(true); viewBrowseDock->setStatusTip(tr("Enables/disables the table of contents")); viewBrowseDock->setWhatsThis(tr("Table of Contents\n\nEnables/disables the table of contents")); connect(quitAction,SIGNAL(activated()),qApp,SLOT(quit())); connect(backAction,SIGNAL(activated()),textBrowser,SLOT(backward())); connect(textBrowser,SIGNAL(backwardAvailable(bool)),backAction,SLOT(setEnabled(bool))); connect(forwardAction,SIGNAL(activated()),textBrowser,SLOT(forward())); connect(textBrowser,SIGNAL(forwardAvailable(bool)),forwardAction,SLOT(setEnabled(bool))); connect(homeAction,SIGNAL(activated()),textBrowser,SLOT(home())); connect(homeAction,SIGNAL(activated()),this,SLOT(gohome())); connect(textBrowser,SIGNAL(sourceChanged(const QUrl &)),this,SLOT(slotSourceChanged(const QUrl &))); connect(previousAction,SIGNAL(activated()),this,SLOT(previousLink())); connect(nextAction,SIGNAL(activated()),this,SLOT(nextLink())); connect(viewBrowseDock, SIGNAL(toggled(bool)), SLOT(slotToggleSidebar(bool))); backAction->addTo(toolbar); forwardAction->addTo(toolbar); toolbar->addSeparator(); homeAction->addTo(toolbar); previousAction->addTo(toolbar); nextAction->addTo(toolbar); toolbar->addSeparator(); quitAction->addTo(toolbar); QMenu *fileMenu = new QMenu(this); quitAction->addTo(fileMenu); QMenu *viewMenu = new QMenu(this); backAction->addTo(viewMenu); forwardAction->addTo(viewMenu); homeAction->addTo(viewMenu); previousAction->addTo(viewMenu); nextAction->addTo(viewMenu); viewMenu->insertSeparator(); viewBrowseDock->addTo(viewMenu); QMenu *helpMenu = new QMenu(this); helpMenu->insertItem(tr("&About Qt"),qApp,SLOT(aboutQt())); bar->insertItem(tr("&File"), fileMenu ); bar->insertItem(tr("&View"),viewMenu); bar->insertSeparator(); bar->insertItem(tr("&Help"),helpMenu); }
void MainWindow::initUI() { setToolBarsMovable( FALSE ); /* tool bar for the menu */ m_tool = new QToolBar( this ); m_tool->setHorizontalStretchable( TRUE ); m_bar = new QMenuBar( m_tool ); m_console = new QPopupMenu( this ); m_scripts = new QPopupMenu( this ); m_sessionsPop= new QPopupMenu( this ); m_scriptsPop = new QPopupMenu( this ); m_scrollbar = new QPopupMenu( this ); /* add a toolbar for icons */ m_icons = new QToolBar(this); /* * the settings action */ m_setProfiles = new QAction(tr("Configure Profiles"), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0); m_setProfiles->addTo( m_console ); connect( m_setProfiles, SIGNAL(activated() ), this, SLOT(slotConfigure() ) ); m_console->insertSeparator(); /* * new Action for new sessions */ QAction* newCon = new QAction(tr("New Profile"), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0); newCon->addTo( m_console ); connect( newCon, SIGNAL(activated() ), this, SLOT(slotNew() ) ); m_console->insertSeparator(); QAction *saveCon = new QAction( tr("Save Profile" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); saveCon->addTo( m_console ); connect( saveCon, SIGNAL(activated() ), this, SLOT(slotSaveSession() ) ); m_console->insertSeparator(); /* * connect action */ m_connect = new QAction( tr("Connect"), Opie::Core::OResource::loadPixmap("console/connected", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); m_connect->addTo( m_console ); connect(m_connect, SIGNAL(activated() ), this, SLOT(slotConnect() ) ); /* * disconnect action */ m_disconnect = new QAction( tr("Disconnect"), Opie::Core::OResource::loadPixmap("console/notconnected", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); m_disconnect->addTo( m_console ); connect(m_disconnect, SIGNAL(activated() ), this, SLOT(slotDisconnect() ) ); m_console->insertSeparator(); #ifndef EAST m_quickLaunch = new QAction( tr("QuickLaunch"), Opie::Core::OResource::loadPixmap("console/konsole_mini", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); m_quickLaunch->addTo( m_icons ); connect( m_quickLaunch, SIGNAL( activated() ), this, SLOT( slotQuickLaunch() ) ); #endif QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); m_transfer = new QAction( tr("Transfer file..."), Opie::Core::OResource::loadPixmap("pass", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); m_transfer->addTo( m_console ); connect(m_transfer, SIGNAL(activated() ), this, SLOT(slotTransfer() ) ); /* * immediate change of line wrap policy */ m_isWrapped = true; m_wrap = new QAction( tr("Line wrap"), Opie::Core::OResource::loadPixmap( "linewrap", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0, true ); m_wrap->addTo( m_console ); m_wrap->setOn( true ); connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); /* * fullscreen */ m_isFullscreen = false; m_fullscreen = new QAction( tr("Full screen"), Opie::Core::OResource::loadPixmap( "fullscreen", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); m_fullscreen->addTo( m_console ); connect( m_fullscreen, SIGNAL( activated() ), this, SLOT( slotFullscreen() ) ); /* * scrollbar */ sm_none = m_scrollbar->insertItem(tr( "None" )); sm_left = m_scrollbar->insertItem(tr( "Left" )); sm_right = m_scrollbar->insertItem(tr( "Right" )); m_console->insertItem(tr("Scrollbar"), m_scrollbar, -1, 0); connect( m_scrollbar, SIGNAL(activated(int)), this, SLOT(slotScrollbarSelected(int))); m_console->insertSeparator(); m_recordLog = new QAction(); m_recordLog->setText( tr("Start log") ); m_recordLog->addTo( m_console ); connect(m_recordLog, SIGNAL(activated() ), this, SLOT( slotSaveLog() ) ); m_recordingLog = false; QAction *a = new QAction(); a->setText( tr("Save history") ); a->addTo( m_console ); connect(a, SIGNAL(activated() ), this, SLOT(slotSaveHistory() ) ); /* * terminate action */ m_terminate = new QAction(); m_terminate->setText( tr("Terminate") ); m_terminate->addTo( m_console ); connect(m_terminate, SIGNAL(activated() ), this, SLOT(slotTerminate() ) ); m_closewindow = new QAction(); m_closewindow->setText( tr("Close Window") ); m_closewindow->addTo( m_console ); connect( m_closewindow, SIGNAL(activated() ), this, SLOT(slotClose() ) ); /* * script actions */ m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); m_recordScript->addTo(m_scripts); connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); m_saveScript->addTo(m_scripts); connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); /* * action that open/closes the keyboard */ m_openKeys = new QAction (tr("Open Keyboard..."), Opie::Core::OResource::loadPixmap( "console/keys/keyboard_icon", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0); m_openKeys->setToggleAction(true); connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); /* insert the submenu */ m_console->insertItem(tr("New from Profile"), m_sessionsPop, -1, 0); /* insert the connection menu */ m_bar->insertItem( tr("Connection"), m_console ); /* the scripts menu */ #ifdef EAST Opie::Core::OConfig cfg("opie-console"); cfg.setGroup("10east"); if( !cfg.readEntry("scripthide",0) ) { m_bar->insertItem( tr("Scripts"), m_scripts ); } #endif /* and the keyboard */ m_keyBar = new QToolBar(this); addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); m_keyBar->setHorizontalStretchable( TRUE ); m_keyBar->hide(); m_kb = new FunctionKeyboard(m_keyBar); connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); a = new QAction(tr("Copy"), Opie::Core::OResource::loadPixmap("copy", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); //a->addTo( m_icons ); connect( a, SIGNAL(activated() ), this, SLOT(slotCopy() ) ); QAction *paste = new QAction(tr("Paste"), Opie::Core::OResource::loadPixmap("paste", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( paste, SIGNAL(activated() ), this, SLOT(slotPaste() ) ); newCon->addTo( m_icons ); //m_setProfiles->addTo( m_icons ); paste->addTo( m_icons ); m_openKeys->addTo(m_icons); m_fullscreen->addTo( m_icons ); m_connect->setEnabled( false ); m_disconnect->setEnabled( false ); m_terminate->setEnabled( false ); m_transfer->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); m_recordScript->setEnabled( false ); m_saveScript->setEnabled( false ); m_fullscreen->setEnabled( false ); m_closewindow->setEnabled( false ); m_wrap->setEnabled( false ); /* * connect to the menu activation */ connect( m_sessionsPop, SIGNAL(activated(int) ), this, SLOT(slotProfile(int) ) ); m_consoleWindow = new TabWidget( this, "blah"); connect(m_consoleWindow, SIGNAL(activated(Session*) ), this, SLOT(slotSessionChanged(Session*) ) ); connect(m_consoleWindow, SIGNAL(sessionClosed(Session*) ), this, SLOT(slotSessionClosed(Session*) ) ); setCentralWidget( m_consoleWindow ); slotQuickLaunch(); }
TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) { shutDown=false; nextUnnamed=0; currentView=0; viewCount=0; setCaption(tr("TinyKATE")); KGlobal::setAppName("TinyKATE"); QMenuBar *mb = new QMenuBar( this ); mb->setMargin( 0 ); tabwidget=new OTabWidget(this); setCentralWidget(tabwidget); connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*))); //FILE ACTIONS QPopupMenu *popup = new QPopupMenu( this ); // Action for creating a new document QAction *a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->addTo( popup ); connect(a, SIGNAL(activated()), this, SLOT(slotNew())); // Action for opening an exisiting document a = new QAction( tr( "Open" ), Opie::Core::OResource::loadPixmap( "fileopen", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); // Action for saving document a = new QAction( tr( "Save" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSave())); // Action for saving document to a new name a = new QAction( tr( "Save As" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); // Action for closing the currently active document a = new QAction( tr( "Close" ), Opie::Core::OResource::loadPixmap( "quit_icon", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotClose())); mb->insertItem(tr("File"),popup); //EDIT ACTIONS popup = new QPopupMenu( this ); bool useBigIcon = qApp->desktop()->size().width() > 330; // Action for cutting text editCut = new QToolButton( 0 ); editCut->setUsesBigPixmap( useBigIcon ); editCut->setAutoRaise( true ); editCut->setIconSet( Opie::Core::OResource::loadPixmap( "cut", Opie::Core::OResource::SmallIcon ) ); // Action for Copying text editCopy = new QToolButton( 0 ); editCopy->setUsesBigPixmap( useBigIcon ); editCopy->setAutoRaise( true ); editCopy->setIconSet( Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ) ); // Action for pasting text editPaste = new QToolButton( 0 ); editPaste->setUsesBigPixmap( useBigIcon ); editPaste->setAutoRaise( true ); editPaste->setIconSet( Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ) ); // Action for finding text editFind = new QAction( tr( "Find..." ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); editFind->addTo(popup); // Action for replacing text editReplace = new QAction( tr( "Replace..." ), QString::null, 0, this, 0 ); editReplace->addTo(popup); // Action for going to a specific line editGotoLine = new QAction( tr( "Goto Line..." ), QString::null, 0, this, 0 ); editGotoLine->addTo(popup); // Action for undo editUndo = new QToolButton( 0 ); editUndo->setUsesBigPixmap( useBigIcon ); editUndo->setAutoRaise( true ); editUndo->setIconSet( Opie::Core::OResource::loadPixmap( "undo", Opie::Core::OResource::SmallIcon ) ); // Action for redo editRedo = new QToolButton( 0 ); editRedo->setUsesBigPixmap( useBigIcon ); editRedo->setAutoRaise( true ); editRedo->setIconSet( Opie::Core::OResource::loadPixmap( "redo", Opie::Core::OResource::SmallIcon ) ); mb->insertItem(tr("Edit"),popup); //VIEW ACITONS popup = new QPopupMenu( this ); viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); viewIncFontSizes->addTo( popup ); viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); viewDecFontSizes->addTo( popup ); mb->insertItem(tr("View"),popup); popup = new QPopupMenu( this ); mb->insertItem(tr("Utils"),popup); mb->insertItem( editCut ); mb->insertItem( editCopy ); mb->insertItem( editPaste ); mb->insertItem( editUndo ); mb->insertItem( editRedo ); //Highlight management hlmenu=new QPopupMenu(this); HlManager *hlm=HlManager::self(); for (int i=0;i<hlm->highlights();i++) { hlmenu->insertItem(hlm->hlName(i),i); } popup->insertItem(tr("Highlighting"),hlmenu); utilSettings = new QAction( tr( "Settings" ), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); utilSettings->addTo( popup); if( qApp->argc() > 1) open(qApp->argv()[1]); else slotNew(); }
/************************************************************** * This is the main method which update the GUI * according to the plugin's data * @param pluginID the id of the plugin * @param type the type of the plugin * @param infos plugin informations * *************************************************************/ void MainWindow::updateGUIWithPluginData(const QString & pluginID, PluginType type, std::vector<MenuAddOn *> & infos) { std::cout << "Dans updateGUIWithPluginData "<< std::endl << "taille d infos transmis " << infos.size() << std::endl; const int nbArgs = infos.size(); //TODO : use Iterator instead of direct access for(int i=0; i<nbArgs; i++) { //First we retrieve the MenuAddOn MenuAddOn* infoMenu = infos[i]; QString emplacement(infoMenu->emplacement->c_str()); qDebug("emplacement = %s ", emplacement.latin1()); // We split the string to learn where the plugin wants // to be connected with the GUI components QStringList decomposition = QStringList::split(INPUT_COMPONENT_SEPARATOR, emplacement); QString component = decomposition[0]; qDebug("Compoment = %s ", component.latin1()); //Which component ? //TODO: To IMPROVE the test if (component == "Menu") { QPopupMenu* aMenu; for(int j=1; j<decomposition.size()-1; j++) { aMenu = _menus.find(decomposition[j]); //Do we already have built this menu if(!aMenu) { QPopupMenu * aMenu = new QPopupMenu( this ); _menus.insert(decomposition[j], aMenu); if (j == 1) { menuBar()->insertItem( decomposition[j], _menus[decomposition[j]]); } else { QPopupMenu* previousMenu = _menus.find(decomposition[j-1]); previousMenu->insertItem( decomposition[j], aMenu); } } } QAction* aAction = new QAction(this); aAction->setText ( decomposition[decomposition.size() -1] ); aAction->setMenuText( decomposition[decomposition.size() -1] ); if( infoMenu->texte != NULL ) { aAction->setAccel( QKeySequence( QString(infoMenu->texte->c_str()) ) ); } if( infoMenu->image != NULL ) { aAction->setIconSet( QIconSet( QPixmap ( QString(IMAGES_DIR).append(infoMenu->image->c_str()) ) ) ); aAction->addTo( _toolBar); } QSignalMapper* _signalMapper = new QSignalMapper(this); _signalMapper->setMapping(aAction, pluginID); connect( aAction, SIGNAL(activated() ), _signalMapper, SLOT(map()) ); switch(infoMenu->typeAppel) { case LOAD_CALL: { connect( _signalMapper, SIGNAL(mapped(const QString &) ), _pluginManager, SLOT(executeLoad(const QString &)) ); break; } case SAVE_CALL: { connect( _signalMapper, SIGNAL(mapped(const QString &) ), _pluginManager, SLOT(executeSave(const QString &)) ); break; } case ACTION_CALL: { break; } default: break; } aAction->addTo(_menus[decomposition[decomposition.size() - 2]]); } // else if (component == "Tool") // { // //TODO : to implement it !!! // } }//end of for loop }
/************************************************************** * * add the static menu bars * *************************************************************/ void MainWindow::addStaticMenuBarContent() { qDebug("Beginning addStaticMenuBarContent"); //File QPopupMenu* fileMenu = _menus.find(FILE_KEY); if(!fileMenu) { std::cout << "PROUT" << std::endl; QPopupMenu * file = new QPopupMenu( this ); _menus.insert(FILE_KEY, file); menuBar()->insertItem( FILE_KEY, _menus[FILE_KEY]); } _menus[FILE_KEY]->insertSeparator(); //Cylinder Menu QPopupMenu* cylinderMenu = _menus.find(CYLINDER_KEY); if (!cylinderMenu) { QPopupMenu * help = new QPopupMenu( this ); _menus.insert(CYLINDER_KEY, help); menuBar()->insertItem( CYLINDER_KEY, _menus[CYLINDER_KEY]); } QAction* generateCylinderAction = new QAction("generate", QIconSet( QPixmap(IMAGES_DIR + CYLINDER_IMAGE) ), "&Generate", CTRL+Key_G, this); connect(generateCylinderAction, SIGNAL( activated() ), this, SLOT( generateCylinder() ) ); generateCylinderAction->addTo(_menus[CYLINDER_KEY]); _toolBar->addSeparator(); generateCylinderAction->addTo(_toolBar); QAction* quitAction = new QAction("quit", QIconSet( QPixmap(IMAGES_DIR + QUIT_IMAGE) ), "&Quit", CTRL+Key_Q, this); connect(quitAction, SIGNAL( activated() ), qApp, SLOT( quit() ) ); quitAction->addTo(_menus[FILE_KEY]); _toolBar->addSeparator(); quitAction->addTo(_toolBar); //Tools Menu QPopupMenu* toolsMenu = _menus.find(TOOLS_KEY); if (!toolsMenu) { QPopupMenu * tools = new QPopupMenu( this ); _menus.insert(TOOLS_KEY, tools); menuBar()->insertItem( TOOLS_KEY, _menus[TOOLS_KEY]); } //_menus[TOOLS_KEY]->insertItem("Validate Solid", this, SLOT( validation() ) ); //Help Menu with about QPopupMenu* helpMenu = _menus.find(HELP_KEY); if (!helpMenu) { QPopupMenu * help = new QPopupMenu( this ); _menus.insert(HELP_KEY, help); menuBar()->insertItem( HELP_KEY, _menus[HELP_KEY]); } _menus[HELP_KEY]->insertItem( "Getting &Started", this, SLOT(manual())); _menus[HELP_KEY]->insertItem( "&About", this, SLOT(about())); }
TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ) { doc = 0; edited=false; setToolBarsMovable( false ); connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); channel = new QCopChannel( "QPE/Application/textedit", this ); connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); setIcon( Opie::Core::OResource::loadPixmap( "textedit/TextEditor", Opie::Core::OResource::SmallIcon ) ); QToolBar *bar = new QToolBar( this ); bar->setHorizontalStretchable( true ); menu = bar; QMenuBar *mb = new QMenuBar( bar ); QPopupMenu *file = new QPopupMenu( this ); QPopupMenu *edit = new QPopupMenu( this ); QPopupMenu *advancedMenu = new QPopupMenu(this); font = new QPopupMenu( this ); bar = new QToolBar( this ); editBar = bar; QAction *a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); // a->addTo( bar ); a->addTo( file ); a = new QAction( tr( "Open" ), Opie::Core::OResource::loadPixmap( "fileopen", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); a->addTo( bar ); a->addTo( file ); a = new QAction( tr( "Save" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); file->insertSeparator(); a->addTo( bar ); a->addTo( file ); a = new QAction( tr( "Save As" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); a->addTo( file ); file->insertSeparator(); deleteAction = new QAction( tr( "Delete" ), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( deleteAction, SIGNAL( activated() ), this, SLOT( fileDelete() ) ); deleteAction->addTo( file ); undoAction = new QAction( tr( "Undo" ), Opie::Core::OResource::loadPixmap( "undo", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); undoAction->addTo( edit ); undoAction->setEnabled( false ); redoAction = new QAction( tr( "Redo" ), Opie::Core::OResource::loadPixmap( "redo", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); redoAction->addTo( edit ); redoAction->setEnabled( false ); edit->insertSeparator(); a = new QAction( tr( "Cut" ), Opie::Core::OResource::loadPixmap( "cut", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); a->addTo( editBar ); a->addTo( edit ); a = new QAction( tr( "Copy" ), Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); a->addTo( editBar ); a->addTo( edit ); a = new QAction( tr( "Paste" ), Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); a->addTo( editBar ); a->addTo( edit ); #ifndef QT_NO_CLIPBOARD a = new QAction( tr( "Insert Time and Date" ), Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); a->addTo( edit ); #endif a = new QAction( tr( "Goto Line..." ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( gotoLine() ) ); edit->insertSeparator(); a->addTo( edit ); a = new QAction( tr( "Find..." ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); a->addTo( bar ); a->addTo( edit ); zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); zin->addTo( font ); zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); zout->addTo( font ); font->insertSeparator(); font->insertItem(tr("Font"), this, SLOT(changeFont()) ); font->insertSeparator(); font->insertItem(tr("Advanced Features"), advancedMenu); QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 ); connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) ); wa->setToggleAction(true); wa->addTo( advancedMenu); desktopAction = new QAction( tr("Always open linked file"), QString::null, 0, this, 0 ); connect( desktopAction, SIGNAL( toggled(bool) ), this, SLOT( doDesktop(bool) ) ); desktopAction->setToggleAction(true); desktopAction->addTo( advancedMenu); filePermAction = new QAction( tr("File Permissions"), QString::null, 0, this, 0 ); connect( filePermAction, SIGNAL( toggled(bool) ), this, SLOT( doFilePerms(bool) ) ); filePermAction->setToggleAction(true); filePermAction->addTo( advancedMenu); nAutoSave = new QAction( tr("Auto Save 5 min."), QString::null, 0, this, 0 ); connect( nAutoSave, SIGNAL( toggled(bool) ), this, SLOT( doTimer(bool) ) ); nAutoSave->setToggleAction(true); nAutoSave->addTo( advancedMenu); mb->insertItem( tr( "File" ), file ); mb->insertItem( tr( "Edit" ), edit ); mb->insertItem( tr( "View" ), font ); searchBar = new QToolBar(this); addToolBar( searchBar, "Search", QMainWindow::Top, true ); searchBar->setHorizontalStretchable( true ); searchEdit = new QLineEdit( searchBar, "searchEdit" ); searchBar->setStretchableWidget( searchEdit ); connect( searchEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( search() ) ); a = new QAction( tr( "Find Next" ), Opie::Core::OResource::loadPixmap( "next", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); a->addTo( searchBar ); a->addTo( edit ); a = new QAction( tr( "Close Find" ), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); a->addTo( searchBar ); searchBar->hide(); editor = new QpeEditor( this ); setCentralWidget( editor ); editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); connect( editor, SIGNAL( undoAvailable(bool) ), undoAction, SLOT( setEnabled(bool) ) ); connect( editor, SIGNAL( redoAvailable(bool) ), redoAction, SLOT( setEnabled(bool) ) ); connect( undoAction, SIGNAL( activated() ), editor, SLOT( undo() ) ); connect( redoAction, SIGNAL( activated() ), editor, SLOT( redo() ) ); QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold); Config cfg("TextEdit"); cfg. setGroup ( "Font" ); QFont defaultFont = editor-> font ( ); QString family = cfg. readEntry ( "Family", defaultFont. family ( )); int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( )); int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( )); bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( )); defaultFont = QFont ( family, size, weight, italic ); editor-> setFont ( defaultFont ); cfg.setGroup ( "View" ); openDesktop = cfg.readBoolEntry ( "OpenDesktop", true ); filePerms = cfg.readBoolEntry ( "FilePermissions", false ); featureAutoSave = cfg.readBoolEntry( "autosave", false); if(openDesktop) desktopAction->setOn( true ); if(filePerms) filePermAction->setOn( true ); if(featureAutoSave) nAutoSave->setOn(true); // { // doTimer(true); // } bool wrap = cfg. readBoolEntry ( "Wrap", true ); wa-> setOn ( wrap ); setWordWrap ( wrap ); ///////////////// if( qApp->argc() > 1) { currentFileName=qApp->argv()[1]; QFileInfo fi(currentFileName); if(fi.baseName().left(1) == "") { openDotFile(currentFileName); } else { openFile(currentFileName); } } else { newFile(); } }