Пример #1
0
void PacmanView::refresh() {
    emit enableActions(false);
    if (waitView != NULL) {
        waitView->setVisible(true);
        setVisible(false);
    }

    prev_sel_model = selectionModel();
    _selEntry = PacmanEntry();
    if (prev_sel_model != NULL) {
        QModelIndexList sel_items = prev_sel_model->selectedRows();
        if (sel_items.count() > 0) _selEntry = row(sel_items[0]);
    }

    prev_model = model;
    if (model != NULL) model->removeRows(0,model->rowCount());
    reset();

    history_items.clear();
    history_index = -1;
    model = new PacmanItemModel(this);

    for (int i=0;i<model->columnCount();i++) {
        setItemDelegateForColumn(i,delegate);
    }

    PacmanRepositoryReader * pacrepreader = new PacmanRepositoryReader();
    connect(pacrepreader,SIGNAL(read_package(const PacmanEntry &)),this,SLOT(read_package(const PacmanEntry &)));
    connect(pacrepreader,SIGNAL(finished(PacmanProcessReader *)),this,SLOT(read_packages_finished(PacmanProcessReader *)));
}
Пример #2
0
void PacmanView::read_files_finished(PacmanProcessReader * ptr) {
    delete ptr;

    setModel(model);
    delegate->setModel(model);
    if (prev_model != NULL) delete prev_model;
    if (prev_sel_model != NULL) delete prev_sel_model;

    header()->setStretchLastSection(false);
    setHeaderSections();
#if QT_VERSION >= 0x050000
    header()->setSectionsMovable(false);
#else
    header()->setMovable(false);
#endif    

    if (waitView != NULL) {
        waitView->setVisible(false);
        setVisible(true);
    }


    emit canFillRepos(model->getRepos());
    emit canFillFilters(model->getGroups());
    emit refreshCompleted();

    if (_selEntry.isValid()) selectPackageByEntry(_selEntry);

    emit enableActions(true);
}
Пример #3
0
void Gui::open()
{  
  if (maybeSave()) {
    QSettings settings(LPUB,SETTINGS);
    QString modelDir;
    if (settings.contains("modelDir")) {
      modelDir = settings.value("modelDir").toString();
    } else {
      modelDir = Preferences::ldrawPath + "/MODELS";
    }

    QString fileName = QFileDialog::getOpenFileName(
      this,
      tr("Open LDraw File"),
      modelDir,
      tr("LDraw Files (*.DAT *.LDR *.MPD *.dat *.ldr *.mpd)"));

    if (!fileName.isEmpty()) {
      settings.setValue("modelDir",modelDir);
      openFile(fileName);
      displayPage();
      enableActions();
      return;
    }
  }
  return;
}
Пример #4
0
void ClientWidget::loadClients(const QString &str)
{
	if( str.isNull() || str.isEmpty() )
		return;

	QStringList list = str.split("\n");

	clientTable->Clear();
	accountTable->Clear();

	for(int i = 0; i < list.count(); i++)
	{
		QStringList t = list.at(i).split("\t");
		if( t.count() < clientTable->columnCount() )
			continue;

		clientTable->InsertRow(i);
		clientTable->setRowText(i, t);

		if( clientTable->text(i,0) == clientTable->text( i-1, 0 ) )
			clientTable->setRowHidden(i, true);
	}

	enableActions();


	sSocket->setConnection( host, port, qList[1] + "()" );
	info->showProgressBar( true );
}
Пример #5
0
void OutputWidget::nextOutput()
{
    if( stackwidget && stackwidget->currentIndex() < stackwidget->count()-1 )
    {
        stackwidget->setCurrentIndex( stackwidget->currentIndex()+1 );
    }
    enableActions();
}
Пример #6
0
void OutputWidget::previousOutput()
{
    if( stackwidget && stackwidget->currentIndex() > 0 )
    {
        stackwidget->setCurrentIndex( stackwidget->currentIndex()-1 );
    }
    enableActions();
}
Пример #7
0
void OutputWidget::addOutput( int id )
{
    QTreeView* listview = createListView(id);
    setCurrentWidget( listview );
    connect( data->outputdata.value(id), &OutputData::modelChanged, this, &OutputWidget::changeModel);
    connect( data->outputdata.value(id), &OutputData::delegateChanged, this, &OutputWidget::changeDelegate);

    enableActions();
}
void OutputWidget::addOutput( int id )
{
    QTreeView* listview = createListView(id);
    setCurrentWidget( listview );
    connect( data->outputdata.value(id), SIGNAL(modelChanged(int)), this, SLOT(changeModel(int)));
    connect( data->outputdata.value(id), SIGNAL(delegateChanged(int)), this, SLOT(changeDelegate(int)));
    
    enableActions();
}
OutputWidget::OutputWidget(QWidget* parent, ToolViewData* tvdata)
    : QWidget( parent ), tabwidget(0), data(tvdata)
{
    setWindowTitle(i18n("Output View"));
    setWindowIcon(tvdata->icon);
    QVBoxLayout* layout = new QVBoxLayout(this);
    layout->setMargin(0);
    if( data->type & KDevelop::IOutputView::MultipleView )
    {
        tabwidget = new KTabWidget(this);
        layout->addWidget( tabwidget );
        m_closeButton = new QToolButton( this );
        connect( m_closeButton, SIGNAL( clicked() ),
                 this, SLOT( closeActiveView() ) );
        m_closeButton->setIcon( KIcon("tab-close") );
        m_closeButton->adjustSize();
        m_closeButton->setToolTip( i18n( "Close the currently active output view") );
        tabwidget->setCornerWidget( m_closeButton, Qt::TopRightCorner );
    } else if ( data->type == KDevelop::IOutputView::HistoryView )
    {
        stackwidget = new QStackedWidget( this );
        layout->addWidget( stackwidget );

        previousAction = new KAction( KIcon( "go-previous" ), i18n("Previous"), this );
        connect(previousAction, SIGNAL(triggered()), this, SLOT(previousOutput()));
        addAction(previousAction);
        nextAction = new KAction( KIcon( "go-next" ), i18n("Next"), this );
        connect(nextAction, SIGNAL(triggered()), this, SLOT(nextOutput()));
        addAction(nextAction);
    }

    activateOnSelect = new KToggleAction( KIcon(), i18n("Select activated Item"), this );
    addAction(activateOnSelect);
    activateOnSelect->setChecked( true );
    focusOnSelect = new KToggleAction( KIcon(), i18n("Focus when selecting Item"), this );
    addAction(focusOnSelect);
    focusOnSelect->setChecked( false );


    connect( data, SIGNAL( outputAdded( int ) ),
             this, SLOT( addOutput( int ) ) );

    connect( this, SIGNAL( outputRemoved( int, int ) ),
             data->plugin, SIGNAL( outputRemoved( int, int ) ) );

    connect( data->plugin, SIGNAL(selectNextItem()), this, SLOT(selectNextItem()) );
    connect( data->plugin, SIGNAL(selectPrevItem()), this, SLOT(selectPrevItem()) );

    foreach( int id, data->outputdata.keys() )
    {
        changeModel( id );
        changeDelegate( id );
    }
    enableActions();
}
Пример #10
0
void ChessWidget::onMoveFound()
{
  enableActions(true);
  update();

  if ( autoPlay_ )
  {
    if ( goingToClose_ )
      return;

    onGo();
  }
}
Пример #11
0
void ChessWidget::onGo()
{
  if ( thread_.isRunning() )
    return;

  if ( computerAnswers() )
  {
    if ( useTimer_ )
    {
      enableActions(false);
      thread_.start();
    }
  }

  update();
  changed_ = true;
}
Пример #12
0
void OutputWidget::closeOtherViews()
{
    QWidget* widget = tabwidget->currentWidget();
    if (!widget)
        return;

    foreach (int id, views.keys()) {
        if (views.value(id) == widget) {
            continue; // leave the active view open
        }

        OutputData* od = data->outputdata.value(id);
        if (od->behaviour & KDevelop::IOutputView::AllowUserClose) {
            data->plugin->removeOutput( id );
        }
    }
    enableActions();
}
Пример #13
0
void OutputWidget::removeOutput( int id )
{
    if( data->outputdata.contains( id ) && views.contains( id ) )
    {
        QTreeView* view = views.value(id);
        if( data->type & KDevelop::IOutputView::MultipleView || data->type & KDevelop::IOutputView::HistoryView )
        {
            if( data->type & KDevelop::IOutputView::MultipleView )
            {
                int idx = tabwidget->indexOf( view );
                if( idx != -1 )
                {
                    tabwidget->removeTab( idx );
                    if( proxyModels.contains( idx ) )
                    {
                        delete proxyModels.take( idx );
                        filters.remove( idx );
                    }
                }
            } else
            {
                int idx = stackwidget->indexOf( view );
                if( idx != -1 && proxyModels.contains( idx ) )
                {
                    delete proxyModels.take( idx );
                    filters.remove( idx );
                }
                stackwidget->removeWidget( view );
            }
            delete view;
        } else
        {
            views.value( id )->setModel( 0 );
            views.value( id )->setItemDelegate( 0 );
            if( proxyModels.contains( 0 ) ) {
                delete proxyModels.take( 0 );
                filters.remove( 0 );
            }
        }
        views.remove( id );
        emit outputRemoved( data->toolViewId, id );
    }
    enableActions();
}
Пример #14
0
void FrostEdit::setActiveTabWidget(TabWidget* wid) {

	if (!wid) return;

	QWidget* curwid = wid->currentWidget();
	TextEdit* e = toTextEdit(curwid);

	TabWidgetFrame* frame = toTabWidgetFrame(wid->parentWidget());
	FrostDialog* diag =toFrostDialog(frame->parentWidget());
	if(diag == NULL)
		changeTitle(wid, wid->currentIndex());

	if(e == nullptr) {
		disableActions();
	} else {
		enableActions();
	}

}
Пример #15
0
void MainWindow::downloadError(const QUrl& url, const QString& error)
{
    statusBar()->showMessage("");

    const QString scheme = url.scheme().toLower();
    if (scheme == "http" || scheme == "ftp")
    {
	QMessageBox::warning(this, tr("Download Error"), tr("Failed to download %1: %2").arg(url.toString()).arg(error));
    }
    else
    {
	QMessageBox::warning(this, tr("Open Error"), tr("Failed to open %1").arg(url.toString()));
    }

    recentFiles.removeAll(url.toString());
    updateRecentFileActions();
    report->setData("");
    fileNamePane->setText("");
    enableActions();
}
Пример #16
0
void FrostEdit::currentTabPageChanged(int id) {
	if(id == -1) {
		disableActions();
		return;
	}
	QWidget* wid = mCurrentTabWidget->widget(id);
	if(wid == nullptr) {
		disableActions();
		return;
	}
	TextEdit* e = toTextEdit(wid);
	if(e != nullptr &&  e->document() != getActiveDocument())
		emit documentChanged(toDocument(e->document()));
	//if there's no editor, let's disable some buttons.
	if(e == nullptr) {
		disableActions();
	} else { //there was editor, enable them
		enableActions();
	}
}
Пример #17
0
void OutputWidget::raiseOutput(int id)
{
    if( views.contains(id) )
    {
        if( data->type & KDevelop::IOutputView::MultipleView )
        {
            int idx = tabwidget->indexOf( views.value(id) );
            if( idx >= 0 )
            {
                tabwidget->setCurrentIndex( idx );
            }
        } else if( data->type & KDevelop::IOutputView::HistoryView )
        {
            int idx = stackwidget->indexOf( views.value(id) );
            if( idx >= 0 )
            {
                stackwidget->setCurrentIndex( idx );
            }
        }
    }
    enableActions();
}
Пример #18
0
void MWindow::open(){ //Nie mo¿na otwieraæ wielu plików o tej samej nazwie
	#ifdef MYDEBUG
		qDebug() << "Startuje MWindow::open()";
	#endif
	//
	filePath = QFileDialog::getOpenFileName(this, tr("Otworz plik"), "",
	tr("Lista incydencji (*.agi)"));//Daæ w³aœciwe nazwy!!! przet³umaczyæ w³aœciwie //;;Adjacency matrix (*.ags);;Multi graph (binary) (*.agb)
	//
	if (filePath != "") {
		QFile file(filePath);
		if (!file.open(QIODevice::ReadOnly)) { 
			#ifdef MYDEBUG
				qDebug() << "Nie mogê otworzyæ pliku!";
			#endif
			QMessageBox::critical(this, tr("Blad"), tr("Nie moge otworzyc pliku"));
			return;
		}
		fileContent.clear();
		QTextStream in(&file);//Czytanie do strumienia tekstowego
        fileContent = in.readAll();
        file.close();
		QString slash = "/";
		int position = filePath.lastIndexOf(slash);
		fileName = filePath.right((filePath.size() - position) - 1); //Wyci¹gniêcie nazwy pliku ze œcie¿ki
		if(centralWidgetPtr->isAlreadyOpened(fileName)){
			QMessageBox::warning(this, tr("Uwaga"), tr("Plik zostal juz otwarty wczesniej"));
			return;
		}
		engine->parseTextStream(fileName, fileContent); //Parsowanie pliku i dodawanie do pamiêci
		centralWidgetPtr->addToList(fileName); //Ustawianie odpowiedniego elementu w combobox
		++opened;
		enableActions();
	}
	//
	#ifdef MYDEBUG
		qDebug() << "Konczy sie MWindow::open()";
	#endif
}
Пример #19
0
void MainWindow::documentLoaded()
{
    enableActions();
}
Пример #20
0
void ClientWidget::loadEnv()
{
	qList << "get_full_client_list" << "get_client_stats" << "get_client_account_list" << "check_if_owner_has_something" 
		<< "delete_owner" << "delete_account";

	socket = new QuerySocket( this );
	connect( socket, SIGNAL( canGetData() ), this, SLOT( chooseLoadData() ) );
	connect( socket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) );
	connect( socket, SIGNAL( stateChanged( QAbstractSocket::SocketState ) ), this, SLOT( enableActions() ) );

	sSocket = new QuerySocket( this );
	connect( sSocket, SIGNAL( canGetData() ), this, SLOT( loadStats() ) );
	connect( sSocket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) );
	connect( sSocket, SIGNAL( stateChanged( QAbstractSocket::SocketState ) ), this, SLOT( enableActions() ) );
}
Пример #21
0
OutputWidget::OutputWidget(QWidget* parent, const ToolViewData* tvdata)
    : QWidget( parent )
    , tabwidget(0)
    , stackwidget(0)
    , data(tvdata)
    , m_closeButton(0)
    , m_closeOthersAction(0)
    , nextAction(0)
    , previousAction(0)
    , activateOnSelect(0)
    , focusOnSelect(0)
    , filterInput(0)
    , filterAction(0)
{
    setWindowTitle(i18n("Output View"));
    setWindowIcon(tvdata->icon);
    QVBoxLayout* layout = new QVBoxLayout(this);
    layout->setMargin(0);
    if( data->type & KDevelop::IOutputView::MultipleView )
    {
        tabwidget = new QTabWidget(this);
        layout->addWidget( tabwidget );
        m_closeButton = new QToolButton( this );
        connect( m_closeButton, &QToolButton::clicked, this, &OutputWidget::closeActiveView );
        m_closeButton->setIcon( QIcon::fromTheme( QStringLiteral( "tab-close") ) );
        m_closeButton->setToolTip( i18n( "Close the currently active output view") );

        m_closeOthersAction = new QAction( this );
        connect(m_closeOthersAction, &QAction::triggered, this, &OutputWidget::closeOtherViews);
        m_closeOthersAction->setIcon(QIcon::fromTheme(QStringLiteral("tab-close-other")));
        m_closeOthersAction->setToolTip( i18n( "Close all other output views" ) );
        m_closeOthersAction->setText( m_closeOthersAction->toolTip() );
        addAction(m_closeOthersAction);

        tabwidget->setCornerWidget(m_closeButton, Qt::TopRightCorner);
    } else if ( data->type == KDevelop::IOutputView::HistoryView )
    {
        stackwidget = new QStackedWidget( this );
        layout->addWidget( stackwidget );

        previousAction = new QAction( QIcon::fromTheme( QStringLiteral( "arrow-left" ) ), i18n("Previous Output"), this );
        connect(previousAction, &QAction::triggered, this, &OutputWidget::previousOutput);
        addAction(previousAction);
        nextAction = new QAction( QIcon::fromTheme( QStringLiteral( "arrow-right" ) ), i18n("Next Output"), this );
        connect(nextAction, &QAction::triggered, this, &OutputWidget::nextOutput);
        addAction(nextAction);
    }

    addAction(dynamic_cast<QAction*>(data->plugin->actionCollection()->action(QStringLiteral("prev_error"))));
    addAction(dynamic_cast<QAction*>(data->plugin->actionCollection()->action(QStringLiteral("next_error"))));

    activateOnSelect = new KToggleAction( QIcon(), i18n("Select activated Item"), this );
    activateOnSelect->setChecked( true );
    focusOnSelect = new KToggleAction( QIcon(), i18n("Focus when selecting Item"), this );
    focusOnSelect->setChecked( false );
    if( data->option & KDevelop::IOutputView::ShowItemsButton )
    {
        addAction(activateOnSelect);
        addAction(focusOnSelect);
    }

    QAction *separator = new QAction(this);
    separator->setSeparator(true);
    addAction(separator);

    QAction* action;

    action = new QAction(QIcon::fromTheme(QStringLiteral("go-first")), i18n("First Item"), this);
    connect(action, &QAction::triggered, this, &OutputWidget::selectFirstItem);
    addAction(action);

    action = new QAction(QIcon::fromTheme(QStringLiteral("go-previous")), i18n("Previous Item"), this);
    connect(action, &QAction::triggered, this, &OutputWidget::selectPreviousItem);
    addAction(action);

    action = new QAction(QIcon::fromTheme(QStringLiteral("go-next")), i18n("Next Item"), this);
    connect(action, &QAction::triggered, this, &OutputWidget::selectNextItem);
    addAction(action);

    action = new QAction(QIcon::fromTheme(QStringLiteral("go-last")), i18n("Last Item"), this);
    connect(action, &QAction::triggered, this, &OutputWidget::selectLastItem);
    addAction(action);

    QAction* selectAllAction = KStandardAction::selectAll(this, SLOT(selectAll()), this);
    selectAllAction->setShortcut(QKeySequence()); //FIXME: why does CTRL-A conflict with Katepart (while CTRL-Cbelow doesn't) ?
    selectAllAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    addAction(selectAllAction);

    QAction* copyAction = KStandardAction::copy(this, SLOT(copySelection()), this);
    copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    addAction(copyAction);

    if( data->option & KDevelop::IOutputView::AddFilterAction )
    {
        QAction *separator = new QAction(this);
        separator->setSeparator(true);
        addAction(separator);

        filterInput = new QLineEdit();
        filterInput->setMaximumWidth(150);
        filterInput->setMinimumWidth(100);
        filterInput->setPlaceholderText(i18n("Search..."));
        filterInput->setClearButtonEnabled(true);
        filterInput->setToolTip(i18n("Enter a wild card string to filter the output view"));
        filterAction = new QWidgetAction(this);
        filterAction->setDefaultWidget(filterInput);
        addAction(filterAction);

        connect(filterInput, &QLineEdit::textEdited,
                this, &OutputWidget::outputFilter );
        if( data->type & KDevelop::IOutputView::MultipleView )
        {
            connect(tabwidget, &QTabWidget::currentChanged,
                    this, &OutputWidget::updateFilter);
        } else if ( data->type == KDevelop::IOutputView::HistoryView )
        {
            connect(stackwidget, &QStackedWidget::currentChanged,
                    this, &OutputWidget::updateFilter);
        }
    }

    addActions(data->actionList);

    connect( data, &ToolViewData::outputAdded,
             this, &OutputWidget::addOutput );

    connect( this, &OutputWidget::outputRemoved,
             data->plugin, &StandardOutputView::outputRemoved );

    foreach( int id, data->outputdata.keys() )
    {
        changeModel( id );
        changeDelegate( id );
    }
    enableActions();
}
Пример #22
0
QTreeView* OutputWidget::createListView(int id)
{
    auto createHelper = [&]() -> QTreeView* {
        KDevelop::FocusedTreeView* listview = new KDevelop::FocusedTreeView(this);
        listview->setEditTriggers( QAbstractItemView::NoEditTriggers );
        listview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); //Always enable the scrollbar, so it doesn't flash around
        listview->setHeaderHidden(true);
        listview->setUniformRowHeights(true);
        listview->setRootIsDecorated(false);
        listview->setSelectionMode( QAbstractItemView::ContiguousSelection );

        if (data->outputdata.value(id)->behaviour & KDevelop::IOutputView::AutoScroll) {
            listview->setAutoScrollAtEnd(true);
        }

        connect(listview, &QTreeView::activated, this, &OutputWidget::activate);
        connect(listview, &QTreeView::clicked, this, &OutputWidget::activate);

        return listview;
    };

    QTreeView* listview = 0;
    if( !views.contains(id) )
    {
        bool newView = true;

        if( data->type & KDevelop::IOutputView::MultipleView || data->type & KDevelop::IOutputView::HistoryView )
        {
            qCDebug(PLUGIN_STANDARDOUTPUTVIEW) << "creating listview";
            listview = createHelper();

            if( data->type & KDevelop::IOutputView::MultipleView )
            {
                tabwidget->addTab( listview, data->outputdata.value(id)->title );
            } else
            {
                stackwidget->addWidget( listview );
                stackwidget->setCurrentWidget( listview );
            }
        } else
        {
            if( views.isEmpty() )
            {
                listview = createHelper();

                layout()->addWidget( listview );
            } else
            {
                listview = views.begin().value();
                newView = false;
            }
        }
        views[id] = listview;

        changeModel( id );
        changeDelegate( id );

        if (newView)
            listview->scrollToBottom();
    } else
    {
        listview = views.value(id);
    }
    enableActions();
    return listview;
}