Ejemplo n.º 1
0
MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent) {

    lastResult = 0;
    lastResultIsExist = false;
    fileName = "";

    makeStatusBar();
    makeMenu();
    makeCentralWidget();
    makeCalcWidget();
    connections();
}
Ejemplo n.º 2
0
int zz_cl::CMainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: openLogInPage(); break;
        case 1: openMainPage((*reinterpret_cast< zz::CUserInfo*(*)>(_a[1]))); break;
        case 2: makeStatusBar(); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
Ejemplo n.º 3
0
void kdvi::openFile( QString name)
{
    if ( name.isEmpty() )
        return;
    QString oname( name );
    name.detach();
    if ( ! QFileInfo( name ).isReadable() )
        name.append( ".dvi" );
    if ( ! QFileInfo( name ).isReadable() )
    {
        QMessageBox::information( this, i18n("Notice"),
                                  QString(i18n("Can't read file:\n")) +
                                  oname, i18n("OK"));
        return;
    }
    QDir::setCurrent( QFileInfo( name ).dirPath() );
    dviName = name.copy();
    message( i18n("Opening ") + name + " ...");

    makeStatusBar( dviName );
    applyShowStatusbar();
    dviwin->setFile( name );
    dviwin->repaint();
    setCaption( QString()+kapp->getCaption()+": "+name );
    setPage();
    shrinkChanged( dviwin->shrink() );
    if (-1==recent.find(name))
    {
        recent.insert(0,name);
        if (recent.count()>(unsigned)recentmax)
            recent.removeLast();
        config->setGroup("RecentFiles");
        int i=recent.count();
        while ( i-->0 )
            config->writeEntry(QString().setNum(i),
                               recent.at(i));
        config->setGroup( "kdvi" );
        recentmenu->clear();
        for (int n=recent.count(); n-->0;)
            recentmenu->insertItem( recent.at(n), n, 0 );
    }
    updateMarklist();
    message( i18n("Opened ") + name );
}
Ejemplo n.º 4
0
kdvi::kdvi( char *fname, QWidget *, const char *name )
    : KTopLevelWidget( name )
{
    msg = NULL;
    ssmenu = NULL;
    hbl = NULL;
    prefs = NULL;

    keys = new KAccel(this);

    readConfig();
    setMinimumSize( 400, 60 );
    setCaption( kapp->getCaption() );
    tipgroup = new QToolTipGroup( this, "TipGroup" );
    connect( tipgroup, SIGNAL(showTip(const char *)), SLOT(showTip(const char *)) );
    connect( tipgroup, SIGNAL(removeTip()), SLOT(removeTip()) );

    // Create KPanner for toolBar2 and dviwindow

    kpan = new KPanner( this, "panner",
                        KPanner::O_VERTICAL|KPanner::U_ABSOLUTE, 100);
    setView( kpan, TRUE );
    setFrameBorderWidth( 4 );
    kpan->setAbsSeparator( pannerValue );
    connect( kpan, SIGNAL(positionChanged()), SLOT(pannerChanged()) );

    // Create a dvi window

    dviwin = new dviWindow( basedpi, mfmode, paper, makepk,
                            kpan->child1(), "dviWindow" );
    connect( dviwin, SIGNAL(currentPage(int)), SLOT(setPage(int)) );
    connect( dviwin, SIGNAL(shrinkChanged(int)), SLOT(shrinkChanged(int)) );
    connect( dviwin, SIGNAL(fileChanged()), SLOT(fileChanged()) );
    connect( dviwin, SIGNAL(statusChange(const char *)),
             SLOT(showTip(const char *)) );
    connect( dviwin, SIGNAL(setPoint(QPoint)), SLOT(showPoint(QPoint)) );

    // Create a menubar

    menuBar = NULL;
    makeMenuBar();

    // Create toolbars

    toolBar = NULL;
    makeButtons();
    makeToolBar2( kpan->child0() );

    // Create a statusbar

    statusBar = NULL;
    makeStatusBar( i18n("No document") );

    // Lay out widgets

    QBoxLayout *l;
    l = new QBoxLayout( kpan->child0(), QBoxLayout::LeftToRight );
    l->addWidget( toolBar2 );
    l->activate();
    l = new QBoxLayout( kpan->child1(), QBoxLayout::LeftToRight );
    l->addWidget( dviwin );
    l->activate();

    // Create RMB menu

    rmbmenu = new QPopupMenu;
    rmbmenu->setMouseTracking( TRUE );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Toggle Menubar")),
                          this, SLOT(toggleShowMenubar()) );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Mark page")),
                          marklist, SLOT(markSelected()) );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Redraw")),
                          dviwin, SLOT(drawPage()) );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Preferences ...")),
                          this, SLOT(optionsPreferences()) );

    // Bind keys

    bindKeys();
    updateMenuAccel();

// Drag and drop

    KDNDDropZone * dropZone = new KDNDDropZone( this , DndURL);
    connect( dropZone, SIGNAL( dropAction( KDNDDropZone *) ),
             SLOT( dropEvent( KDNDDropZone *) ) );

    // Read config options

    applyPreferences();

    selectSmall();
    dviwin->installEventFilter( this );

    message( "" );
    openFile(QString(fname));
}