void Boot_Devices::orderChanged(QListWidgetItem *_item)
{
    bool sorted = false;
    int idx = devices->row( _item );
    if ( _item->checkState()==Qt::Checked ) {
        while (not sorted) {
            if ( idx-1<0 ) sorted = true;
            else {
                if ( devices->item(idx-1)->checkState()==Qt::Unchecked ) {
                    devices->setCurrentItem(_item);
                    itemUp();
                } else
                    sorted = true;
            };
            idx = devices->row( _item );
        };
    } else {
        while (not sorted) {
            if ( idx==devices->count()-1 ) sorted = true;
            else {
                if ( devices->item(idx+1)->checkState()==Qt::Checked ) {
                    devices->setCurrentItem(_item);
                    itemDown();
                } else
                    sorted = true;
            };
            idx = devices->row( _item );
        };
    };
}
Exemplo n.º 2
0
void Menu::loadMenuItems(ofDirectory directory, ofPtr< MenuItem > currentItem){
	// Each directory in the Presentations directory is a MenuItem:
	// - Directories with a presentation.xml file are Presentations.
	// - Directories with subdirectories are Categories.

	int i, size;

	// Check if there is a presentation.xml file.
	directory.listDir();
	directory.sort();
	size = directory.size();

	for(i = 0; i < size; i++){
		ofFile file = directory.getFile(i);
		if (file.isDirectory()){
			ofPtr<MenuItem> item(new MenuItem());
			item->name = file.getFileName();
			item->parent = currentItem;

			ofFile presentation = ofFile(file.getAbsolutePath() + "/presentation.xml");
			if(presentation.exists()){
				// Directory is a Presentation.
				item->isCategory = false;
				item->path = file.getAbsolutePath();
			} else {
				// Directory is a Category.
				item->isCategory = true;
				item->path = currentItem->path + " \/ " + item->name;

				// Add MenuItem to navigate up.
				ofPtr<MenuItem> itemUp(new MenuItem);
				itemUp->name = "...";
				itemUp->isMenuUp = true;
				itemUp->font = &font_small;
				itemUp->parent = item;
				item->items.push_back(itemUp);

				loadMenuItems(ofDirectory(file.path()), item);

			}
			item->font = &font_small;
			currentItem->items.push_back(item);
		}
	}
	if(currentItem->items.size() > 0){
		currentItem->items[0]->select();
	}
}
Exemplo n.º 3
0
ViewConfigurationDialog::ViewConfigurationDialog(Project *project, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ViewConfigurationDialog),
    mProject(project)
{
    ui->setupUi(this);

    mViewModel = new ViewsModel(mProject);
    ui->viewView->setModel( mViewModel );

    mTabsModel = 0;
    mItemsModel = 0;
    mPhrasalGlossesModel = 0;

    mView = 0;
    mTab = 0;

    connect(ui->addView, SIGNAL(clicked()), this, SLOT(addView()) );
    connect(ui->removeView, SIGNAL(clicked()), this, SLOT(removeView()) );

    connect(ui->addTab, SIGNAL(clicked()), this, SLOT(addTab()) );
    connect(ui->removeTab, SIGNAL(clicked()), this, SLOT(removeTab()) );

    connect(ui->addItem, SIGNAL(clicked()), this, SLOT(addItem()) );
    connect(ui->removeItem, SIGNAL(clicked()), this, SLOT(removeItem()) );
    connect(ui->itemView, SIGNAL(activated(QModelIndex)), this, SLOT(editItem(QModelIndex)) );

    connect(ui->addPhrasalGloss, SIGNAL(clicked()), this, SLOT(addPhrasalGloss()) );
    connect(ui->removePhrasalGloss, SIGNAL(clicked()), this, SLOT(removePhrasalGloss()) );
    connect(ui->phrasalGlossView, SIGNAL(activated(QModelIndex)), this, SLOT(editPhrasalGloss(QModelIndex)) );

    connect(ui->viewView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(viewChanged(QItemSelection,QItemSelection)));
    connect(ui->itemWritingSystemsCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(indexLanguageChanged(int)));

    connect(ui->viewUp, SIGNAL(clicked()), this, SLOT(viewUp()));
    connect(ui->viewDown, SIGNAL(clicked()), this, SLOT(viewDown()));
    connect(ui->tabUp, SIGNAL(clicked()), this, SLOT(tabUp()));
    connect(ui->tabDown, SIGNAL(clicked()), this, SLOT(tabDown()));
    connect(ui->itemUp, SIGNAL(clicked()), this, SLOT(itemUp()));
    connect(ui->itemDown, SIGNAL(clicked()), this, SLOT(itemDown()));
    connect(ui->phrasalGlossUp, SIGNAL(clicked()), this, SLOT(phrasalGlossUp()));
    connect(ui->phrasalGlossDown, SIGNAL(clicked()), this, SLOT(phrasalGlossDown()));

    setTabWidgetsEnabled(false);
    setItemWidgetsEnabled(false);
}
Boot_Devices::Boot_Devices(QWidget *parent) :
    QWidget(parent)
{
    up = new QPushButton(QIcon::fromTheme("go-up"), "", this);
    down = new QPushButton(QIcon::fromTheme("go-down"), "", this);
    devices = new QListWidget(this);
    commonLayout = new QGridLayout();
    commonLayout->addWidget(devices, 0, 1, 2, 1);
    commonLayout->addWidget(up, 0, 2);
    commonLayout->addWidget(down, 1, 2);
    setLayout(commonLayout);
    connect(up, SIGNAL(clicked()), this, SLOT(itemUp()));
    connect(down, SIGNAL(clicked()), this, SLOT(itemDown()));
    // dataChanged connections
    connect(devices, SIGNAL(itemChanged(QListWidgetItem*)),
            this, SIGNAL(dataChanged()));
    connect(devices, SIGNAL(itemChanged(QListWidgetItem*)),
            this, SLOT(orderChanged(QListWidgetItem*)));
    connect(devices, SIGNAL(currentRowChanged(int)),
            this, SIGNAL(dataChanged()));
}
// construct listview object
// -----------------------------------------------------------------------------
TTAudioListView::TTAudioListView( QWidget* parent, const char* name )
  :Q3ListView( parent, name )
{
  //no sorting
  setSorting( -1, false);

  setSelectionMode(Q3ListView::Single);
  setAllColumnsShowFocus(TRUE);

  setColumnWidth( 0, 250 );
  setColumnWidth( 1, 120 );
  setColumnWidth( 2, 120 );
  setColumnWidth( 3, 120 );
  setColumnWidth( 4, 120 );
  setColumnWidth( 5, 120 );
  setColumnWidth( 6, 120 );

  // Item context menu
  // ---------------------------------------------------------------------------
  itemContextMenu = new Q3PopupMenu(this, "itemContextMenu");

  itemContextMenu->insertItem("Move &up",      this, SLOT(itemUp()),    0,0);
  itemContextMenu->insertItem("Move d&own",    this, SLOT(itemDown()),  0,1);
  itemContextMenu->insertItem("&Delete",       this, SLOT(deleteItem()),0,2);

  // Listview context menue
  // ---------------------------------------------------------------------------
  //listContextMenu = new QPopupMenu(this, "listContextMenu");

  //listContextMenu->insertItem("tiny",       this, SLOT(setThumbsSize(int )), 0, 0);
  //listContextMenu->insertItem("small",      this, SLOT(setThumbsSize(int )), 0, 1);
  //listContextMenu->insertItem("medium",     this, SLOT(setThumbsSize(int )), 0, 2);
  //listContextMenu->insertItem("large",      this, SLOT(setThumbsSize(int )), 0, 3);
  //listContextMenu->insertItem("huge",       this, SLOT(setThumbsSize(int )), 0, 4);
  //listContextMenu->insertItem("gigantic",   this, SLOT(setThumbsSize(int )), 0, 5);
}
Exemplo n.º 6
0
void RegionEditDialog::on_addButton_clicked()
{
    RectFrame *aFrame=new RectFrame(mAttributes, this);

    if (ui->itemsLayout->count()==0)
    {
        aFrame->setUpEnabled(false);
    }
    else
    {
        ((RectFrame *)ui->itemsLayout->itemAt(ui->itemsLayout->count()-1)->widget())->setDownEnabled(true);
    }

    aFrame->setDownEnabled(false);

    connect(aFrame, SIGNAL(upPressed()),     this, SLOT(itemUp()));
    connect(aFrame, SIGNAL(downPressed()),   this, SLOT(itemDown()));
    connect(aFrame, SIGNAL(deletePressed()), this, SLOT(itemDelete()));

    ui->itemsLayout->addWidget(aFrame);
    ui->mainScrollArea->verticalScrollBar()->setValue(ui->mainScrollArea->verticalScrollBar()->maximum());

    updateCountButtons();
}