Esempio n. 1
0
HelpWindow::HelpWindow( const QString& home_, const QString& _path,
			QWidget* parent, const char *name )
    : QMainWindow( parent, name, WDestructiveClose ),
      pathCombo( 0 ), selectedURL()
{
    readHistory();
    readBookmarks();

    browser = new QTextBrowser( this );
    browser->mimeSourceFactory()->setFilePath( _path );
    browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    connect( browser, SIGNAL( textChanged() ),
	     this, SLOT( textChanged() ) );

    setCentralWidget( browser );

    if ( !home_.isEmpty() )
	browser->setSource( home_ );

    connect( browser, SIGNAL( highlighted( const QString&) ),
	     statusBar(), SLOT( message( const QString&)) );

    resize( 640,700 );

    QPopupMenu* file = new QPopupMenu( this );
    file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N );
    file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
    file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P );

    // The same three icons are used twice each.
    QIconSet icon_back( QPixmap("textdrawing/previous.png") );
    QIconSet icon_forward( QPixmap("textdrawing/next.png") );
    QIconSet icon_home( QPixmap("textdrawing/home.png") );

    QPopupMenu* go = new QPopupMenu( this );
    backwardId = go->insertItem( icon_back,
				 tr("&Backward"), browser, SLOT( backward() ),
				 ALT | Key_Left );
    forwardId = go->insertItem( icon_forward,
				tr("&Forward"), browser, SLOT( forward() ),
				ALT | Key_Right );
    go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );

    hist = new QPopupMenu( this );
    QStringList::Iterator it = history.begin();
    for ( ; it != history.end(); ++it )
	mHistory[ hist->insertItem( *it ) ] = *it;
    connect( hist, SIGNAL( activated( int ) ),
	     this, SLOT( histChosen( int ) ) );

    bookm = new QPopupMenu( this );
    bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
    bookm->insertSeparator();

    QStringList::Iterator it2 = bookmarks.begin();
    for ( ; it2 != bookmarks.end(); ++it2 )
	mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
    connect( bookm, SIGNAL( activated( int ) ),
	     this, SLOT( bookmChosen( int ) ) );

    menuBar()->insertItem( tr("&File"), file );
    menuBar()->insertItem( tr("&Go"), go );
    menuBar()->insertItem( tr( "History" ), hist );
    menuBar()->insertItem( tr( "Bookmarks" ), bookm );

    menuBar()->setItemEnabled( forwardId, FALSE);
    menuBar()->setItemEnabled( backwardId, FALSE);
    connect( browser, SIGNAL( backwardAvailable( bool ) ),
	     this, SLOT( setBackwardAvailable( bool ) ) );
    connect( browser, SIGNAL( forwardAvailable( bool ) ),
	     this, SLOT( setForwardAvailable( bool ) ) );


    QToolBar* toolbar = new QToolBar( this );
    addToolBar( toolbar, "Toolbar");
    QToolButton* button;

    button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
    connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
    button->setEnabled( FALSE );
    button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
    connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
    button->setEnabled( FALSE );
    button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );

    toolbar->addSeparator();

    pathCombo = new QComboBox( TRUE, toolbar );
    connect( pathCombo, SIGNAL( activated( const QString & ) ),
	     this, SLOT( pathSelected( const QString & ) ) );
    toolbar->setStretchableWidget( pathCombo );
    setRightJustification( TRUE );
    setDockEnabled( DockLeft, FALSE );
    setDockEnabled( DockRight, FALSE );

    pathCombo->insertItem( home_ );

    browser->setFocus();
}
Esempio n. 2
0
FLHelpWindow::FLHelpWindow(const QString &home_,
                           const QString &_path,
                           QWidget *parent,
                           const char *name) :
  QMainWindow(parent, name, WDestructiveClose),
  pathCombo(0), selectedURL()
{
  readHistory();
  readBookmarks();

  browser = new QTextBrowser(this);

  browser->mimeSourceFactory() ->setFilePath(_path);
  browser->setFrameStyle(QFrame::Panel | QFrame::Sunken);
  connect(browser, SIGNAL(textChanged()), this, SLOT(textChanged()));

  setCentralWidget(browser);

  if (!home_.isEmpty())
    browser->setSource(home_);

  connect(browser, SIGNAL(highlighted(const QString &)), statusBar(),
          SLOT(message(const QString &)));

  resize(640, 700);

  QPopupMenu *file = new QPopupMenu(this);

  file->insertItem(tr("&Imprimir"), this, SLOT(print()), CTRL + Key_I);
  file->insertSeparator();
  file->insertItem(tr("&Cerrar"), this, SLOT(close()), Key_Escape);

  // The same three icons are used twice each.
  QIconSet icon_back(QPixmap::fromMimeSource("previous.png"));
  QIconSet icon_forward(QPixmap::fromMimeSource("next.png"));
  QIconSet icon_home(QPixmap::fromMimeSource("home.png"));

  QPopupMenu *go = new QPopupMenu(this);

  backwardId =
    go->insertItem(icon_back, tr("&Atrás"), browser, SLOT(backward()),
                   CTRL + Key_Left);
  forwardId =
    go->insertItem(icon_forward, tr("&Adelante"), browser,
                   SLOT(forward()), CTRL + Key_Right);
  go->insertItem(icon_home, tr("&Inicio"), browser, SLOT(home()));

  QPopupMenu *help = new QPopupMenu(this);

  help->insertItem(tr("&Acerca ..."), this, SLOT(about()));
  help->insertItem(tr("Acerca de &Qt ..."), this, SLOT(aboutQt()));

  hist = new QPopupMenu(this);
  QStringList::Iterator it = history.begin();
  for (; it != history.end(); ++it)
    mHistory[ hist->insertItem(*it)] = *it;
  connect(hist, SIGNAL(activated(int)), this, SLOT(histChosen(int)));

  bookm = new QPopupMenu(this);
  bookm->insertItem(tr("Agregar Favorito"), this, SLOT(addBookmark()));
  bookm->insertSeparator();

  QStringList::Iterator it2 = bookmarks.begin();
  for (; it2 != bookmarks.end(); ++it2)
    mBookmarks[ bookm->insertItem(*it2)] = *it2;
  connect(bookm, SIGNAL(activated(int)), this, SLOT(bookmChosen(int)));

  menuBar() ->insertItem(tr("&Archivo"), file);
  menuBar() ->insertItem(tr("&Ir"), go);
  menuBar() ->insertItem(tr("Historial"), hist);
  menuBar() ->insertItem(tr("Favoritos"), bookm);
  menuBar() ->insertSeparator();
  menuBar() ->insertItem(tr("&Ayuda"), help);

  menuBar() ->setItemEnabled(forwardId, FALSE);
  menuBar() ->setItemEnabled(backwardId, FALSE);
  connect(browser, SIGNAL(backwardAvailable(bool)), this,
          SLOT(setBackwardAvailable(bool)));
  connect(browser, SIGNAL(forwardAvailable(bool)), this,
          SLOT(setForwardAvailable(bool)));


  QToolBar *toolbar = new QToolBar(this);

  addToolBar(toolbar, "Toolbar");
  QToolButton *button;

  button =
    new QToolButton(icon_back, tr("Atrás"), "", browser, SLOT(backward()),
                    toolbar);
  connect(browser, SIGNAL(backwardAvailable(bool)), button,
          SLOT(setEnabled(bool)));
  button->setEnabled(FALSE);
  button =
    new QToolButton(icon_forward, tr("Adelante"), "", browser,
                    SLOT(forward()), toolbar);
  connect(browser, SIGNAL(forwardAvailable(bool)), button,
          SLOT(setEnabled(bool)));
  button->setEnabled(FALSE);
  button =
    new QToolButton(icon_home, tr("Inicio"), "", browser, SLOT(home()),
                    toolbar);

  toolbar->addSeparator();

  pathCombo = new QComboBox(TRUE, toolbar);
  connect(pathCombo, SIGNAL(activated(const QString &)), this,
          SLOT(pathSelected(const QString &)));
  toolbar->setStretchableWidget(pathCombo);
  setRightJustification(TRUE);
  setDockEnabled(DockLeft, FALSE);
  setDockEnabled(DockRight, FALSE);

  pathCombo->insertItem(home_);
  browser->setFocus();
}
Esempio n. 3
0
HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name )
    : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
{
    readHistory();
    readBookmarks();

    browser = new QTextBrowser( this );
    QStringList Strlist;
    Strlist.append( home_);

    browser->mimeSourceFactory()->setFilePath( Strlist );

    browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );

    connect( browser, SIGNAL( textChanged() ),

             this, SLOT( textChanged() ) );

    setCentralWidget( browser );

    if ( !home_.isEmpty() )

////////////////////////////////
        browser->setSource( home_ );

////////////////////////////////
    connect( browser, SIGNAL( highlighted(const QString&) ),
       statusBar(), SLOT( message(const QString&)) );

    setGeometry( 0,0,236,280);

    QPopupMenu* file = new QPopupMenu( this );
//    file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N );
    file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
//    file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P );
    file->insertSeparator();
    file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q );
//    file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X );

    // The same three icons are used twice each.
////F FIXME
    QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/";
    QIconSet icon_back( QPixmap(pixs+"back.png") );
    QIconSet icon_forward( QPixmap(pixs+"forward.png") );
    QIconSet icon_home( QPixmap(pixs+"home.png") );

    QPopupMenu* go = new QPopupMenu( this );
    backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left );
    forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right );
    go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );


    hist = new QPopupMenu( this );
    QStringList::Iterator it = history.begin();
    for ( ; it != history.end(); ++it )
    mHistory[ hist->insertItem( *it ) ] = *it;
    connect( hist, SIGNAL( activated(int) ), this, SLOT( histChosen(int) ) );

    bookm = new QPopupMenu( this );
    bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
    bookm->insertSeparator();

    QStringList::Iterator it2 = bookmarks.begin();
    for ( ; it2 != bookmarks.end(); ++it2 )
   mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
    connect( bookm, SIGNAL( activated(int) ),
       this, SLOT( bookmChosen(int) ) );

    menuBar()->insertItem( tr("&File"), file );
    menuBar()->insertItem( tr("&Go"), go );
    menuBar()->insertItem( tr( "History" ), hist );
    menuBar()->insertItem( tr( "Bookmarks" ), bookm );
//      menuBar()->insertSeparator();
//      menuBar()->insertItem( tr("&Help"), help );

    menuBar()->setItemEnabled( forwardId, FALSE);
    menuBar()->setItemEnabled( backwardId, FALSE);
    connect( browser, SIGNAL( backwardAvailable(bool) ), this, SLOT( setBackwardAvailable(bool) ) );
    connect( browser, SIGNAL( forwardAvailable(bool) ), this, SLOT( setForwardAvailable(bool) ) );


    QToolBar* toolbar = new QToolBar( this );
    addToolBar( toolbar, "Toolbar");
    QToolButton* button;

    button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
    connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
    button->setEnabled( FALSE );
    button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
    connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
    button->setEnabled( FALSE );
    new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );

    toolbar->addSeparator();

    pathCombo = new QComboBox( TRUE, toolbar );
    connect( pathCombo, SIGNAL( activated(const QString&) ), this, SLOT( pathSelected(const QString&) ) );
    toolbar->setStretchableWidget( pathCombo );

//    pathCombo->setMaximumWidth(190);
//     setRightJustification( TRUE );
//      setDockEnabled( Left, FALSE );
//      setDockEnabled( Right, FALSE );

    pathCombo->insertItem( home_ );

    browser->setFocus();


}
Esempio n. 4
0
HelpWindow::HelpWindow( const QString & home_, const QString & _path, QWidget * parent )
    : QMainWindow( parent ), pathCombo( 0 ), selectedURL()
{
    setWindowIcon( QPixmap( RingDir + "xdrawchem-icon.png" ) );

    browser = new QTextBrowser( this );

//    browser->setSearchPaths( _path );
    browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    connect( browser, SIGNAL( sourceChanged( const QUrl & ) ), this, SLOT( sourceChanged( const QUrl & ) ) );

    setCentralWidget( browser );

    if ( !home_.isEmpty() )
        browser->setSource( home_ );

    connect( browser, SIGNAL( highlighted( const QString & ) ), statusBar(), SLOT( showMessage( const QString & ) ) );

    resize( 640, 700 );

    QMenu *file = new QMenu( tr( "&File" ), this );

    file->addAction( tr( "&Print" ), this, SLOT( print() ), Qt::CTRL + Qt::Key_P );
    file->addSeparator();
    file->addAction( tr( "&Close" ), this, SLOT( close() ), Qt::CTRL + Qt::Key_W );

    // The same three icons are used twice each.
    QIcon icon_back( QPixmap( RingDir + "back.xpm" ) );
    QIcon icon_forward( QPixmap( RingDir + "forward.xpm" ) );
    QIcon icon_home( QPixmap( RingDir + "home.xpm" ) );

    QMenu *go = new QMenu( tr( "&Go" ), this );

    backwardAction = go->addAction( icon_back, tr( "&Backward" ), browser, SLOT( backward() ), Qt::CTRL + Qt::Key_Left );
    forwardAction = go->addAction( icon_forward, tr( "&Forward" ), browser, SLOT( forward() ), Qt::CTRL + Qt::Key_Right );
    homeAction = go->addAction( icon_home, tr( "&Home" ), browser, SLOT( home() ) );

    QMenu *help = new QMenu( tr( "&Help" ), this );

    help->addAction( tr( "&About ..." ), this, SLOT( about() ) );

    menuBar()->addMenu( file );
    menuBar()->addMenu( go );
    menuBar()->addMenu( help );

    forwardAction->setEnabled( FALSE );
    backwardAction->setEnabled( FALSE );

    connect( browser, SIGNAL( backwardAvailable( bool ) ), SLOT( setBackwardAvailable( bool ) ) );
    connect( browser, SIGNAL( forwardAvailable( bool ) ), SLOT( setForwardAvailable( bool ) ) );


    QToolBar *toolbar = new QToolBar( this );

    addToolBar( Qt::TopToolBarArea, toolbar );
//    QToolButton *button;

    toolbar->addAction( backwardAction );
    toolbar->addAction( forwardAction );
    toolbar->addAction( homeAction );

    toolbar->addSeparator();

    pathCombo = new QComboBox( toolbar );
    pathCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
    connect( pathCombo, SIGNAL( activated( const QString & ) ), SLOT( pathSelected( const QString & ) ) );

    toolbar->addWidget( pathCombo );
    pathCombo->addItem( home_ );
    browser->setFocus();

}
Esempio n. 5
0
HelpWindow::HelpWindow( const QString& home_, const QString& _path,
  QWidget* parent, const char *name) :
  Q3MainWindow( parent, name, Qt::WDestructiveClose ),
  pathCombo( 0 ), selectedURL()
{
  DigitDebug::ctor(QString("helpwindow " + QString::number((ulong) this, 16)));
  
  readHistory();
  readBookmarks();

  browser = new Q3TextBrowser( this );
  CHECK_PTR_ENGAUGE(browser);

  browser->mimeSourceFactory()->setFilePath( _path );
  browser->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken );
  connect( browser, SIGNAL( textChanged() ),
    this, SLOT( textChanged() ) );

  setCentralWidget( browser );

  if ( !home_.isEmpty() )
    browser->setSource( home_ );

  connect( browser, SIGNAL( highlighted( const QString&) ),
    statusBar(), SLOT( message( const QString&)) );

  // display help window in previous position with same size
  DefaultSettings& rSettings = DefaultSettings::instance();
  move(rSettings.getWindowHelpPosition());
  resize(rSettings.getWindowHelpSize());

  QMenu* file = new QMenu( this );
  CHECK_PTR_ENGAUGE(file);
  file->insertItem( tr("&Open File"), this, SLOT( openFile() ), Qt::CTRL+Qt::Key_O );
  file->insertItem( tr("&Print"), this, SLOT( print() ), Qt::CTRL+Qt::Key_P );
  file->insertSeparator();
  file->insertItem( tr("&Close"), this, SLOT( close() ), Qt::CTRL+Qt::Key_Q );
//file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), Qt::CTRL+Qt::Key_X );

  // The same three icons are used twice each.
  QPixmap helpback (helpback_xpm);
  QPixmap helpforward (helpforward_xpm);
  QPixmap helphome (helphome_xpm);
  
  QIcon icon_back (helpback);
  QIcon icon_forward (helpforward);
  QIcon icon_home (helphome);

  QMenu* go = new QMenu( this );
  CHECK_PTR_ENGAUGE(go);
  backwardId = go->insertItem( icon_back,
    tr("&Backward"), browser, SLOT( backward() ),
    Qt::CTRL+Qt::Key_Left );
  forwardId = go->insertItem( icon_forward,
    tr("&Forward"), browser, SLOT( forward() ),
    Qt::CTRL+Qt::Key_Right );
  go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );

  hist = new QMenu( this );
  CHECK_PTR_ENGAUGE(hist);
  QStringList::Iterator it = history.begin();
  for ( ; it != history.end(); ++it )
    mHistory[ hist->insertItem( *it ) ] = *it;
    connect( hist, SIGNAL( activated( int ) ),
    this, SLOT( histChosen( int ) ) );

  bookm = new QMenu( this );
  CHECK_PTR_ENGAUGE(bookm);
  bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
  bookm->insertSeparator();

  QStringList::Iterator it2 = bookmarks.begin();
  for ( ; it2 != bookmarks.end(); ++it2 )
    mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
  connect( bookm, SIGNAL( activated( int ) ),
    this, SLOT( bookmChosen( int ) ) );

  menuBar()->insertItem( tr("&File"), file );
  menuBar()->insertItem( tr("&Go"), go );
  menuBar()->insertItem( tr( "History" ), hist );
  menuBar()->insertItem( tr( "Bookmarks" ), bookm );

  menuBar()->setItemEnabled( forwardId, FALSE);
  menuBar()->setItemEnabled( backwardId, FALSE);
  connect( browser, SIGNAL( backwardAvailable( bool ) ),
    this, SLOT( setBackwardAvailable( bool ) ) );
  connect( browser, SIGNAL( forwardAvailable( bool ) ),
    this, SLOT( setForwardAvailable( bool ) ) );

  Q3ToolBar* toolbar = new Q3ToolBar( this );
  CHECK_PTR_ENGAUGE(toolbar);
  addToolBar( toolbar, "Toolbar");
  QToolButton* button;

  button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
  CHECK_PTR_ENGAUGE(button);
  connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
  button->setEnabled( FALSE );
  button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
  CHECK_PTR_ENGAUGE(button);
  connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
  button->setEnabled( FALSE );
  button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );
  CHECK_PTR_ENGAUGE(button);

  toolbar->addSeparator();

  pathCombo = new QComboBox( TRUE, toolbar );
  CHECK_PTR_ENGAUGE(pathCombo);
  connect( pathCombo, SIGNAL( activated( const QString & ) ),
    this, SLOT( pathSelected( const QString & ) ) );
  toolbar->setStretchableWidget( pathCombo );
  setRightJustification( TRUE );
  setDockEnabled( Qt::DockLeft, FALSE );
  setDockEnabled( Qt::DockRight, FALSE );

  pathCombo->insertItem( home_ );
  browser->setFocus();
}