Example #1
0
WatchersDialog::WatchersDialog(KConfig& cfg, QWidget* parent, const char* name)
    : KDialogBase(parent, name, false, QString::null,
                  Close, ButtonCode(0), true)
    , partConfig(cfg)
{
    QFrame* mainWidget = makeMainWidget();

    QBoxLayout *layout = new QVBoxLayout(mainWidget, 0, spacingHint());

    table = new QTable(mainWidget, "watchersTable");
    table->setNumCols(5);
    table->setSelectionMode(QTable::NoSelection);
    table->setColumnMovingEnabled(false);
    table->setRowMovingEnabled(false);
    table->setReadOnly(true);
    table->setDragEnabled(false);
    table->setSorting(true);
    table->verticalHeader()->hide();
    table->setLeftMargin(0);
    
    QHeader* header = table->horizontalHeader();
    header->setLabel(0, i18n("File"));
    header->setLabel(1, i18n("Watcher"));
    header->setLabel(2, i18n("Edit"));
    header->setLabel(3, i18n("Unedit"));
    header->setLabel(4, i18n("Commit"));
    
    layout->addWidget(table, 1);

    setWFlags(Qt::WDestructiveClose | getWFlags());

    QSize size = configDialogSize(partConfig, "WatchersDialog");
    resize(size);
}
Example #2
0
AddRepositoryDialog::AddRepositoryDialog(KConfig& cfg, const QString& repo, 
                                         QWidget* parent, const char* name)
    : KDialogBase(parent, name, true, i18n("Add Repository"),
                  Ok | Cancel, Ok, true)
    , partConfig(cfg)
{
    QFrame* mainWidget = makeMainWidget();

    QBoxLayout* layout = new QVBoxLayout(mainWidget, 0, spacingHint());

    QLabel* repo_label = new QLabel(i18n("&Repository:"), mainWidget);
    layout->addWidget(repo_label);
    
    repo_edit = new KLineEdit(mainWidget);
    repo_edit->setFocus();
    repo_label->setBuddy(repo_edit);
    if( !repo.isNull() )
    {
        repo_edit->setText(repo);
        repo_edit->setEnabled(false);
    }
    layout->addWidget(repo_edit);
    
    QLabel* rsh_label = new QLabel(i18n("Use remote &shell (only for :ext: repositories):"), mainWidget);
    layout->addWidget(rsh_label);
    
    rsh_edit = new KLineEdit(mainWidget);
    rsh_label->setBuddy(rsh_edit);
    layout->addWidget(rsh_edit);
    
    QLabel* server_label = new QLabel(i18n("Invoke this program on the server side:"),
                                      mainWidget);
    layout->addWidget(server_label);
    
    server_edit = new KLineEdit(mainWidget);
    server_label->setBuddy(server_edit);
    layout->addWidget(server_edit);

    QHBox* compressionBox = new QHBox(mainWidget);
    m_useDifferentCompression = new QCheckBox(i18n("Use different &compression level:"), compressionBox);
    
    m_compressionLevel = new KIntNumInput(compressionBox);
    m_compressionLevel->setRange(0, 9, 1, false);
    layout->addWidget(compressionBox);
    
    m_retrieveCvsignoreFile = new QCheckBox(i18n("Download cvsignore file from "
                                            "server"), mainWidget);
    layout->addWidget(m_retrieveCvsignoreFile);

    connect( repo_edit, SIGNAL(textChanged(const QString&)),
             this, SLOT(repoChanged()) );
    connect( m_useDifferentCompression, SIGNAL(toggled(bool)),
             this, SLOT(compressionToggled(bool)) );
    repoChanged();

    QSize size = configDialogSize(partConfig, "AddRepositoryDialog");
    resize(size);
}
Example #3
0
AnnotateDialog::AnnotateDialog(KConfig& cfg, QWidget *parent, const char *name)
    : KDialogBase(parent, name, false, QString::null,
                  Close | Help, Close, true)
    , partConfig(cfg)
{
    annotate = new AnnotateView(partConfig, this);
    setMainWidget(annotate);

    setHelp("annotate");

    setWFlags(Qt::WDestructiveClose | getWFlags());

    QSize size = configDialogSize(partConfig, "AnnotateDialog");
    resize(size);
}
Example #4
0
AdjQueryDlg::AdjQueryDlg
(
  QString type,
  int entry,
  int col,
  int query_cycle,
  int query_num,
  int query_startnum,
  kvoctrainExpr *exp,
  kvoctrainDoc  *doc,
  const Comparison &_comp)
  : QueryDlgBase(i18n("Comparison Training"))
{
  mw = new AdjQueryDlgForm(this);
  setMainWidget(mw);

  connect(mw->dont_know, SIGNAL(clicked()), SLOT(dontKnowClicked()) );
  connect(mw->know_it, SIGNAL(clicked()), SLOT(knowItClicked()) );
  connect(mw->verify, SIGNAL(clicked()), SLOT(verifyClicked()) );
  connect(mw->show_all, SIGNAL(clicked()), SLOT(showAllClicked()) );

  connect(mw->lev1Field, SIGNAL(returnPressed()), SLOT(returnPressed()) );
  connect(mw->lev2Field, SIGNAL(returnPressed()), SLOT(returnPressed()) );
  connect(mw->lev3Field, SIGNAL(returnPressed()), SLOT(returnPressed()) );

  connect(mw->lev1Field, SIGNAL(textChanged(const QString&)), SLOT(lev1Changed(const QString&)) );
  connect(mw->lev2Field, SIGNAL(textChanged(const QString&)), SLOT(lev2Changed(const QString&)) );
  connect(mw->lev3Field, SIGNAL(textChanged(const QString&)), SLOT(lev3Changed(const QString&)) );

  qtimer = 0;

  mw->lev1Label->setBuddy(mw->lev1Field);
  mw->lev2Label->setBuddy(mw->lev2Field);
  mw->lev3Label->setBuddy(mw->lev3Field);

  setQuery (type, entry, col, query_cycle, query_num, query_startnum, exp, doc, _comp);
  mw->countbar->setFormat("%v/%m");
  mw->timebar->setFormat("%v");
  resize(configDialogSize("AdjQueryDialog"));
}
Example #5
0
ChangeLogDialog::ChangeLogDialog(KConfig& cfg, QWidget *parent, const char *name)
    : KDialogBase(parent, name, true, i18n("Edit ChangeLog"),
                  Ok | Cancel, Ok, true)
    , partConfig(cfg)
{
    edit = new KTextEdit(this);

    cfg.setGroup("LookAndFeel");
    edit->setFont(cfg.readFontEntry("ChangeLogFont"));

    edit->setFocus();
    edit->setWordWrap(QTextEdit::NoWrap);
    edit->setTextFormat(QTextEdit::PlainText);
    edit->setCheckSpellingEnabled(true);
    QFontMetrics const fm(edit->fontMetrics());
    edit->setMinimumSize(fm.width('0') * 80,
                         fm.lineSpacing() * 20);

    setMainWidget(edit);

    QSize size = configDialogSize(partConfig, "ChangeLogDialog");
    resize(size);
}
Example #6
0
AddAppletDialog::AddAppletDialog(ContainerArea* cArea,
                                 QWidget* parent,
                                 const char* name)
    : KDialogBase(parent, name, false, i18n("Add Applet"), 0),
      m_selectedApplet(0),
      m_containerArea(cArea),
      m_insertionPoint(Kicker::the()->insertionPoint()),
      m_closing(false),
      m_searchDelay(new QTimer(this))
{
    m_mainWidget = new AppletView(this, "AddAppletDialog::m_mainWidget");
    m_mainWidget->appletScrollView->setResizePolicy(QScrollView::Manual);
    m_mainWidget->appletScrollView->setHScrollBarMode(QScrollView::AlwaysOff);
    m_mainWidget->appletScrollView->viewport()->setPaletteBackgroundColor(KGlobalSettings::baseColor());

    setMainWidget(m_mainWidget);

    resize(configDialogSize("AddAppletDialog Settings"));
    centerOnScreen(this);

    KGuiItem addGuiItem = KStdGuiItem::add();
    addGuiItem.setText(m_mainWidget->appletInstall->text());
    m_mainWidget->appletInstall->setEnabled(false);
    m_mainWidget->appletInstall->setGuiItem(addGuiItem);
    m_mainWidget->closeButton->setGuiItem(KStdGuiItem::close());

    connect(m_mainWidget->appletSearch, SIGNAL(textChanged(const QString&)), this, SLOT(delayedSearch()));
    connect(m_searchDelay, SIGNAL(timeout()), this, SLOT(search()));
    connect(m_mainWidget->appletFilter, SIGNAL(activated(int)), this, SLOT(filter(int)));
    connect(m_mainWidget->appletInstall, SIGNAL(clicked()), this, SLOT(addCurrentApplet()));
    connect(m_mainWidget->closeButton, SIGNAL(clicked()), this, SLOT(close()));

    m_selectedType = AppletInfo::Undefined;
    m_appletBox = 0;

    QTimer::singleShot(0, this, SLOT(populateApplets()));
}
Example #7
0
LogDialog::LogDialog(KConfig& cfg, QWidget *parent, const char *name)
    : KDialogBase(parent, name, false, QString::null,
                  Ok | Apply | Close | Help | User1 | User2 | User3, Close, true,
                  KGuiItem(i18n("&Annotate")),
                  KGuiItem(i18n("&Diff"), "vcs_diff"),
                  KGuiItem(i18n("&Find..."), "find"))
    , cvsService(0)
    , partConfig(cfg)
{
    QSplitter *splitter = new QSplitter(Qt::Vertical, this);
    setMainWidget(splitter);

    tree = new LogTreeView(this);
    connect( tree, SIGNAL(revisionClicked(QString,bool)),
             this, SLOT(revisionSelected(QString,bool)) );

    QWidget* listWidget = new QWidget(this);
    QVBoxLayout* listLayout = new QVBoxLayout(listWidget);
    QHBoxLayout* searchLayout = new QHBoxLayout(listLayout);
    searchLayout->setMargin(KDialog::spacingHint());
    searchLayout->setSpacing(KDialog::spacingHint());

    list = new LogListView(partConfig, listWidget);
    listLayout->addWidget(list, 1);

    KListViewSearchLine* searchLine = new KListViewSearchLine(listWidget, list);
    QLabel* searchLabel = new QLabel(searchLine, i18n("S&earch:"), listWidget);
    searchLayout->addWidget(searchLabel);
    searchLayout->addWidget(searchLine, 1);

    connect( list, SIGNAL(revisionClicked(QString,bool)),
             this, SLOT(revisionSelected(QString,bool)) );

    plain = new LogPlainView(this);
    connect( plain, SIGNAL(revisionClicked(QString,bool)),
             this, SLOT(revisionSelected(QString,bool)) );

    tabWidget = new QTabWidget(splitter);
    tabWidget->addTab(tree, i18n("&Tree"));
    tabWidget->addTab(listWidget, i18n("&List"));
    tabWidget->addTab(plain, i18n("CVS &Output"));

    connect(tabWidget, SIGNAL(currentChanged(QWidget*)),
            this, SLOT(tabChanged(QWidget*)));

    QWhatsThis::add(tree, i18n("Choose revision A by clicking with the left "
                               "mouse button,\nrevision B by clicking with "
                               "the middle mouse button."));

    items.setAutoDelete(true);
    tags.setAutoDelete(true);

    QWidget *mainWidget = new QWidget(splitter);
    QBoxLayout *layout = new QVBoxLayout(mainWidget, 0, spacingHint());

    for (int i = 0; i < 2; ++i)
    {
        if ( i == 1 )
        {
            QFrame *frame = new QFrame(mainWidget);
            frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
            layout->addWidget(frame);
        }

        QGridLayout *grid = new QGridLayout(layout);
        grid->setRowStretch(0, 0);
        grid->setRowStretch(1, 0);
        grid->setRowStretch(2, 1);
        grid->setColStretch(0, 0);
        grid->setColStretch(1, 1);
        grid->setColStretch(2, 0);
        grid->setColStretch(3, 1);
        grid->setColStretch(4, 2);

        QString versionident = (i==0)? i18n("Revision A:") : i18n("Revision B:");
        QLabel *versionlabel = new QLabel(versionident, mainWidget);
        grid->addWidget(versionlabel, 0, 0);

        revbox[i] = new QLabel(mainWidget);
        revbox[i]->setFrameStyle(QFrame::Panel | QFrame::Sunken);
        grid->addWidget(revbox[i], 0, 1, Qt::AlignVCenter);

        QLabel *selectlabel = new QLabel(i18n("Select by tag:"), mainWidget);
        grid->addWidget(selectlabel, 0, 2);

        tagcombo[i] = new QComboBox(mainWidget);
        QFontMetrics fm(tagcombo[i]->fontMetrics());
        tagcombo[i]->setMinimumWidth(fm.width("X")*20);
        grid->addWidget(tagcombo[i], 0, 3);

        QLabel *authorlabel = new QLabel(i18n("Author:"), mainWidget);
        grid->addWidget(authorlabel, 1, 0);

        authorbox[i] = new QLabel(mainWidget);
        authorbox[i]->setFrameStyle(QFrame::Panel | QFrame::Sunken);
        grid->addWidget(authorbox[i], 1, 1);

        QLabel *datelabel = new QLabel(i18n("Date:"), mainWidget);
        grid->addWidget(datelabel, 1, 2);

        datebox[i] = new QLabel(mainWidget);
        datebox[i]->setFrameStyle(QFrame::Panel | QFrame::Sunken);
        grid->addWidget(datebox[i], 1, 3);

        QLabel *commentlabel = new QLabel(i18n("Comment/Tags:"), mainWidget);
        grid->addWidget(commentlabel, 2, 0);

        commentbox[i] = new QTextEdit(mainWidget);
        commentbox[i]->setReadOnly(true);
        commentbox[i]->setTextFormat(Qt::PlainText);
        fm = commentbox[i]->fontMetrics();
        commentbox[i]->setMinimumHeight(2*fm.lineSpacing()+10);
        grid->addMultiCellWidget(commentbox[i], 2, 2, 1, 3);

        tagsbox[i] = new QTextEdit(mainWidget);
        tagsbox[i]->setReadOnly(true);
        tagsbox[i]->setMinimumHeight(2*fm.lineSpacing()+10);
        grid->addWidget(tagsbox[i], 2, 4);
    }

    QWhatsThis::add(revbox[0], i18n("This revision is used when you click "
                                    "Annotate.\nIt is also used as the first "
                                    "item of a Diff operation."));
    QWhatsThis::add(revbox[1], i18n("This revision is used as the second "
                                    "item of a Diff operation."));

    connect( tagcombo[0], SIGNAL(activated(int)),
             this, SLOT(tagASelected(int)) );
    connect( tagcombo[1], SIGNAL(activated(int)),
             this, SLOT(tagBSelected(int)) );

    connect( this, SIGNAL(user1Clicked()),
             this, SLOT(annotateClicked()) );
    connect( this, SIGNAL(user2Clicked()),
             this, SLOT(diffClicked()) );
    connect( this, SIGNAL(user3Clicked()),
             this, SLOT(findClicked()) );

    setButtonGuiItem(Ok, KGuiItem(i18n("to view something", "&View"),"fileopen"));
    setButtonGuiItem(Apply, KGuiItem(i18n("Create Patch...")));
    setHelp("browsinglogs");

    setWFlags(Qt::WDestructiveClose | getWFlags());

    QSize size = configDialogSize(partConfig, "LogDialog");
    resize(size);

    KConfigGroupSaver cs(&partConfig, "LogDialog");
    tabWidget->setCurrentPage(partConfig.readNumEntry("ShowTab", 0));

    updateButtons();
}
Example #8
0
bool ScanDialog::setup()
{
   if( ! m_device )
   {
      good_scan_connect = false;
      return(false);
   }
   // The scan device is now closed on closing the scan dialog. That means
   // that more work to open it needs to be done in the setup slot like opening
   // the selector if necessary etc.

   if( m_scanParams )
   {
      /* if m_scanParams exist it means, that the dialog is already open */
      return true;
   }

   m_scanParams = new ScanParams( splitter );
   connect( m_previewer->getImageCanvas(), SIGNAL( newRect(QRect)),
	    m_scanParams, SLOT(slCustomScanSize(QRect)));
   connect( m_previewer->getImageCanvas(), SIGNAL( noRect()),
	    m_scanParams, SLOT(slMaximalScanSize()));

   connect( m_scanParams, SIGNAL( scanResolutionChanged( int, int )),
	    m_previewer, SLOT( slNewScanResolutions( int, int )));


   /* continue to attach a real scanner */
   /* first, get the list of available devices from libkscan */
   QStringList scannerNames;
   QStrList backends = m_device->getDevices();;
   QStrListIterator it( backends );

   while ( it.current() ) {
      scannerNames.append( m_device->getScannerName( it.current() ));
      ++it;
   }

   /* ..if there are devices.. */
   QCString configDevice;
   good_scan_connect = true;
   if( scannerNames.count() > 0 )
   {
      /* allow the user to select one */
      DeviceSelector ds( this, backends, scannerNames );
      configDevice = ds.getDeviceFromConfig( );

      if( configDevice.isEmpty() || configDevice.isNull() )
      {
	 kdDebug(29000) << "configDevice is not valid - starting selector!" << configDevice << endl;
	 if ( ds.exec() == QDialog::Accepted )
	 {
	    configDevice = ds.getSelectedDevice();
	 }
      }

      /* If a device was selected, */
      if( ! configDevice.isNull() )
      {
	 /* ..open it (init sane with that) */
	 m_device->openDevice( configDevice );

	 /* ..and connect to the gui (create the gui) */
	 if ( !m_scanParams->connectDevice( m_device ) )
	 {
	    kdDebug(29000) << "ERR: Could not connect scan device" << endl;
	    good_scan_connect = false;
	 }
      }
   }

   if( configDevice.isNull() || configDevice.isEmpty() )
   {
      /* No scanner found, open with information */
      m_scanParams->connectDevice( 0L );
      good_scan_connect = false;
      /* Making the previewer gray */
      /* disabling is much better than hiding for 'advertising' ;) */
   }

   /* Move the scan params to the left, for backward compatibility.
    * However, having it on the right looks a bit better IMHO */
   if( splitter && m_scanParams )
      splitter->moveToFirst( m_scanParams );

   if( good_scan_connect )
   {
      m_previewer->setEnabled( true );
      m_previewer->setPreviewImage( m_device->loadPreviewImage() );
      m_previewer->connectScanner( m_device );
   }

    /* set initial sizes */
    setInitialSize( configDialogSize( GROUP_STARTUP ));

    KConfig *kfg = KGlobal::config();
    if( kfg )
    {
       QRect r = KGlobalSettings::desktopGeometry(this);

       kfg->setGroup( GROUP_STARTUP );
       /* Since this is a vertical splitter, only the width is important */
       QString key = QString::fromLatin1( SCANDIA_SPLITTER_SIZES ).arg( r.width());
       kdDebug(29000) << "Read Splitter-Sizes " << key  << endl;
       splitter->setSizes( kfg->readIntListEntry( key ));
    }

   return true;
}