void BedCorrelationItemView::slotCustomContextMenuRequested(const QPoint& p) {
    QMenu* m = new QMenu(this);

    QAction* reloadA = new QAction(tr("Reload"), this);
    QAction* createA = new QAction(tr("Create BedCorrelation..."), this);
    QAction* editA = new QAction(tr("Edit..."), this);
    QAction* deleteA = new QAction(tr("Delete"), this);

    connect(reloadA, SIGNAL(activated()), this, SLOT(slotReload()));
    connect(createA, SIGNAL(activated()), this, SLOT(slotCreate()));
    connect(editA, SIGNAL(activated()), this, SLOT(slotEdit()));
    connect(deleteA, SIGNAL(activated()), this, SLOT(slotDelete()));

    m->addAction(createA);

    if (selectedIndexes().count() == 1) {
        m->insertSeparator(editA);
        m->addAction(editA);
    }

    if (selectedIndexes().count() > 0) {
        m->insertSeparator(deleteA);
        m->addAction(deleteA);
    }
    m->addAction(reloadA);
    m->exec(mapToGlobal(p));
}
예제 #2
0
/*!
    \fn SnippetWidget::showPopupMenu( QListViewItem * item, const QPoint & p, int )
    Shows the Popup-Menu depending item is a valid pointer
*/
void SnippetWidget::showPopupMenu( QListViewItem * item, const QPoint & p, int )
{
	KPopupMenu popup;

	SnippetItem * selectedItem = static_cast<SnippetItem *>(item);
	if ( item ) {
		popup.insertTitle( selectedItem->getName() );

		popup.insertItem( i18n("Add Item..."), this, SLOT( slotAdd() ) );
		popup.insertItem( i18n("Add Group..."), this, SLOT( slotAddGroup() ) );
        if (dynamic_cast<SnippetGroup*>(item)) {
            popup.insertItem( i18n("Edit..."), this, SLOT( slotEditGroup() ) );
        } else {
            popup.insertItem( i18n("Edit..."), this, SLOT( slotEdit() ) );
        }
		popup.insertItem( i18n("Remove"), this, SLOT( slotRemove() ) );

	} else {
		popup.insertTitle(i18n("Code Snippets"));

		popup.insertItem( i18n("Add Group..."), this, SLOT( slotAddGroup() ) );
	}

	popup.exec(p);
}
예제 #3
0
void FunctionManager::addFunction(Function* function)
{
	QTreeWidgetItem* item;

	Q_ASSERT(function != NULL);
	
	/* Create a new item for the function */
	item = new QTreeWidgetItem(m_tree);
	updateFunctionItem(item, function);

	/* Clear current selection and select only the new one */
	m_tree->clearSelection();
	item->setSelected(true);

	/* Start editing immediately */
	if (slotEdit() == QDialog::Rejected)
	{
		/* Edit dialog was rejected -> delete function */
		deleteSelectedFunctions();
	}
	else
	{
		m_tree->sortItems(KColumnName, Qt::AscendingOrder);
		m_tree->scrollToItem(item);
	}
}
예제 #4
0
int FunctionManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: slotModeChanged((*reinterpret_cast< Doc::Mode(*)>(_a[1]))); break;
        case 1: slotFunctionRemoved((*reinterpret_cast< quint32(*)>(_a[1]))); break;
        case 2: slotTreeSelectionChanged(); break;
        case 3: slotTreeContextMenuRequested((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 4: slotBusTriggered((*reinterpret_cast< QAction*(*)>(_a[1]))); break;
        case 5: slotBusNameChanged((*reinterpret_cast< quint32(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break;
        case 6: slotAddScene(); break;
        case 7: slotAddChaser(); break;
        case 8: slotAddCollection(); break;
        case 9: slotAddEFX(); break;
        case 10: slotWizard(); break;
        case 11: { int _r = slotEdit();
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 12: slotClone(); break;
        case 13: slotDelete(); break;
        case 14: slotSelectAll(); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
예제 #5
0
void CQReportDefinitionSelect::loadReportDefinitionVector()
{
  CCopasiDataModel* pDataModel = mpListView->getDataModel();
  assert(pDataModel != NULL);
  CReportDefinitionVector* pReportDefinitionVector = pDataModel->getReportDefinitionList();
  unsigned C_INT32 i;

  for (i = 0; i < pReportDefinitionVector->size(); i++)
    mpComboDefinition->
    insertItem(mpComboDefinition->count(), FROM_UTF8(pReportDefinitionVector->operator[](i).getObjectName()));

  // if it is an empty list
  if (mpComboDefinition->count() == 0)
    {
      std::string name = "ReportDefinition_0";
      pDataModel->getReportDefinitionList()->createReportDefinition(name, "");
      mpComboDefinition->insertItem(mpComboDefinition->count(), FROM_UTF8(name));
      mpComboDefinition->setCurrentIndex(1);
      mpReport->setReportDefinition(&pDataModel->getReportDefinitionList()->operator[](0)); //first one report definition
      mpReport->setAppend(mpCheckAppend->isChecked());
      mpReport->setConfirmOverwrite(mpCheckConfirmOverwrite->isChecked());
      mpReport->setTarget(TO_UTF8(mpEditTarget->text()));
      mpListView->getDataModelGUI()->notify(ListViews::REPORT, ListViews::CHANGE, ""); //notify Table Definition to

      if (CQMessageBox::question(NULL, "No Report Template Defined",
                                 "No report definition defined, COPASI has already created a new one for you.\n Do you want to switch to the GUI to edit it?",
                                 QMessageBox::Ok | QMessageBox::No, QMessageBox::Ok) == QMessageBox::Ok)
        slotEdit();

      return;
    }

  if (!mpReport->getReportDefinition())
    {
      C_INT32 row;
      row = mpComboDefinition->currentIndex();
      mpReport->setReportDefinition(&pReportDefinitionVector->operator[](row));
      mpReport->setAppend(mpCheckAppend->isChecked());
      mpReport->setConfirmOverwrite(mpCheckConfirmOverwrite->isChecked());
      mpReport->setTarget(TO_UTF8(mpEditTarget->text()));
      return;
    }
  else
    {
      C_INT32 i;

      // no use to compare the last one
      for (i = mpComboDefinition->count() - 1; i >= 1; i--)
        if (mpComboDefinition->itemText(i) == FROM_UTF8(mpReport->getReportDefinition()->getObjectName()))
          break;

      mpComboDefinition->setCurrentIndex(i);
      mpCheckAppend->setChecked(mpReport->append());
      mpCheckConfirmOverwrite->setChecked(mpReport->confirmOverwrite());
      mpEditTarget->setText(FROM_UTF8(mpReport->getTarget()));
    }
}
예제 #6
0
ContextHelp::ContextHelp( KateMDI::ToolView * parent )
	: QWidget(parent), Ui::ContextHelpWidget( /* parent */ )
{
    setupUi(this);

	QWhatsThis::add( this, i18n("Provides context-sensitive help relevant to the current editing being performed.") );
	setAcceptDrops( true );
	
    if (parent->layout()) {
        parent->layout()->addWidget(this);
        qDebug() << Q_FUNC_INFO << " added item selector to parent's layout " << parent;
    } else {
        qWarning() << Q_FUNC_INFO << " unexpected null layout on parent " << parent ;
    }

	QFont font;
	font.setBold( true );
	if ( font.pointSize() != 0 )
		font.setPointSize( int(font.pointSize() * 1.4) );
	m_pNameLabel->setFont( font );
	m_pNameLabel->setTextFormat( Qt::RichText );
	
	m_pBrowser = new KHTMLPart( m_pWidgetStack->widget( 0 ) );
	m_pBrowserView = m_pBrowser->view();
	m_pBrowserView->setFocusPolicy( Qt::NoFocus );
	m_pBrowserLayout->addWidget( m_pBrowserView );
	connect( m_pBrowser->browserExtension(), SIGNAL(openUrlRequest( const KUrl &, const KParts::OpenUrlArguments & ) ),
			 this, SLOT( openURL(const KUrl & /*, const KParts::OpenUrlArguments & */ ) ) );
	
	// Adjust appearance of browser
	m_pBrowserView->setMarginWidth( 4 );
	
	m_pEditor = new RichTextEditor( m_pWidgetStack->widget( 1 ), "ContextHelpEditor" );
	m_pTopLayout->addWidget( m_pEditor );
	
	m_pEditor->installEventFilter( this );
	m_pEditor->editorViewport()->installEventFilter( this );
	slotClear();
	
	connect( m_pEditButton, SIGNAL(clicked()), this, SLOT(slotEdit()) );
	connect( m_pSaveButton, SIGNAL(clicked()), this, SLOT(slotSave()) );
	connect( m_pResetButton, SIGNAL(clicked()), this, SLOT(slotEditReset()) );
	connect( m_pChangeDescriptionsDirectory, SIGNAL(clicked()), this, SLOT(requestItemDescriptionsDirectory()) );
	connect( m_pLanguageSelect, SIGNAL(activated(const QString &)), this, SLOT(setCurrentLanguage( const QString& )) );
	
	m_pResetButton->setPixmap( KIconLoader::global()->loadIcon( "button_cancel", KIconLoader::Small ) );
	m_pChangeDescriptionsDirectory->setPixmap( KIconLoader::global()->loadIcon( "folder", KIconLoader::Small ) );
	
	
	connect( ComponentSelector::self(), SIGNAL(itemSelected( const QString& )), this, SLOT(setBrowserItem( const QString& )) );
	connect( FlowPartSelector::self(), SIGNAL(itemSelected( const QString& )), this, SLOT(setBrowserItem( const QString& )) );
#ifdef MECHANICS
	connect( MechanicsSelector::self(), SIGNAL(itemSelected( const QString& )), this, SLOT(setBrowserItem( const QString& )) );
#endif
	
	QTimer::singleShot( 10, this, SLOT(slotInitializeLanguageList()) );
}
예제 #7
0
NamedAreaDialog::NamedAreaDialog(QWidget* parent, Selection* selection)
        : KDialog(parent)
        , m_selection(selection)
{
    setButtons(KDialog::Ok | KDialog::Close | KDialog::User1 | KDialog::User2 | KDialog::User3);
    setButtonsOrientation(Qt::Vertical);
    setButtonText(KDialog::Ok, i18n("&Select"));
    setButtonText(KDialog::User1, i18n("&Remove"));
    setButtonText(KDialog::User2, i18n("&Edit..."));
    setButtonText(KDialog::User3, i18n("&New..."));
    setCaption(i18n("Named Areas"));
    setModal(true);
    setObjectName("NamedAreaDialog");

    QWidget* widget = new QWidget(this);
    setMainWidget(widget);

    QVBoxLayout *vboxLayout = new QVBoxLayout(widget);
    vboxLayout->setMargin(0);
    vboxLayout->setSpacing(KDialog::spacingHint());

    m_list = new KListWidget(this);
    m_list->setSortingEnabled(true);
    vboxLayout->addWidget(m_list);

    m_rangeName = new QLabel(this);
    m_rangeName->setText(i18n("Area: %1", QString()));
    vboxLayout->addWidget(m_rangeName);

    const QList<QString> namedAreas = m_selection->activeSheet()->map()->namedAreaManager()->areaNames();
    for (int i = 0; i < namedAreas.count(); ++i)
        m_list->addItem(namedAreas[i]);

    if (m_list->count() == 0) {
        enableButtonOk(false);
        enableButton(KDialog::User1, false);
        enableButton(KDialog::User2, false);
        m_list->setCurrentRow(0);
    }

    connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
    connect(this, SIGNAL(cancelClicked()), this, SLOT(slotClose()));
    connect(this, SIGNAL(user1Clicked()), this, SLOT(slotRemove()));
    connect(this, SIGNAL(user2Clicked()), this, SLOT(slotEdit()));
    connect(this, SIGNAL(user3Clicked()), this, SLOT(slotNew()));
    connect(m_list, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(slotOk()));
    connect(m_list, SIGNAL(currentTextChanged(const QString&)),
            this, SLOT(displayAreaValues(const QString&)));

    if (m_list->count() > 0)
        m_list->setCurrentItem(m_list->item(0));

    m_list->setFocus();
}
void BedItemModel::slotEditCurrentBed() {
    if (!hasCurrentBed()) {
        return;
    }

    QModelIndex idx = findIndexForBed(getCurrentBed());
    if (!idx.isValid()) {
        return;
    }

    slotEdit(idx);
}
예제 #9
0
ViewDepartments::ViewDepartments(QWidget * parent): ui(new Ui::ViewDepartments) // ??
{
	ui->setupUi(this);
	setupModel();

	QObject::connect(ui->action_New, SIGNAL(triggered()), this, SLOT(slotAdd()));
	QObject::connect(ui->action_Delete, SIGNAL(triggered()), this, SLOT(slotDelete()));
	QObject::connect(ui->action_Edit, SIGNAL(triggered()), this, SLOT(slotEdit()));
	QObject::connect(ui->action_Yes, SIGNAL(triggered()), this, SLOT(slotSave()));
	QObject::connect(ui->action_No, SIGNAL(triggered()), this, SLOT(slotCancel()));
	
}
예제 #10
0
CentralWidget::CentralWidget(QWidget *parent) : QWidget(parent), timeOut(DEFAULT_TIMEOUT)
{

    watcher = new QFutureWatcher<QSharedPointer<PatternViewMap>>();
    compiler = new PatternCompiler();
    txt = new TextBasicWidget(this);
    pattern = new PatternsBasicWidget(compiler,this);
    matches = new MatchesBasicWidget(this);
    timeoutTimer = new QTimer(this);
    timeoutTimer->setSingleShot(true);
    QSplitter* vert = new QSplitter();
    QSplitter* horiz = new QSplitter();
    QWidget* containter = new QWidget();
    QHBoxLayout* containterLay = new QHBoxLayout();
    QVBoxLayout* mainLay = new QVBoxLayout();
    containterLay->setContentsMargins(0,0,0,0);
    horiz->addWidget(txt);
    horiz->addWidget(pattern);
    containterLay->addWidget(horiz);
    containter->setLayout(containterLay);
    vert->setOrientation(Qt::Vertical);
    vert->addWidget(containter);
    vert->addWidget(matches);

//    vert->addWidget(progress);
    mainLay->addWidget(vert);
    setLayout(mainLay);
    connect(pattern,SIGNAL(matchClicked()), this,SLOT(slotAnalyze()));
    connect(matches,SIGNAL(patternWasUnchecked(QString)),txt,SLOT(slotPatternUncheked(QString)));
    connect(matches,SIGNAL(patternWasChecked(QString)),txt,SLOT(slotPatternChecked(QString)));
    connect(matches,SIGNAL(showAll()),txt,SLOT(slotHighlightAll()));
    connect(matches,SIGNAL(showAll()),pattern,SLOT(slotDisableMatch()));
    connect(matches,SIGNAL(hideAll()),txt,SLOT(slotDehighlightAll()));
    connect(matches,SIGNAL(rowClicked(int,int)),txt,SLOT(slotSelectFragment(int,int)));
    connect(matches,SIGNAL(patternWasUnchecked(QString)),this,SIGNAL(statusHighlighting()));
    connect(matches,SIGNAL(patternWasChecked(QString)),this,SIGNAL(statusHighlighting()));

    connect(txt,SIGNAL(tabChanged(int)),matches,SLOT(slotChangeTab(int)));
    connect(txt,SIGNAL(tabClosed(int)),matches,SLOT(slotCloseTab(int)));
    connect(txt,SIGNAL(editEnabled()),matches,SLOT(slotClear()));
    connect(txt,SIGNAL(editEnabled()),this,SLOT(slotEdit()));
    connect(txt,SIGNAL(checkingEnabled()),matches,SLOT(slotEnableChecking()));
    connect(txt,SIGNAL(checkingEnabled()),this,SIGNAL(statusReady()));
    connect(txt, SIGNAL(checkingEnabled()),pattern, SLOT(slotEnableMatch()));

    connect(watcher,SIGNAL(finished()),this,SLOT(slotDisplay()));
    connect(timeoutTimer,SIGNAL(timeout()),this,SLOT(slotTimeout()));

    //connect(watcher,SIGNAL(progressValueChanged(int)),this,SLOT(slotProgress(int)));
    if (QFile::exists(CRASH_TEXT) && QFile::exists(CRASH_PATTERNS)){
        loadAfterCrash(CRASH_TEXT, CRASH_PATTERNS);
    }
}
예제 #11
0
void ContextHelp::setCurrentLanguage( const QString & language )
{
	if ( !saveDescription( m_currentLanguage ) )
	{
		m_pLanguageSelect->blockSignals( true );
		m_pLanguageSelect->setCurrentItem( m_currentLanguage );
		m_pLanguageSelect->blockSignals( false );
		return;
	}
	
	m_currentLanguage = language;
	slotEdit();
}
예제 #12
0
IMEditorWidget::IMEditorWidget( QWidget *parent, const QString &preferredIM )
  : KDialog( parent ), mReadOnly( false )
{
  setCaption( i18n( "Edit Instant Messaging Address" ) );
  setButtons( Help | Ok | Cancel );
  setDefaultButton( Ok );
  QWidget *w = new QWidget(this);
  mWidget = new Ui_IMEditorBase();
  mWidget->setupUi( w );
  setMainWidget(w);
  connect( mWidget->btnAdd, SIGNAL( clicked() ), SLOT( slotAdd() ) );
  connect( mWidget->btnEdit, SIGNAL( clicked() ), SLOT( slotEdit() ) );
  connect( mWidget->btnDelete, SIGNAL( clicked() ), SLOT( slotDelete() ) );
  connect( mWidget->btnSetStandard, SIGNAL( clicked()), SLOT( slotSetStandard() ) );
  connect( mWidget->lvAddresses, SIGNAL( itemSelectionChanged() ), SLOT( slotUpdateButtons() ) );

  connect( mWidget->lvAddresses, SIGNAL( itemDoubleClicked( QTreeWidgetItem *, int ) ),
           SLOT( slotEdit() ) );

  setHelp( "managing-contacts-im-addresses", "kaddressbook" );

  mWidget->btnEdit->setEnabled( false );
  mWidget->btnDelete->setEnabled( false );
  mWidget->btnSetStandard->setEnabled( false );
  // Disabled pending implementation
  //mWidget->btnUp->setEnabled( false );
  //mWidget->btnDown->setEnabled( false );
  mPreferred = preferredIM;
  mPreferred = mPreferred.replace( " on ", QString( QChar( 0xE120 ) ), Qt::CaseSensitive );
  mProtocols = KPluginInfo::fromServices(
    KServiceTypeTrader::self()->query( QString::fromLatin1( "KABC/IMProtocol" ) ) );

  // order the protocols by putting them in a qmap, then sorting
  // the set of keys and recreating the list
  QMap<QString, KPluginInfo> protocolMap;
  QList<KPluginInfo>::ConstIterator it;
  QList<KPluginInfo> sorted;
  for ( it = mProtocols.constBegin(); it != mProtocols.constEnd(); ++it ) {
    protocolMap.insert( it->name(), (*it) );
  }

  QStringList keys = protocolMap.keys();
  keys.sort();
  QStringList::ConstIterator keyIt = keys.constBegin();
  QStringList::ConstIterator end = keys.constEnd();
  for ( ; keyIt != end; ++keyIt ) {
    sorted.append( protocolMap[*keyIt] );
  }
  mProtocols = sorted;
}
예제 #13
0
JavaDocs::JavaDocs(QWidget* parent, ScribusDoc *doc, ScribusView* vie) : QDialog( parent )
{
	setModal(true);
	setWindowTitle( tr( "Edit JavaScripts" ) );
	setWindowIcon(loadIcon("AppIcon.png"));
	Doc = doc;
	View = vie;
	JavaDocsLayout = new QHBoxLayout(this);
	JavaDocsLayout->setMargin(10);
	JavaDocsLayout->setSpacing(5);

	Scripts = new QListWidget( this );
	Scripts->setMinimumSize( QSize( 150, 200 ) );
	QMap<QString,QString>::Iterator it;
	for (it = Doc->JavaScripts.begin(); it != Doc->JavaScripts.end(); ++it)
		Scripts->addItem(it.key());
	JavaDocsLayout->addWidget( Scripts );

	Layout1 = new QVBoxLayout;
	Layout1->setMargin(0);
	Layout1->setSpacing(5);

	EditScript = new QPushButton( tr( "&Edit..." ), this);
	Layout1->addWidget( EditScript );

	AddScript = new QPushButton( tr( "&Add..." ), this);
	Layout1->addWidget( AddScript );

	DeleteScript = new QPushButton( tr( "&Delete" ), this);
	Layout1->addWidget( DeleteScript );
	QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
	Layout1->addItem( spacer );

	ExitDia = new QPushButton( tr( "&Close" ), this);
	ExitDia->setDefault( true );
	Layout1->addWidget( ExitDia );
	if (Doc->JavaScripts.count() == 0)
	{
		EditScript->setEnabled(false);
		DeleteScript->setEnabled(false);
	}
	JavaDocsLayout->addLayout( Layout1 );
	connect(AddScript, SIGNAL(clicked()), this, SLOT(slotAdd()));
	connect(EditScript, SIGNAL(clicked()), this, SLOT(slotEdit()));
	connect(DeleteScript, SIGNAL(clicked()), this, SLOT(slotDelete()));
	connect(ExitDia, SIGNAL(clicked()), this, SLOT(accept()));
	connect(Scripts, SIGNAL(itemActivated (QListWidgetItem *)), this, SLOT(slotEdit()));
	AddScript->setToolTip( "<qt>" + tr( "Adds a new Script, predefines a function with the same name. If you want to use this script as an \"Open Action\" script be sure not to change the name of the function." ) + "</qt>" );
}
예제 #14
0
TreeRegions::TreeRegions(QWidget * parent): ui(new Ui::TreeRegions) // ??
{
	ui->setupUi(this);
	setupModel();
	QObject::connect(ui->action_New, SIGNAL(triggered()), this, SLOT(slotAdd()));
	QObject::connect(ui->action_NewRoot, SIGNAL(triggered()), this, SLOT(slotAddRoot()));
	QObject::connect(ui->action_Delete, SIGNAL(triggered()), this, SLOT(slotDelete()));
	QObject::connect(ui->action_Edit, SIGNAL(triggered()), this, SLOT(slotEdit()));
	QObject::connect(ui->action_Yes, SIGNAL(triggered()), this, SLOT(slotSave()));
	QObject::connect(ui->action_No, SIGNAL(triggered()), this, SLOT(slotCancel()));
	QObject::connect(ui->treeView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
		this, SLOT(slotEnableButtons(const QItemSelection &, const QItemSelection &)));
	QObject::connect(this, SIGNAL(signalChangeEditMode()), this, SLOT(slotEnableButtons()));
	slotEnableButtons(QItemSelection(), QItemSelection());
}
예제 #15
0
int CDriverList::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QTableWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: signalChanged(); break;
        case 1: slotAdd(); break;
        case 2: slotEdit(); break;
        case 3: slotDelete(); break;
        case 4: slotLoad(); break;
        case 5: slotDoubleClick((*reinterpret_cast< QTableWidgetItem*(*)>(_a[1]))); break;
        }
        _id -= 6;
    }
    return _id;
}
예제 #16
0
void KMMimePartTree::itemRightClicked( QListViewItem* item,
                                       const QPoint& point )
{
    // TODO: remove this member var?
    mCurrentContextMenuItem = dynamic_cast<KMMimePartTreeItem*>( item );
    if ( 0 == mCurrentContextMenuItem ) {
        kdDebug(5006) << "Item was not a KMMimePartTreeItem!" << endl;
    }
    else {
        kdDebug(5006) << "\n**\n** KMMimePartTree::itemRightClicked() **\n**" << endl;

        QPopupMenu* popup = new QPopupMenu;
        if ( mCurrentContextMenuItem->node()->nodeId() > 2 &&
             mCurrentContextMenuItem->node()->typeString() != "Multipart" ) {
          popup->insertItem( SmallIcon("fileopen"), i18n("to open", "Open"), this, SLOT(slotOpen()) );
          popup->insertItem( i18n("Open With..."), this, SLOT(slotOpenWith()) );
          popup->insertItem( i18n("to view something", "View"), this, SLOT(slotView()) );
        }
        popup->insertItem( SmallIcon("filesaveas"),i18n( "Save &As..." ), this, SLOT( slotSaveAs() ) );
        /*
         * FIXME mkae optional?
        popup->insertItem( i18n( "Save as &Encoded..." ), this,
                           SLOT( slotSaveAsEncoded() ) );
        */
        popup->insertItem( i18n( "Save All Attachments..." ), this,
                           SLOT( slotSaveAll() ) );
        // edit + delete only for attachments
        if ( mCurrentContextMenuItem->node()->nodeId() > 2 &&
             mCurrentContextMenuItem->node()->typeString() != "Multipart" ) {
          popup->insertItem( SmallIcon("editcopy"), i18n("Copy"), this, SLOT(slotCopy()) );
          if ( GlobalSettings::self()->allowAttachmentDeletion() )
            popup->insertItem( SmallIcon("editdelete"), i18n( "Delete Attachment" ),
                               this, SLOT( slotDelete() ) );
          if ( GlobalSettings::self()->allowAttachmentEditing() )
            popup->insertItem( SmallIcon( "edit" ), i18n( "Edit Attachment" ),
                               this, SLOT( slotEdit() ) );
        }
        if ( mCurrentContextMenuItem->node()->nodeId() > 0 )
          popup->insertItem( i18n("Properties"), this, SLOT(slotProperties()) );
        popup->exec( point );
        delete popup;
        mCurrentContextMenuItem = 0;
    }
}
예제 #17
0
SegmentTool::SegmentTool(CompositionView* canvas, RosegardenDocument *doc)
        : BaseTool("SegmentTool", canvas),
        m_canvas(canvas),
        m_doc(doc)
{
    //RG_DEBUG << "SegmentTool::SegmentTool()";

    // Set up the actions for the right-click context menu.  Note that
    // all of these end up simply delegating to RosegardenMainWindow.
    createAction("edit_default", SLOT(slotEdit()));
    createAction("edit_matrix", SLOT(slotEditInMatrix()));
    createAction("edit_percussion_matrix", SLOT(slotEditInPercussionMatrix()));
    createAction("edit_notation", SLOT(slotEditAsNotation()));
    createAction("edit_event_list", SLOT(slotEditInEventList()));
    createAction("edit_pitch_tracker", SLOT(slotEditInPitchTracker()));
    // Can we get some of the following connectionless mojo for some
    // of these others too?
    // The undo and redo actions are available globally through
    // CommandHistory.  See ActionFileParser::findStandardAction() which
    // allows them to be found easily.  Since disparate parts of the
    // system need the exact same QAction objects, it might be a good
    // idea to introduce a global QAction repository for all QAction
    // objects.  RosegardenMainWindow might suffice.  This would also
    // simplify the implementation of a shortcut manager.
    //createAction("edit_undo", ...);  // handled by CommandHistory
    //createAction("edit_redo", ...);  // handled by CommandHistory
    createAction("edit_cut", SLOT(slotEditCut()));
    createAction("edit_copy", SLOT(slotEditCopy()));
    createAction("edit_paste", SLOT(slotEditPaste()));
    createAction("delete", SLOT(slotDeleteSelectedSegments()));
    createAction("join_segments", SLOT(slotJoinSegments()));
    createAction("quantize_selection", SLOT(slotQuantizeSelection()));
    createAction("repeat_quantize", SLOT(slotRepeatQuantizeSelection()));
    createAction("relabel_segment", SLOT(slotRelabelSegments()));
    createAction("transpose", SLOT(slotTransposeSegments()));
    createAction("select", SLOT(slotPointerSelected()));
    createAction("move", SLOT(slotMoveSelected()));
    createAction("draw", SLOT(slotDrawSelected()));
    createAction("erase", SLOT(slotEraseSelected()));
    createAction("resize", SLOT(slotResizeSelected()));
    createAction("split", SLOT(slotSplitSelected()));
}
예제 #18
0
imageViewer::imageViewer(QWidget *parent): QLabel(parent)
{
  addToLog("image creation",LOGIMAG);
  validImage=false;
  setFrameStyle(QFrame::Sunken | QFrame::Panel);
  QBrush b;
  QPalette palette;
  b.setTexture(QPixmap::fromImage(QImage(":/icons/transparency.png")));
  palette.setBrush(QPalette::Active,QPalette::Base,b);
  palette.setBrush(QPalette::Inactive,QPalette::Base,b);
  palette.setBrush(QPalette::Disabled,QPalette::Base,b);
  setPalette(palette);
  setBackgroundRole(QPalette::Base);
  setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);

  setBackgroundRole(QPalette::Dark);

  popup=new QMenu (this);
  newAct = new QAction(tr("&New"),this);
  connect(newAct, SIGNAL(triggered()), this, SLOT(slotNew()));
  loadAct = new QAction(tr("&Load"), this);
  connect(loadAct, SIGNAL(triggered()), this, SLOT(slotLoad()));
  toTXAct = new QAction(tr("&To TX"), this);
  connect(toTXAct, SIGNAL(triggered()), this, SLOT(slotToTX()));
  editAct = new QAction(tr("&Edit"), this);
  connect(editAct, SIGNAL(triggered()), this, SLOT(slotEdit()));
  printAct = new QAction(tr("&Print"), this);
  connect(printAct, SIGNAL(triggered()), this, SLOT(slotPrint()));
  deleteAct = new QAction(tr("&Delete"), this);
  connect(deleteAct, SIGNAL(triggered()), this, SLOT(slotDelete()));
  viewAct = new QAction(tr("&View"), this);
  connect(viewAct, SIGNAL(triggered()), this, SLOT(slotView()));
  propertiesAct = new QAction(tr("Propert&ies"), this);
  connect(propertiesAct, SIGNAL(triggered()), this, SLOT(slotProperties()));
  connect(configDialogPtr,SIGNAL(bgColorChanged()), SLOT(slotBGColorChanged()));

  init(RXIMG);
  activeMovie=false;
  //
}
예제 #19
0
void PerforcePart::contextMenu(QPopupMenu *popup, const Context *context)
{
    if (context->hasType( Context::FileContext )) {
        const FileContext *fcontext = static_cast<const FileContext*>(context);
        popupfile = fcontext->urls().first().path();
        QFileInfo fi( popupfile );
        popup->insertSeparator();

        KPopupMenu *sub = new KPopupMenu(popup);
        QString name = fi.fileName();
        sub->insertTitle( i18n("Actions for %1").arg(name) );

        int id = sub->insertItem( i18n("Edit"),
                           this, SLOT(slotEdit()) );
        sub->setWhatsThis(id, i18n("<b>Edit</b><p>Opens file(s) in a client workspace for edit."));
        id = sub->insertItem( i18n("Revert"),
                           this, SLOT(slotRevert()) );
        sub->setWhatsThis(id, i18n("<b>Revert</b><p>Discards changes made to open files."));
        id = sub->insertItem( i18n("Submit"),
                           this, SLOT(slotCommit()) );
        sub->setWhatsThis(id, i18n("<b>Submit</b><p>Sends changes made to open files to the depot."));
        id = sub->insertItem( i18n("Sync"),
                           this, SLOT(slotUpdate()) );
        sub->setWhatsThis(id, i18n("<b>Sync</b><p>Copies files from the depot into the workspace."));
        sub->insertSeparator();
        id = sub->insertItem( i18n("Diff Against Repository"),
                          this, SLOT(slotDiff()) );
        sub->setWhatsThis(id, i18n("<b>Diff against repository</b><p>Compares a client workspace file to a revision in the depot."));
        id = sub->insertItem( i18n("Add to Repository"),
                           this, SLOT(slotAdd()) );
        sub->setWhatsThis(id, i18n("<b>Add to repository</b><p>Open file(s) in a client workspace for addition to the depot."));
        id = sub->insertItem( i18n("Remove From Repository"),
                           this, SLOT(slotRemove()) );
        sub->setWhatsThis(id, i18n("<b>Remove from repository</b><p>Open file(s) in a client workspace for deletion from the depot."));
        id = popup->insertItem(i18n("Perforce"), sub);
    }
}
예제 #20
0
CManageDrivers::CManageDrivers( QWidget* pwidgetParent )
    : QWidget( pwidgetParent )
{
    QPushButton *ppushbuttonAdd = new QPushButton( tr( "A&dd..." ) );
    ppushbuttonAdd->setToolTip( tr( "click to add/register a driver" ) );
    ppushbuttonAdd->setWhatsThis( tr( "Click this to register a driver. Registering a driver informs the Driver Manager about its location and allows some driver-level options to be set. A well behaved driver installer will automatically register a driver but there are times when this needs to be done manually here. You will need to have elevated (root) privileges to do this." ) );

    QPushButton *ppushbuttonConfigure = new QPushButton( tr( "&Configure..." ) );
    ppushbuttonConfigure->setToolTip( tr( "click to configure the selected driver" ) );
    ppushbuttonConfigure->setWhatsThis( tr( "Click this to edit driver options. You will need to have elevated (root) privileges to do this." ) );

    QPushButton *ppushbuttonRemove = new QPushButton( tr( "&Remove" ) );
    ppushbuttonRemove->setToolTip( tr( "click to remove the selected driver" ) );
    ppushbuttonRemove->setWhatsThis( tr( "Click this to deregister the selected driver. This does not remove any files from the system. You will need to have elevated (root) privileges to do this." ) );

    QHBoxLayout *playout                = new QHBoxLayout;
    QVBoxLayout *playoutButtons         = new QVBoxLayout;
    CDriverList *pDriverList            = new CDriverList;

    playoutButtons->addWidget( ppushbuttonAdd );
    playoutButtons->addWidget( ppushbuttonConfigure );
    playoutButtons->addWidget( ppushbuttonRemove );
    playoutButtons->addStretch( 10 );

    playout->addWidget( pDriverList );
    playout->addLayout( playoutButtons );

    setLayout( playout );

    connect( ppushbuttonAdd, SIGNAL(clicked()), pDriverList, SLOT(slotAdd()) );
    connect( ppushbuttonConfigure, SIGNAL(clicked()), pDriverList, SLOT(slotEdit()) );
    connect( ppushbuttonRemove, SIGNAL(clicked()), pDriverList, SLOT(slotDelete()) );
    connect( pDriverList, SIGNAL(signalChanged()), this, SIGNAL(signalChanged()) );

    setWindowIcon( QPixmap( xpmDriver48 ) );
    setWindowTitle( tr( "Drivers" ) );
}
예제 #21
0
SegmentTool::SegmentTool(CompositionView* canvas, RosegardenDocument *doc)
        : BaseTool("SegmentTool", canvas),
        m_canvas(canvas),
        m_doc(doc),
        m_changeMade(false)
{
    //RG_DEBUG << "SegmentTool::SegmentTool()";

    // Set up the actions for the right-click context menu.  Note that
    // all of these end up simply delegating to RosegardenMainWindow.
    createAction("edit_default", SLOT(slotEdit()));
    createAction("edit_matrix", SLOT(slotEditInMatrix()));
    createAction("edit_percussion_matrix", SLOT(slotEditInPercussionMatrix()));
    createAction("edit_notation", SLOT(slotEditAsNotation()));
    createAction("edit_event_list", SLOT(slotEditInEventList()));
    createAction("edit_pitch_tracker", SLOT(slotEditInPitchTracker()));
    // Can we get some of the following connectionless mojo for some
    // of these others too?
    //createAction("edit_undo", ...);  // handled by a higher authority?
    //createAction("edit_redo", ...);  // handled by a higher authority?
    createAction("edit_cut", SLOT(slotEditCut()));
    createAction("edit_copy", SLOT(slotEditCopy()));
    createAction("edit_paste", SLOT(slotEditPaste()));
    createAction("delete", SLOT(slotDeleteSelectedSegments()));
    createAction("join_segments", SLOT(slotJoinSegments()));
    createAction("quantize_selection", SLOT(slotQuantizeSelection()));
    createAction("repeat_quantize", SLOT(slotRepeatQuantizeSelection()));
    createAction("relabel_segment", SLOT(slotRelabelSegments()));
    createAction("transpose", SLOT(slotTransposeSegments()));
    createAction("select", SLOT(slotPointerSelected()));
    createAction("move", SLOT(slotMoveSelected()));
    createAction("draw", SLOT(slotDrawSelected()));
    createAction("erase", SLOT(slotEraseSelected()));
    createAction("resize", SLOT(slotResizeSelected()));
    createAction("split", SLOT(slotSplitSelected()));
}
예제 #22
0
CustomFieldsEditWidget::CustomFieldsEditWidget( QWidget *parent )
  : QWidget( parent ), mReadOnly( false )
{
  QGridLayout *layout = new QGridLayout( this );
  layout->setMargin( 0 );



  mView = new QTreeView;
  mView->setSortingEnabled(true);
  mView->setRootIsDecorated( false );
  mView->setItemDelegate( new CustomFieldsDelegate( this ) );

  mAddButton = new QPushButton( i18n( "Add..." ) );
  mEditButton = new QPushButton( i18n( "Edit..." ) );
  mRemoveButton = new QPushButton( i18n( "Remove" ) );

  layout->addWidget( mView, 0, 0, 4, 1 );
  layout->addWidget( mAddButton, 0, 1 );
  layout->addWidget( mEditButton, 1, 1 );
  layout->addWidget( mRemoveButton, 2, 1 );

  mModel = new CustomFieldsModel( this );
  QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel;
  proxyModel->setDynamicSortFilter(true);
  proxyModel->setSourceModel(mModel);
  mView->setModel( proxyModel );
  mView->setColumnHidden( 2, true ); // hide the 'key' column

  connect( mView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
           this, SLOT(slotUpdateButtons()) );
  connect( mAddButton, SIGNAL(clicked()), this, SLOT(slotAdd()) );
  connect( mEditButton, SIGNAL(clicked()), this, SLOT(slotEdit()) );
  connect( mRemoveButton, SIGNAL(clicked()), this, SLOT(slotRemove()) );
  slotUpdateButtons();
}
예제 #23
0
void
ControlEditorDialog::slotUpdate(bool added)
{
    RG_DEBUG << "ControlEditorDialog::slotUpdate" << endl;

    MidiDevice *md =
        dynamic_cast<MidiDevice *>(m_studio->getDevice(m_device));
    if (!md)
        return ;

    ControlList::const_iterator it = md->beginControllers();
    ControlParameterItem *item;
    int i = 0;

    // Attempt to track last controller selected so we can reselect it
    int lastControllerId = -1;
    ControlParameterItem *lastItem = dynamic_cast<ControlParameterItem *>(m_treeWidget->currentItem());
    if (lastItem) {
        lastControllerId = lastItem->getId();
    }
    
    m_treeWidget->clear();

    for (; it != md->endControllers(); ++it) {
        Composition &comp = m_doc->getComposition();

        QString colour =
            strtoqstr(comp.getGeneralColourMap().getNameByIndex(it->getColourIndex()));

        if (colour == "")
            colour = tr("<default>");

        QString position = QString("%1").arg(it->getIPBPosition());
        if (position.toInt() == -1)
            position = tr("<not showing>");

        QString value;
        value.sprintf("%d (0x%x)", it->getControllerValue(),
                      it->getControllerValue());

        if (it->getType() == PitchBend::EventType) {
            item = new ControlParameterItem(
                                            i++,
                                            m_treeWidget,
                                            QStringList()
                                                << strtoqstr(it->getName())
                                                << strtoqstr(it->getType())
                                                << QString("-")
                                                << strtoqstr(it->getDescription())
                                                << QString("%1").arg(it->getMin())
                                                << QString("%1").arg(it->getMax())
                                                << QString("%1").arg(it->getDefault())
                                                << colour
                                                << position 
                                          );
        } else {
            item = new ControlParameterItem(
                            i++,
                            m_treeWidget,
                            QStringList()
                                << strtoqstr(it->getName())
                                << strtoqstr(it->getType())
                                << value
                                << strtoqstr(it->getDescription())
                                << QString("%1").arg(it->getMin())
                                << QString("%1").arg(it->getMax())
                                << QString("%1").arg(it->getDefault())
                                << colour
                                << position
                           );
        }

        if (item->getId() == lastControllerId) {
            m_treeWidget->setCurrentItem(item);
        }


        // create and set a colour pixmap
        //
        QPixmap colourPixmap(16, 16);
        Colour c = comp.getGeneralColourMap().getColourByIndex(it->getColourIndex());
        colourPixmap.fill(QColor(c.getRed(), c.getGreen(), c.getBlue()));
        
        item->setIcon(7, QIcon(colourPixmap));

        m_treeWidget->addTopLevelItem(item);
    }

    if(m_treeWidget->topLevelItemCount() == 0) {
        QTreeWidgetItem *item = new QTreeWidgetItem(m_treeWidget, QStringList(tr("<none>")));
        m_treeWidget->addTopLevelItem(item);

        m_treeWidget->setSelectionMode(QAbstractItemView::NoSelection);
    } else {
        m_treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
    }
    
    // This logic is kind of frigged up, and may be too fragile.  It assumes
    // that if you added an item, the last thing iterated through will be that
    // new item, so the value of the variable item will be the last thing
    // iterated through, and therefore the newest item you just added and want
    // to edit.
    //
    // I got substantially far along the way to making this quick and dirty hack
    // work before I thought it would be a lot cleaner to have the
    // AddControlParameterCommand itself launch the dialog and allow the user to
    // edit the parameters before ever adding it to the list at all.  That would
    // be a lot cleaner, but it would also require going against the flow of how
    // this logic always worked, so it would require a lot more thought to
    // achieve the same end result that way.  Instead, I just used this hack
    // overloaded slotUpdate() to tell it when a new controller was added, so we
    // could grab it here and launch the dialog on the generic blah we just added
    // to the list right before this slot got called with the optional bool set
    // true.
    //
    // (so much for verbose comments being helpful...  I wrote that not too long
    // ago, and reading it now, I have NO fscking idea what I was talking about)
    //
    if (added) {
        RG_DEBUG << "ControlEditorDialog: detected new item entered; launching editor" << endl;
        m_treeWidget->setCurrentItem(item);
        slotEdit(item, 0);
    }
}
예제 #24
0
PreFlightCheckListPage::PreFlightCheckListPage( QWidget* parent ) :
  QWidget( parent ),
  CheckListFileName("cumulus-checklist.txt")
{
  setObjectName("PreFlightCheckListPage");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("PreFlight - Checklist") );

  if( parent )
    {
      resize( parent->size() );
    }

  QVBoxLayout *contentLayout = new QVBoxLayout;
  setLayout(contentLayout);

  m_fileDisplay = new QLabel;
  m_fileDisplay->setWordWrap( true );
  m_fileDisplay->hide();
  contentLayout->addWidget( m_fileDisplay );

  QHBoxLayout *hbox = new QHBoxLayout;
  hbox->setMargin( 0 );
  contentLayout->addLayout( hbox );

  m_list = new QTableWidget( 0, 2, this );
  m_list->setSelectionBehavior( QAbstractItemView::SelectItems );
  m_list->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
  m_list->setAlternatingRowColors( true );
  m_list->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
  m_list->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );

  // calculates the needed icon size
  QFontMetrics qfm( font() );
  int iconSize = qfm.height();

  // Sets the icon size of a list entry
  m_list->setIconSize( QSize(iconSize, iconSize) );

  hbox->addWidget( m_list );

  connect( m_list, SIGNAL(cellDoubleClicked(int, int)),
           SLOT(slotEditCell(int, int)) );

  connect( m_list, SIGNAL(cellClicked(int, int)),
           SLOT(slotCellClicked(int, int)) );

#ifdef ANDROID
  QScrollBar* lvsb = m_list->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture(m_list->viewport(), QScroller::LeftMouseButtonGesture);
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture(m_list->viewport(), QtScroller::LeftMouseButtonGesture);
#endif

  QString style = "QTableView QTableCornerButton::section { background: gray }";
  m_list->setStyleSheet( style );
  QHeaderView *vHeader = m_list->verticalHeader();
  style = "QHeaderView::section { width: 2em }";
  vHeader->setStyleSheet( style );

  // set new row height from configuration
  int afMargin = GeneralConfig::instance()->getListDisplayAFMargin();
  rowDelegate = new RowDelegate( m_list, afMargin );
  m_list->setItemDelegate( rowDelegate );

  QHeaderView* hHeader = m_list->horizontalHeader();
  hHeader->setStretchLastSection( true );
  hHeader->hide();

  QTableWidgetItem *item = new QTableWidgetItem( tr(" Check Point ") );
  m_list->setHorizontalHeaderItem( 0, item );

#ifndef ANDROID
  int buttonSize = Layout::getButtonSize();
#else
  int buttonSize = Layout::getButtonSize(16);
#endif

  iconSize   = buttonSize - 5;

  QPushButton* toggleButton = new QPushButton(this);
  toggleButton->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("file-32.png")));
  toggleButton->setIconSize( QSize(iconSize, iconSize) );
  toggleButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  toggleButton->setMinimumSize(buttonSize, buttonSize);
  toggleButton->setMaximumSize(buttonSize, buttonSize);

  QPushButton *addButton = new QPushButton;
  addButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "add.png" ) ) );
  addButton->setIconSize(QSize(iconSize, iconSize));
  addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  addButton->setMinimumSize(buttonSize, buttonSize);
  addButton->setMaximumSize(buttonSize, buttonSize);

  m_editButton = new QPushButton(this);
  m_editButton->setIcon( QIcon(GeneralConfig::instance()->loadPixmap("edit_new.png")) );
  m_editButton->setIconSize( QSize(iconSize, iconSize) );
  m_editButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_editButton->setMinimumSize(buttonSize, buttonSize);
  m_editButton->setMaximumSize(buttonSize, buttonSize);

  m_deleteButton = new QPushButton;
  m_deleteButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "delete.png" ) ) );
  m_deleteButton->setIconSize( QSize(iconSize, iconSize) );
  m_deleteButton->setEnabled(false);
  m_deleteButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_deleteButton->setMinimumSize(buttonSize, buttonSize);
  m_deleteButton->setMaximumSize(buttonSize, buttonSize);

  QPushButton *cancel = new QPushButton(this);
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(iconSize, iconSize));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  cancel->setMinimumSize(buttonSize, buttonSize);
  cancel->setMaximumSize(buttonSize, buttonSize);

  m_ok = new QPushButton(this);
  m_ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  m_ok->setIconSize(QSize(iconSize, iconSize));
  m_ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_ok->setMinimumSize(buttonSize, buttonSize);
  m_ok->setMaximumSize(buttonSize, buttonSize);

  QLabel *titlePix = new QLabel(this);
  titlePix->setAlignment( Qt::AlignCenter );
  titlePix->setPixmap( _globalMapConfig->createGlider(315, 1.6) );

  connect( addButton, SIGNAL(pressed()), SLOT(slotAddRow()) );
  connect( toggleButton, SIGNAL(pressed()), SLOT(slotToogleFilenameDisplay()) );
  connect( m_editButton, SIGNAL(pressed()), SLOT(slotEdit()) );
  connect( m_deleteButton, SIGNAL(pressed()), SLOT(slotDeleteRows()) );
  connect( m_ok, SIGNAL(pressed()), SLOT(slotAccept()) );
  connect( cancel, SIGNAL(pressed()), SLOT(slotReject()) );

  QVBoxLayout *buttonBox = new QVBoxLayout;
  hbox->addLayout(buttonBox);

  buttonBox->setSpacing(0);
  buttonBox->addWidget(toggleButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(addButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_editButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_deleteButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(cancel);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_ok);
  buttonBox->addStretch(2);
  buttonBox->addWidget(titlePix);
}
예제 #25
0
    ServerListDialog::ServerListDialog(QWidget *parent, const char *name)
        : KDialogBase(Plain, i18n("Server List"), Ok|Close, Ok, parent, name, false)
    {
        setButtonOK(KGuiItem(i18n("C&onnect"), "connect_creating", i18n("Connect to the server"), i18n("Click here to connect to the selected IRC network and channel.")));

        QFrame* mainWidget = plainPage();

        m_serverList = new ServerListView(mainWidget);
        QWhatsThis::add(m_serverList, i18n("This shows the listof configured IRC networks. An IRC network is a collection of cooperating servers. You need only connect to one of the servers in the network to be connected to the entire IRC network. Once connected, Konversation will automatically join the channels shown. When Konversation is started for the first time, the Freenode network and the <i>#kde</i> channel are already entered for you."));
        m_serverList->setAllColumnsShowFocus(true);
        m_serverList->setRootIsDecorated(true);
        m_serverList->setResizeMode(QListView::AllColumns);
        m_serverList->addColumn(i18n("Network"));
        m_serverList->addColumn(i18n("Identity"));
        m_serverList->addColumn(i18n("Channels"));
        m_serverList->setSelectionModeExt(KListView::Extended);
        m_serverList->setShowSortIndicator(true);
        m_serverList->setSortColumn(0);
        m_serverList->setDragEnabled(true);
        m_serverList->setAcceptDrops(true);
        m_serverList->setDropVisualizer(true);
        m_serverList->header()->setMovingEnabled(false);

        m_addButton = new QPushButton(i18n("&New..."), mainWidget);
        QWhatsThis::add(m_addButton, i18n("Click here to define a new Network, including the server to connect to, and the Channels to automatically join once connected."));
        m_editButton = new QPushButton(i18n("&Edit..."), mainWidget);
        m_delButton = new QPushButton(i18n("&Delete"), mainWidget);

        QCheckBox* showAtStartup = new QCheckBox(i18n("Show at application startup"), mainWidget);
        showAtStartup->setChecked(Preferences::showServerList());
        connect(showAtStartup, SIGNAL(toggled(bool)), this, SLOT(setShowAtStartup(bool)));

        QGridLayout* layout = new QGridLayout(mainWidget, 5, 2, 0, spacingHint());

        layout->addMultiCellWidget(m_serverList, 0, 3, 0, 0);
        layout->addWidget(m_addButton, 0, 1);
        layout->addWidget(m_editButton, 1, 1);
        layout->addWidget(m_delButton, 2, 1);
        layout->addMultiCellWidget(showAtStartup, 4, 4, 0, 1);
        layout->setRowStretch(3, 10);

        m_serverList->setFocus();

        m_selectedItem = false;
        m_selectedServer = ServerSettings("");

        // Load server list
        updateServerList();

        connect(m_serverList, SIGNAL(aboutToMove()), this, SLOT(slotAboutToMove()));
        connect(m_serverList, SIGNAL(moved()), this, SLOT(slotMoved()));
        connect(m_serverList, SIGNAL(doubleClicked(QListViewItem *, const QPoint&, int)), this, SLOT(slotOk()));
        connect(m_serverList, SIGNAL(selectionChanged()), this, SLOT(updateButtons()));
        connect(m_serverList, SIGNAL(expanded(QListViewItem*)), this, SLOT(slotSetGroupExpanded(QListViewItem*)));
        connect(m_serverList, SIGNAL(collapsed(QListViewItem*)), this, SLOT(slotSetGroupCollapsed(QListViewItem*)));
        connect(m_addButton, SIGNAL(clicked()), this, SLOT(slotAdd()));
        connect(m_editButton, SIGNAL(clicked()), this, SLOT(slotEdit()));
        connect(m_delButton, SIGNAL(clicked()), this, SLOT(slotDelete()));

        updateButtons();

        KConfig* config = kapp->config();
        config->setGroup("ServerListDialog");
        QSize newSize = size();
        newSize = config->readSizeEntry("Size", &newSize);
        resize(newSize);

        m_serverList->setSelected(m_serverList->firstChild(), true);
    }
예제 #26
0
CTrackToolWidget::CTrackToolWidget(QTabWidget * parent)
: QWidget(parent)
, originator(false)
{
    setupUi(this);
    setObjectName("Tracks");
    parent->addTab(this,QIcon(":/icons/iconTrack16x16.png"),"");
    parent->setTabToolTip(parent->indexOf(this), tr("Tracks"));

    connect(&CTrackDB::self(), SIGNAL(sigModified(const QString&)), this, SLOT(slotDBChanged()));
    connect(&CTrackDB::self(), SIGNAL(sigNeedUpdate(const QString&)), this, SLOT(slotDBChanged()));
    connect(&CTrackDB::self(), SIGNAL(sigChanged()), this, SLOT(slotDBChanged()));

    connect(listTracks,SIGNAL(itemClicked(QListWidgetItem*) ),this,SLOT(slotItemClicked(QListWidgetItem*)));
    connect(listTracks,SIGNAL(itemDoubleClicked(QListWidgetItem*) ),this,SLOT(slotItemDoubleClicked(QListWidgetItem*)));
    connect(listTracks,SIGNAL(itemSelectionChanged()),this,SLOT(slotSelectionChanged()));

    contextMenu     = new QMenu(this);
    actEdit         = contextMenu->addAction(QPixmap(":/icons/iconEdit16x16.png"),tr("Edit..."),this,SLOT(slotEdit()));
    actRevert       = contextMenu->addAction(QPixmap(":/icons/iconReload16x16.png"),tr("Revert"),this,SLOT(slotRevert()));
    contextMenu->addSeparator();
    actDistance     = contextMenu->addAction(QPixmap(":/icons/iconDistance16x16.png"),tr("Make Overlay"),this,SLOT(slotToOverlay()));
    contextMenu->addSeparator();
    actHide         = contextMenu->addAction(tr("Show"),this,SLOT(slotShow()));
    actShowBullets  = contextMenu->addAction(tr("Show Bullets"),this,SLOT(slotShowBullets()));
    actShowMinMax   = contextMenu->addAction(tr("Show Min/Max"),this,SLOT(slotShowMinMax()));
    contextMenu->addSeparator();
    actZoomToFit    = contextMenu->addAction(QPixmap(":/icons/iconZoomArea16x16.png"),tr("Zoom to fit"),this,SLOT(slotZoomToFit()));
    actDel          = contextMenu->addAction(QPixmap(":/icons/iconClear16x16.png"),tr("Delete"),this,SLOT(slotDelete()));

    actHide->setCheckable(true);
    actShowBullets->setCheckable(true);
    actShowBullets->setChecked(CTrackDB::self().getShowBullets());
    actShowMinMax->setCheckable(true);
    actShowMinMax->setChecked(CTrackDB::self().getShowMinMax());

    connect(listTracks,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(slotContextMenu(const QPoint&)));

    QFontMetrics fm(listTracks->font());
    listTracks->setIconSize(QSize(15,N_LINES*fm.height()));

    connect(toolSortAlpha, SIGNAL(clicked()), this, SLOT(slotDBChanged()));
    connect(toolSortTime, SIGNAL(clicked()), this, SLOT(slotDBChanged()));

    toolSortAlpha->setIcon(QPixmap(":/icons/iconDec16x16.png"));
    toolSortTime->setIcon(QPixmap(":/icons/iconTime16x16.png"));

    SETTINGS;
    toolSortAlpha->setChecked(cfg.value("track/sortAlpha", true).toBool());
    toolSortTime->setChecked(cfg.value("track/sortTime", true).toBool());

    listTracks->installEventFilter(this);
}
예제 #27
0
    QStringList dirList;
    dirList << "Характеристики БЧ" << "Степень поражения" << "Нормативы поражения целей"
            << "Типовые размеры площадных целей" << "Таблица стрельбы";
    QListWidgetItem* dirItem = 0;
    foreach (QString str, dirList) {
        dirItem = new QListWidgetItem(str, directoryList);
        dirItem->setTextAlignment(Qt::AlignCenter);
    }

    connect(directoryList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotShowDirectoryInfo(QListWidgetItem*)));
    connect(upperTable, SIGNAL(itemSelectionChanged()), this, SLOT(slotShowLowerFireTable()));
    connect(upperTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(slotActivateEditDeleteButton()));
    connect(lowerTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(slotActivateEditDeleteButton()));

    connect(addAction, SIGNAL(triggered()), this, SLOT(slotAdd()));
    connect(editAction, SIGNAL(triggered()), this, SLOT(slotEdit()));
    connect(deleteAction, SIGNAL(triggered()), this, SLOT(slotDelete()));
    connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

    setCentralWidget(contentWindow);
    setWindowIcon(QIcon(":/resources/title.png"));
    setWindowTitle("Редактор нормативно-справочной информации");
}

void Editor::slotActivateEditDeleteButton() {
    editAction->setEnabled(true);
    deleteAction->setEnabled(true);
}

void Editor::slotShowDirectoryInfo(QListWidgetItem* dirItem) {
    addAction->setEnabled(true);
예제 #28
0
void CDeviceDetailView::constructLayout()
{
  // Create the buttons
  // ... edit
  pqPushButtonEdit = new QPushButton( QIcon( ":icons/32x32/edit.png" ), "" );
  pqPushButtonEdit->setMaximumSize( 36, 34 );
  pqPushButtonEdit->setToolTip( tr("Edit this device's configuration") );
  pqPushButtonEdit->setEnabled( false );
  QWidget::connect( pqPushButtonEdit, SIGNAL( clicked() ), this, SLOT( slotEdit() ) );
  // ... delete
  pqPushButtonDelete = new QPushButton( QIcon( ":icons/32x32/delete.png" ), "" );
  pqPushButtonDelete->setMaximumSize( 36, 34 );
  pqPushButtonDelete->setToolTip( tr("Delete this device") );
  pqPushButtonDelete->setEnabled( false );
  QWidget::connect( pqPushButtonDelete, SIGNAL( clicked() ), this, SLOT( slotDelete() ) );
  // ... stop
  pqPushButtonStop = new QPushButton( QIcon( ":icons/32x32/stop.png" ), "" );
  pqPushButtonStop->setMaximumSize( 36, 34 );
  pqPushButtonStop->setToolTip( tr("Stop this device") );
  pqPushButtonStop->setCheckable( true );
  pqPushButtonStop->setEnabled( false );
  QWidget::connect( pqPushButtonStop, SIGNAL( clicked() ), this, SLOT( slotStop() ) );
  // ... pause
  pqPushButtonPause = new QPushButton( QIcon( ":icons/32x32/pause.png" ), "" );
  pqPushButtonPause->setMaximumSize( 36, 34 );
  pqPushButtonPause->setToolTip( tr("Pause this device") );
  pqPushButtonPause->setCheckable( true );
  pqPushButtonPause->setEnabled( false );
  QWidget::connect( pqPushButtonPause, SIGNAL( clicked() ), this, SLOT( slotPause() ) );
  // ... start
  pqPushButtonStart = new QPushButton( QIcon( ":icons/32x32/start.png" ), "" );
  pqPushButtonStart->setMaximumSize( 36, 34 );
  pqPushButtonStart->setToolTip( tr("Start this device") );
  pqPushButtonStart->setCheckable( true );
  pqPushButtonStart->setEnabled( false );
  QWidget::connect( pqPushButtonStart, SIGNAL( clicked() ), this, SLOT( slotStart() ) );

  // Create layout
  QVBoxLayout* __pqVBoxLayout = new QVBoxLayout();

  // Add header
  QFont __qFontHeader;
  __qFontHeader.setPixelSize( 16 );
  __qFontHeader.setBold( true );
  QHBoxLayout* __pqHBoxLayoutHeader = new QHBoxLayout();
  QLabel* __pqLabelIcon = new QLabel();
  __pqLabelIcon->setPixmap( QPixmap( ":icons/32x32/device.png" ) );
  __pqLabelIcon->setToolTip( tr("Device") );
  __pqHBoxLayoutHeader->addWidget( __pqLabelIcon, 0, Qt::AlignTop );
  poTextName = new COverlayText();
  poTextName->setToolTip( tr("Name") );
  poTextName->setFont( __qFontHeader );
  poTextName->setWordWrap( true );
  __pqHBoxLayoutHeader->addWidget( poTextName, 1 );
  __pqVBoxLayout->addLayout( __pqHBoxLayoutHeader );

  // Add data
  QFont __qFontData;
  QTabWidget* __poTabWidget = new QTabWidget();
  __poTabWidget->setTabPosition( QTabWidget::South );
  __poTabWidget->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );

  // ... summary
  QWidget* __poWidgetSummary = new QWidget();
  QVBoxLayout* __pqVBoxLayoutSummary = new QVBoxLayout();
  __qFontData.setPixelSize( 20 );
  poTextDriver = new COverlayText();
  poTextDriver->setToolTip( tr("Driver") );
  poTextDriver->setFont( __qFontData );
  poTextDriver->setIndent( 10 );
  poTextDriver->setAlignment( Qt::AlignHCenter );
  poTextDriver->resetText();
  __pqVBoxLayoutSummary->addWidget( poTextDriver, 0 );
  pqLabelActivity = new COverlayText();
  pqLabelActivity->setToolTip( tr("Activity") );
  pqLabelActivity->setFont( __qFontData );
  pqLabelActivity->setIndent( 10 );
  pqLabelActivity->setAlignment( Qt::AlignHCenter );
  __pqVBoxLayoutSummary->addWidget( pqLabelActivity, 1 );
  __poWidgetSummary->setLayout( __pqVBoxLayoutSummary );
  __poTabWidget->addTab( __poWidgetSummary, tr("Summary") );

  // ... [end]
  __pqVBoxLayout->addWidget( __poTabWidget, 1 );

  // Add separator
  QFrame* __pqFrameSeparator = new QFrame();
  __pqFrameSeparator->setFrameStyle( QFrame::HLine | QFrame::Sunken );
  __pqVBoxLayout->addWidget( __pqFrameSeparator );

  // Add buttons
  QHBoxLayout* __pqHBoxLayoutButtons = new QHBoxLayout();
  __pqHBoxLayoutButtons->addWidget( pqPushButtonEdit, 0, Qt::AlignLeft );
  __pqHBoxLayoutButtons->addWidget( pqPushButtonDelete, 1, Qt::AlignLeft );
  __pqHBoxLayoutButtons->addWidget( pqPushButtonStop, 1, Qt::AlignRight );
  __pqHBoxLayoutButtons->addWidget( pqPushButtonPause, 0, Qt::AlignRight );
  __pqHBoxLayoutButtons->addWidget( pqPushButtonStart, 0, Qt::AlignRight );
  __pqVBoxLayout->addLayout( __pqHBoxLayoutButtons );

  // Set the layout
  COverlayObjectDetailView::setLayout( __pqVBoxLayout );

}