SchemaDrawer::SchemaDrawer(): QMainWindow( 0 ) { ActionIconProvider actionIconProvider; // SchemaDrawer QMenu* schemaDrawerMenu = menuBar()->addMenu( "SchemaDrawer" ); schemaDrawerMenu->addAction( actionIconProvider.getIconForAction("help"), "Help Me!", this, SLOT(helpMe()) ); schemaDrawerMenu->addSeparator(); schemaDrawerMenu->addAction( actionIconProvider.getIconForAction("exit"), "Exit", this, SLOT(close()) ); // Schema QMenu* schemaMenu = menuBar()->addMenu( "Schema" ); schemaMenu->addAction( actionIconProvider.getIconForAction("add"), "Schema", this, SLOT(newSchema()) ); schemaMenu->addAction( actionIconProvider.getIconForAction("save"), "Save", this, SLOT(saveSchema()) ); schemaMenu->addAction( actionIconProvider.getIconForAction("open"), "Open", this, SLOT(openSchema()) ); // preparing the workspace _workspace = new QWorkspace(); setCentralWidget( _workspace ); // cosmetics Styling styling( *this ); styling.loadOnScreenPosition(); setWindowTitle( "Schema Drawer" ); }
KPrMSPresentationSetup::KPrMSPresentationSetup( KPrDocument *_doc, KPrView *_view ) : QDialog( 0, "", false ), msPres( _doc, _view ) { doc = _doc; view = _view; QLabel *helptext = new QLabel( this ); helptext->setAlignment( Qt::WordBreak | Qt::AlignTop| Qt::AlignLeft ); helptext->setText( i18n( "Please enter the directory where the memory stick " "presentation should be saved. Please also enter a " "title for the slideshow presentation. " ) ); QLabel *lable2 = new QLabel( i18n("Path:"), this ); lable2->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); path=new KURLRequester( this ); path->setMode( KFile::Directory); path->lineEdit()->setText(msPres.getPath()); lable2->setBuddy(path); QHBoxLayout *pathLayout = new QHBoxLayout; pathLayout->addWidget(lable2); pathLayout->addWidget(path); connect( path, SIGNAL( textChanged(const QString&) ), this, SLOT( slotChoosePath(const QString&) ) ); connect( path, SIGNAL( urlSelected( const QString&) ), this, SLOT( slotChoosePath(const QString&) ) ); QLabel *lable1 = new QLabel( i18n("Title:"), this, "lable1" ); lable1->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); // TODO - check if there is already a presentation with this title, and // add a number after it until there isn't. title = new KLineEdit( msPres.getTitle(), this ); lable1->setBuddy( title ); QHBoxLayout *titleLayout = new QHBoxLayout; titleLayout->addWidget( lable1 ); titleLayout->addWidget( title ); QHBox *moreBox = new QHBox( this ); QPushButton *showColourButton = new QPushButton( i18n("&Set Colors"), moreBox ); showColourButton->setToggleButton( true ); connect( showColourButton, SIGNAL( toggled(bool) ), this, SLOT( showColourGroup(bool) ) ); QVBoxLayout *topLayout = new QVBoxLayout; topLayout->addWidget( helptext ); topLayout->addSpacing( 10 ); topLayout->addLayout( pathLayout ); topLayout->addLayout( titleLayout ); topLayout->addWidget( moreBox ); colourGroup = new QGroupBox( 2, Qt::Vertical, i18n("Preliminary Slides"), this , "colourBox" ); QWhatsThis::add( colourGroup, i18n( "This section allows you to set the colors for " "the preliminary slides; it does not affect the " "presentation in any way, and it is normal to " "leave these set to the default.") ); QHBox *textColourLayout = new QHBox( colourGroup ); QLabel *lable3 = new QLabel( i18n("Text color:"), textColourLayout ); lable3->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); textColour = new KColorButton( msPres.getTextColour(), textColourLayout ); lable3->setBuddy( textColour ); QHBox *backgroundColourLayout = new QHBox( colourGroup ); QLabel *lable4 = new QLabel( i18n("Background color:"), backgroundColourLayout ); lable4->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); backColour = new KColorButton( msPres.getBackColour(), backgroundColourLayout ); lable4->setBuddy( backColour ); colourGroup->setHidden( true ); QHBox *buttonLayout = new QHBox( this ); KPushButton *helpButton = new KPushButton( KStdGuiItem::help(), buttonLayout ); QWhatsThis::add( helpButton, i18n( "Selecting this button will take you to the KPresenter " "documentation that provides more information on how " "to use the Memory Stick export function. ") ); KPushButton *createButton = new KPushButton( KStdGuiItem::ok(), buttonLayout ); QWhatsThis::add( createButton, i18n( "Selecting this button will proceed to generating " "the presentation in the special Sony format." ) ); KPushButton *cancelButton = new KPushButton( KStdGuiItem::cancel(), buttonLayout ); QWhatsThis::add( cancelButton, i18n( "Selecting this button will cancel out of the " "generation of the presentation, and return " "to the normal KPresenter view. No files will " "be affected." ) ); mainLayout = new QVBoxLayout( this ); mainLayout->setMargin(11); mainLayout->setSpacing(6); mainLayout->addLayout(topLayout); mainLayout->addSpacing( 10 ); mainLayout->addWidget(colourGroup); mainLayout->addWidget(buttonLayout); mainLayout->setResizeMode( QLayout::Fixed ); mainLayout->setGeometry( QRect( 0, 0, 300, 220 ) ); connect( helpButton, SIGNAL( clicked() ), this, SLOT ( helpMe() ) ); connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( createButton, SIGNAL( clicked() ), this, SLOT( finish() ) ); }
static void parseCommandline( int argc, char* argv[], int* fail_hard, int* old_mode, int* cpus ) { char *s, *ptr = strrchr( argv[0], '/' ); int option, tmp; /* exit code 0 is always good, just in case */ memset( success, 0, sizeof(success) ); success[0] = 1; *cpus = 1; if ( ptr == NULL ) ptr = argv[0]; else ptr++; application = ptr; /* default progress report location from environment variable */ if ( (s = getenv("SEQEXEC_PROGRESS_REPORT")) != NULL ) { if ( (progress = open( s, O_WRONLY | O_APPEND | O_CREAT, 0666 )) == -1 ) { showerr( "%s: open progress %s: %d: %s\n", application, s, errno, strerror(errno) ); } } /* default parallelism from environment variable */ if ( (s = getenv("SEQEXEC_CPUS")) != NULL ) { if ( strcasecmp( s, "auto" ) == 0 ) *cpus = processors(); else *cpus = atoi(s); if ( *cpus < 0 ) *cpus = 1; } opterr = 0; while ( (option = getopt( argc, argv, "R:S:defhn:s:" )) != -1 ) { switch ( option ) { case 'R': if ( progress != -1 ) close(progress); if ( (progress = open( optarg, O_WRONLY | O_APPEND | O_CREAT, 0666 )) == -1 ) { showerr( "%s: open progress %s: %d: %s\n", application, optarg, errno, strerror(errno) ); } break; case 'S': tmp = atoi(optarg); if ( tmp > 0 && tmp < sizeof(success) ) success[tmp] = 1; else showerr( "%s: Ignoring unreasonable success code %d\n", application, tmp ); break; case 'd': debug++; break; case 'e': *old_mode = 1; *fail_hard = 0; break; case 'f': *fail_hard = 1; *old_mode = 0; break; case 'n': if ( strcasecmp( optarg, "auto" ) == 0 ) *cpus = processors(); else *cpus = atoi(optarg); if ( *cpus < 0 ) *cpus = 1; break; case 's': if ( freopen( optarg, "w", stdout ) == NULL ) { showerr( "%s: open status %s: %d: %s\n", application, optarg, errno, strerror(errno) ); exit(2); } break; case 'h': case '?': helpMe( ptr, 0 ); break; default: helpMe( ptr, 1 ); break; } } if ( (argc - optind) > 1 ) helpMe( ptr, 1 ); if ( argc != optind ) { if ( (freopen( argv[optind], "r", stdin )) == NULL ) { showerr( "%s: open input %s: %d: %s\n", application, argv[optind], errno, strerror(errno) ); exit(3); } } }