Ejemplo n.º 1
0
TeamMenu::TeamMenu(TeamBuilder *tb, QAbstractItemModel *pokeModel, TeamHolder *team, int index) :
    ui(new _ui()), m_team(team), lastGen(team->team().gen())
{
    setMainWindow(tb);
    setTeambuilder(tb);
    PokeEdit::hackMons = team->team().hackMons() == "true";
    ui->pokemonModel = pokeModel;
    setupUi();
    updateTabs();

    if (0) {
        addDock(PokeEdit::EVDock, Qt::RightDockWidgetArea, new QDockWidget(tr("EVs"), this));
        addDock(PokeEdit::LevelDock, Qt::RightDockWidgetArea, new QDockWidget(tr("Level && Gender"), this));
        addDock(PokeEdit::MoveDock, Qt::BottomDockWidgetArea, new QDockWidget(tr("Moves"), this));
        addDock(PokeEdit::IVDock, Qt::BottomDockWidgetArea, new QDockWidget(tr("IVs, Ability && Hidden Power"), this));

        window->splitDockWidget(getDock(PokeEdit::EVDock), getDock(PokeEdit::LevelDock), Qt::Horizontal);

//        getDock(PokeEdit::MoveDock)->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
//        getDock(PokeEdit::EVDock)->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Ignored);
//        getDock(PokeEdit::IVDock)->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    }

    switchToTab(index);
}
Ejemplo n.º 2
0
void QtMaterialTabs::setRippleStyle(Material::RippleStyle style)
{
    Q_D(QtMaterialTabs);

    d->rippleStyle = style;
    updateTabs();
}
Ejemplo n.º 3
0
void LPMain::openConfigGUI(){
  qDebug() << "Open Configuration UI";
  QString ds = ui->combo_pools->currentText();
  if(ds.isEmpty()){ return; }
  LPConfig CFG(this);
  CFG.loadDataset(ds, LPBackend::listReplicationTargets().contains(ds));
  CFG.exec();
  //Now check for return values and update appropriately
  bool change = false;
  if(CFG.localChanged){
    ui->statusbar->showMessage(QString(tr("Configuring dataset: %1")).arg(ds),0);
    qDebug() << "Settings up local snapshots:" << ds << "Frequency:" << CFG.localSchedule;
    LPBackend::setupDataset(ds, CFG.localSchedule, CFG.localSnapshots);
    ui->statusbar->clearMessage();
    change = true;
  }
  if(CFG.remoteChanged){
    change = true;
    if(CFG.isReplicated){
      ui->statusbar->showMessage(QString(tr("Configuring replication: %1")).arg(ds),0);
      qDebug() << "Setting up Replication:" << ds << " Frequency:" << CFG.remoteFreq;
      LPBackend::setupReplication(ds, CFG.remoteHost, CFG.remoteUser, CFG.remotePort, CFG.remoteDataset, CFG.remoteFreq);
      QMessageBox::information(this,tr("Reminder"),tr("Don't forget to save your SSH key to a USB stick so that you can restore your system from the remote host later!!"));
    }else{
      ui->statusbar->showMessage(QString(tr("Removing replication: %1")).arg(ds),0);
      qDebug() << "Removing Replication:" << ds;
      LPBackend::removeReplication(ds);
    }
    ui->statusbar->clearMessage();
  }
  //Now update the UI if appropriate
  if(change){
    updateTabs();
  }	
}
Ejemplo n.º 4
0
// ==== Disks Menu ====
void LPMain::menuAddDisk(){
  QString pool = ui->combo_pools->currentText();
  //Get the available disks and remove the current disks
  QStringList adisks = LPGUtils::listAvailableHardDisks();
  for(int i=0; i<POOLDATA.harddisks.length(); i++){
    adisks.removeAll( POOLDATA.harddisks[i].section("s",0,0,QString::SectionSkipEmpty) );
  }
  if(adisks.isEmpty()){
    QMessageBox::information(this,tr("Attach New Disk"), tr("No available disks could be found"));
    return;
  }
  //Find a disk that can be added to the system
  bool ok=false;
  QString disk = QInputDialog::getItem(this, tr("Attach New Disk"),tr("Detected Disks:"), adisks,0,false, &ok);
  if( !ok || disk.isEmpty() ){ return; }
  qDebug() << "Add Disk:" << disk << pool;
  showWaitBox(tr("Attaching disk"));
  ok = LPBackend::attachDisk(pool, disk);
  hideWaitBox();
  if(ok){
    QMessageBox::information(this,tr("Disk Attached"),QString(tr("Success: %1 was added to %2")).arg(disk,pool) );
    QTimer::singleShot(0,this,SLOT(updateTabs()) );
  }else{
    QMessageBox::warning(this,tr("Disk Attach Error"),QString(tr("Failure: %1 could not be attached to %2.")).arg(disk,pool) );
  }	
}
Ejemplo n.º 5
0
void TabBarWidget::addTab(int index, Window *window)
{
	insertTab(index, window->getTitle());
	setTabData(index, window->getIdentifier());

	connect(window, SIGNAL(iconChanged(QIcon)), this, SLOT(updateTabs()));
	connect(window, SIGNAL(loadingStateChanged(WindowLoadingState)), this, SLOT(updateTabs()));
	connect(window, SIGNAL(isPinnedChanged(bool)), this, SLOT(updatePinnedTabsAmount()));

	if (window->isPinned())
	{
		updatePinnedTabsAmount();
	}

	updateTabs(index);
}
Ejemplo n.º 6
0
void QtMaterialTabs::setHaloVisible(bool value)
{
    Q_D(QtMaterialTabs);

    d->showHalo = value;
    updateTabs();
}
Ejemplo n.º 7
0
void TabBarWidget::tabInserted(int index)
{
	setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);

	QTabBar::tabInserted(index);

	if (m_showUrlIcon)
	{
		QLabel *label = new QLabel();
		label->setFixedSize(QSize(16, 16));

		setTabButton(index, m_iconButtonPosition, label);
	}
	else
	{
		setTabButton(index, m_iconButtonPosition, NULL);
	}

	if (m_showCloseButton || getTabProperty(index, QLatin1String("isPinned"), false).toBool())
	{
		QLabel *label = new QLabel();
		label->setFixedSize(QSize(16, 16));
		label->installEventFilter(this);

		setTabButton(index, m_closeButtonPosition, label);
	}

	updateTabs();

	emit tabsAmountChanged(count());
}
Ejemplo n.º 8
0
void CtrlrLuaMethodEditor::tabChanged(CtrlrLuaMethodCodeEditor *codeEditor, const bool save, const bool recompile)
{
	if (codeEditor == nullptr)
	{
		jassertfalse; // that's not nice
		return;
	}

	for (int i=0; i<methodEditArea->getTabs()->getNumTabs(); i++)
	{
		if (methodEditArea->getTabs()->getTabContentComponent(i) == codeEditor)
		{
			const String n = methodEditArea->getTabs()->getTabNames() [i];

			if (codeEditor->getMethod())
			{
				if (!n.endsWith("*"))
				{
					if (codeEditor->getMethod()->getName() != n)
					{
						/* the name of the method changed, update it */
						methodEditArea->getTabs()->setTabName (i, codeEditor->getMethod()->getName());
					}
				}
				else
				{
					if (codeEditor->getMethod()->getName() != n.substring(0, n.length()-1))
					{
						methodEditArea->getTabs()->setTabName (i, codeEditor->getMethod()->getName() + "*");
					}
				}
			}

			if (codeEditor->getCodeDocument().hasChangedSinceSavePoint())
			{
				if (n.endsWith("*"))
				{
					return;
				}
				else
				{
					methodEditArea->getTabs()->setTabName (i, n + "*");
				}
			}
			else if (n.endsWith("*"))
			{
				methodEditArea->getTabs()->setTabName (i, n.substring (0,n.length()-1));
			}
		}
	}

	if (codeEditor->getMethod() && (recompile || save))
	{
		// methodEditArea->insertOutput (codeEditor->getMethod()->getLastError(), codeEditor->getMethod()->isValid() ? Colours::green : Colours::red);
		methodEditArea->insertOutput(codeEditor->getMethod()->getLastError());
	}

	updateTabs();
}
Ejemplo n.º 9
0
void TabBarWidget::addTab(int index, Window *window)
{
	insertTab(index, window->getTitle());
	setTabData(index, QVariant::fromValue(window));

	connect(window, SIGNAL(iconChanged(QIcon)), this, SLOT(updateTabs()));
	connect(window, SIGNAL(loadingStateChanged(WindowLoadingState)), this, SLOT(updateTabs()));
	connect(window, SIGNAL(isPinnedChanged(bool)), this, SLOT(updatePinnedTabsAmount()));
	connect(tabButton(index, QTabBar::LeftSide), SIGNAL(destroyed()), window, SLOT(deleteLater()));

	if (window->isPinned())
	{
		updatePinnedTabsAmount();
	}

	updateTabs(index);
}
Ejemplo n.º 10
0
void TabBarWidget::tabInserted(int index)
{
	QTabBar::tabInserted(index);

	QLabel *label = new QLabel();
	label->setFixedSize(QSize(16, 16));

	setTabButton(index, QTabBar::LeftSide, label);
	updateTabs();
}
Ejemplo n.º 11
0
void QtMaterialTabs::setTextColor(const QColor &color)
{
    Q_D(QtMaterialTabs);

    d->textColor = color;

    MATERIAL_DISABLE_THEME_COLORS
    updateTabs();
    update();
}
Ejemplo n.º 12
0
void TabBarWidget::tabInserted(int index)
{
	QTabBar::tabInserted(index);

	QLabel *label = new QLabel();
	label->setFixedSize(QSize(16, 16));

	setTabButton(index, m_iconButtonPosition, label);
	updateTabs();
}
Ejemplo n.º 13
0
// ==============
//     PRIVATE SLOTS
// ==============
void LPMain::updatePoolList(){
  //Get the currently selected pool (if there is one)
  qDebug() << "Update Pool List";
  QString cPool;
  if(ui->combo_pools->currentIndex() != -1){ cPool = ui->combo_pools->currentText(); }
  //Get the list of managed pools
  qDebug() << "[DEBUG] Fetching list of pools";
  QStringList pools = LPBackend::listDatasets();
  QStringList poolsAvail = LPBackend::listPossibleDatasets();
  //Now put the lists into the UI
  ui->combo_pools->clear();
  if(!pools.isEmpty()){ ui->combo_pools->addItems(pools); }
  //Now set the currently selected pools
  qDebug() << "[DEBUG] Pool list:" << pools;
  if(pools.length() > 0){
    poolSelected=true;	  
    int index = pools.indexOf(cPool);
    if(index < 0){ ui->combo_pools->setCurrentIndex(0); }
    else{ ui->combo_pools->setCurrentIndex(index); }
  }else{
    //No managed pools
    poolSelected=false;
    ui->combo_pools->addItem("No Managed Pools!");
    ui->combo_pools->setCurrentIndex(0);
    //Reset to Basic View
    viewBasic->setChecked(true);
  }
  qDebug() << "[DEBUG] Update pool menu options";
  //Now update the add/remove pool menu's
  ui->menuManage_Pool->clear();
  for( int i=0; i<poolsAvail.length(); i++){
    if(pools.contains(poolsAvail[i])){ continue; } //already managed
    ui->menuManage_Pool->addAction(poolsAvail[i]);
  }
  ui->menuManage_Pool->setEnabled( !ui->menuManage_Pool->isEmpty() );
  ui->menuUnmanage_Pool->clear();
  for( int i=0; i<pools.length(); i++){
    ui->menuUnmanage_Pool->addAction(pools[i]);
  }
  ui->menuUnmanage_Pool->setEnabled( !ui->menuUnmanage_Pool->isEmpty() );
  qDebug() << "[DEBUG] Update user menus";
  //Now update the user's that are available for home-dir packaging
  QDir hdir("/usr/home");
  QStringList users = hdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
  ui->menuCompress_Home_Dir->clear();
  for(int i=0; i<users.length(); i++){
    ui->menuCompress_Home_Dir->addAction(users[i]);
  }
  //Now update the interface appropriately
  ui->combo_pools->setEnabled(poolSelected);
  qDebug() << "[DEBUG] Finished updatePoolList()";
  updateTabs();
}
Ejemplo n.º 14
0
// ==== Snapshots Menu ====
void LPMain::menuNewSnapshot(){
  qDebug() << "New Snapshot";
  QString ds = ui->combo_pools->currentText();
  if(ds.isEmpty()){return; }
  //Get the new snapshot name from the user
  bool ok;
  QString name = QInputDialog::getText(this,tr("New Snapshot Name"), tr("Snapshot Name:"), QLineEdit::Normal, tr("Name"), &ok, 0, Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly | Qt::ImhDigitsOnly );
  if(!ok || name.isEmpty()){ return; } //cancelled
  qDebug() << "Creating a new snapshot:" << ds << name;
  //Now create the new snapshot
  LPBackend::newSnapshot(ds,name);
  QMessageBox::information(this,tr("Snapshot Pending"), tr("The new snapshot creation has been added to the queue"));
  updateTabs();
}
Ejemplo n.º 15
0
void LPMain::menuRemoveSnapshot(QAction *act){
  QString snapshot = act->text();
  QString pool = ui->combo_pools->currentText();
  qDebug() << "Remove Snapshot:" << snapshot;
  //verify snapshot removal
  if( QMessageBox::Yes == QMessageBox::question(this,tr("Verify Snapshot Deletion"),QString(tr("Do you wish to delete this snapshot? %1")).arg(pool+"/"+snapshot)+"\n"+tr("WARNING: This is a permanant change that cannot be reversed"),QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
    bool ok = LPBackend::removeSnapshot(ui->combo_pools->currentText(), snapshot);
    if(ok){
      QMessageBox::information(this,tr("Snapshot Removed"),tr("The snapshot was successfully deleted"));
    }else{
      QMessageBox::information(this,tr("Snapshot Removal Failure"),tr("The snapshot removal experienced an error and it not be completed at this time."));
    }
    updateTabs();
  }
}
Ejemplo n.º 16
0
void TabBarWidget::tabRemoved(int index)
{
	QTabBar::tabRemoved(index);

	if (count() == 0)
	{
		setMaximumSize(0, 0);
	}
	else
	{
		QTimer::singleShot(100, this, SLOT(updateTabs()));
	}

	emit tabsAmountChanged(count());
}
Ejemplo n.º 17
0
TabBarWidget::TabBarWidget(QWidget *parent) : QTabBar(parent),
	m_previewWidget(NULL),
	m_tabSize(0),
	m_clickedTab(-1),
	m_previewTimer(0)
{
	setDrawBase(false);
	setExpanding(false);
	setMovable(true);
	setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
	setTabsClosable(true);
	setElideMode(Qt::ElideRight);
	setMouseTracking(true);
	updateTabs();

	connect(this, SIGNAL(tabCloseRequested(int)), this, SIGNAL(requestedClose(int)));
	connect(this, SIGNAL(currentChanged(int)), this, SLOT(updateTabs()));
}
Ejemplo n.º 18
0
void LPMain::menuOnlineDisk(QAction *act){
  QString disk = act->text();
  QString pool = ui->combo_pools->currentText();
  //Verify action
  if(QMessageBox::Yes != QMessageBox::question(this,tr("Verify Disk Online"),QString(tr("Are you sure you wish to set %1 online?")).arg(disk), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
    return; //cancelled
  }
  qDebug() << "Online Disk:" << disk << pool;
  showWaitBox(tr("Setting disk online"));
  bool ok = LPBackend::setDiskOnline(pool, disk);
  hideWaitBox();
  if(ok){
    QMessageBox::information(this,tr("Disk Online Success"),QString(tr("Success: %1 has been set online.")).arg(disk) );
    QTimer::singleShot(0,this,SLOT(updateTabs()) );
  }else{
    QMessageBox::warning(this,tr("Disk Online Failure"),QString(tr("Failure: %1 could not be set online at this time.")).arg(disk) );
  }
}
Ejemplo n.º 19
0
void LPMain::menuRemoveDisk(QAction *act){
  QString disk = act->text();
  QString pool = ui->combo_pools->currentText();
  //Verify action
  if(QMessageBox::Yes != QMessageBox::question(this,tr("Verify Disk Removal"),QString(tr("Are you sure that you want to remove %1 from %2?")).arg(disk,pool) + "\n\n" + tr("CAUTION: This disk can only be re-attached later as a brand new disk"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
    return; //cancelled
  }
  qDebug() << "Remove Disk:" << disk << pool;
  showWaitBox(tr("Detaching disk"));
  bool ok = LPBackend::detachDisk(pool, disk);
  hideWaitBox();
  if(ok){
    QMessageBox::information(this,tr("Disk Removal Success"),QString(tr("Success: %1 was removed from %2")).arg(disk, pool) );
    QTimer::singleShot(0,this,SLOT(updateTabs()) );
  }else{
    QMessageBox::warning(this,tr("Disk Removal Failure"),QString(tr("Failure: %1 could not be removed from %2 at this time.")).arg(disk, pool) );
  }
}
Ejemplo n.º 20
0
//==============================================================================
JucerDocumentEditor::JucerDocumentEditor (JucerDocument* const doc)
    : document (doc),
      tabbedComponent (TabbedButtonBar::TabsAtTop),
      compLayoutPanel (0),
      lastViewportX (0),
      lastViewportY (0),
      currentZoomLevel (1.0)
{
    setOpaque (true);

    if (document != nullptr)
    {
        setSize (document->getInitialWidth(),
                 document->getInitialHeight());

        addAndMakeVisible (tabbedComponent);
        tabbedComponent.setOutline (0);

        tabbedComponent.addTab ("Class", tabColour, new ClassPropertiesPanel (*document), true);

        if (document->getComponentLayout() != nullptr)
            tabbedComponent.addTab ("Subcomponents", tabColour,
                                    compLayoutPanel = new ComponentLayoutPanel (*document, *document->getComponentLayout()), true);

        tabbedComponent.addTab ("Resources", tabColour, new ResourceEditorPanel (*document), true);

        SourceCodeEditor* codeEditor = new SourceCodeEditor (&document->getCppDocument(),
                                                             new CppCodeEditorComponent (document->getCppFile(),
                                                                                         document->getCppDocument().getCodeDocument()));

        tabbedComponent.addTab ("Code", tabColour, codeEditor, true);

        updateTabs();

        tabbedComponent.setCurrentTabIndex (1);

        document->addChangeListener (this);

        resized();
        refreshPropertiesPanel();

        changeListenerCallback (nullptr);
    }
}
Ejemplo n.º 21
0
void LPMain::menuStopScrub(){
  QString pool = ui->combo_pools->currentText();
  //Verify stopping a scrub
  if( QMessageBox::Yes != QMessageBox::question(this,tr("Verify Scrub"),QString(tr("Are you sure you want to stop the scrub on %1?")).arg(pool), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
    return; //cancelled	  
  }
  qDebug() << "Stop Scrub:" << pool;
  QString cmd = "zpool scrub -s "+pool;
  showWaitBox(tr("Trying to stop scrub"));
  int ret = system(cmd.toUtf8());
  hideWaitBox();
  if(ret == 0){
    //Now let te user know that one has been triggered
    QMessageBox::information(this,tr("Scrub Stopped"),QString(tr("The scrub on %1 has been stopped.")).arg(pool));
    QTimer::singleShot(0,this,SLOT(updateTabs()) );
  }else{
    QMessageBox::warning(this,tr("Scrub Not Running"), QString(tr("There was no scrub running on %1.")).arg(pool) );
  }	
}
Ejemplo n.º 22
0
void LPMain::menuStartScrub(){
  QString pool = ui->combo_pools->currentText();
  //Verify starting a scrub
  if( QMessageBox::Yes != QMessageBox::question(this,tr("Verify Scrub"),QString(tr("Are you sure you want to start a scrub on %1?")).arg(pool) + "\n"+tr("NOTE: This may take quite a while to complete"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
    return; //cancelled	  
  }
  qDebug() << "Start Scrub:" << pool;
  QString cmd = "zpool scrub "+pool;
  showWaitBox(tr("Trying to start a scrub"));
  int ret = system(cmd.toUtf8());
  hideWaitBox();
  if(ret == 0){
    //Now let te user know that one has been triggered
    QMessageBox::information(this,tr("Scrub Started"),QString(tr("A scrub has just been started on %1")).arg(pool));
    QTimer::singleShot(0,this,SLOT(updateTabs()) );
  }else{
    QMessageBox::warning(this,tr("Scrub Not Started"), QString(tr("A scrub on %1 could not be started at this time.")).arg(pool) + "\n"+tr("Please wait until any current resilvering or scrubs are finished before trying again.") );
  }
}
Ejemplo n.º 23
0
void TabBarWidget::setShape(QTabBar::Shape shape)
{
	if (shape == QTabBar::RoundedNorth || shape == QTabBar::RoundedSouth)
	{
		setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);

		parentWidget()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	}
	else
	{
		setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);

		parentWidget()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
	}

	QTabBar::setShape(shape);

	QTimer::singleShot(100, this, SLOT(updateTabs()));
}
Ejemplo n.º 24
0
void CtrlrLuaMethodEditor::restoreState(const ValueTree &savedState)
{
	restoreProperties (savedState, componentTree, nullptr);

	ScopedPointer <XmlElement> treeState(XmlDocument::parse (savedState.getProperty(Ids::luaMethodEditor).toString().upToLastOccurrenceOf(";", false, true)));

	if (treeState)
	{
		methodTree->restoreOpennessState (*treeState, true);
	}

	StringArray openedMethods;
	openedMethods.addTokens (savedState.getProperty(Ids::luaMethodEditor).toString().fromLastOccurrenceOf(";", false, true), ":", String::empty);

	for (int i=0; i<openedMethods.size(); i++)
	{
		setEditedMethod (Uuid (openedMethods[i]));
	}

	updateTabs();
}
Ejemplo n.º 25
0
void JucerDocumentEditor::changeListenerCallback (ChangeBroadcaster*)
{
    setName (document->getClassName());
    updateTabs();
}
Ejemplo n.º 26
0
/**
 * @fn externalUpdateTab
 */
void Reportabug::externalUpdateTab()
{
    if (debug) qDebug() << "[Reportabug]" << "[externalUpdateTab]";

    return updateTabs(ui->comboBox->currentIndex());
}
Ejemplo n.º 27
0
void TabBarWidget::optionChanged(const QString &option, const QVariant &value)
{
	if (option == QLatin1String("TabBar/ShowCloseButton"))
	{
		const bool showCloseButton = value.toBool();

		if (showCloseButton != m_showCloseButton)
		{
			for (int i = 0; i < count(); ++i)
			{
				if (showCloseButton)
				{
					QLabel *label = new QLabel();
					label->setFixedSize(QSize(16, 16));

					setTabButton(i, m_closeButtonPosition, label);
				}
				else
				{
					setTabButton(i, m_closeButtonPosition, NULL);
				}
			}

			updateTabs();
		}

		m_showCloseButton = showCloseButton;
	}
	else if (option == QLatin1String("TabBar/ShowUrlIcon"))
	{
		const bool showUrlIcon = value.toBool();

		if (showUrlIcon != m_showUrlIcon)
		{
			for (int i = 0; i < count(); ++i)
			{
				if (showUrlIcon)
				{
					QLabel *label = new QLabel();
					label->setFixedSize(QSize(16, 16));

					setTabButton(i, m_iconButtonPosition, label);
				}
				else
				{
					setTabButton(i, m_iconButtonPosition, NULL);
				}
			}

			updateTabs();
		}

		m_showUrlIcon = showUrlIcon;
	}
	else if (option == QLatin1String("TabBar/EnablePreviews"))
	{
		m_enablePreviews = value.toBool();
	}
	else if (option == QLatin1String("TabBar/MaximumTabSize"))
	{
		const int oldValue = m_maximumTabSize;

		m_maximumTabSize = value.toInt();

		if (m_maximumTabSize < 0)
		{
			m_maximumTabSize = 250;
		}

		if (m_maximumTabSize != oldValue)
		{
			updateGeometry();
			updateTabs();
		}
	}
	else if (option == QLatin1String("TabBar/MinimumTabSize") && value.toInt() != m_minimumTabSize)
	{
		const int oldValue = m_minimumTabSize;

		m_minimumTabSize = value.toInt();

		if (m_minimumTabSize < 0)
		{
			m_minimumTabSize = 40;
		}

		if (m_minimumTabSize != oldValue)
		{
			updateGeometry();
			updateTabs();
		}
	}
}
Ejemplo n.º 28
0
void TabBarWidget::resizeEvent(QResizeEvent *event)
{
	QTabBar::resizeEvent(event);

	QTimer::singleShot(100, this, SLOT(updateTabs()));
}
Ejemplo n.º 29
0
void TabBarWidget::tabRemoved(int index)
{
	QTabBar::tabRemoved(index);

	QTimer::singleShot(100, this, SLOT(updateTabs()));
}
Ejemplo n.º 30
0
LPMain::LPMain(QWidget *parent) : QMainWindow(parent), ui(new Ui::LPMain){
  ui->setupUi(this); //load the Qt-designer UI file
  //Initialize the auto-refresh timer
  timer = new QTimer(this);
	timer->setSingleShot(true);
	timer->setInterval(60000); // 1 minute timer
	connect(timer, SIGNAL(timeout()), this, SLOT(updateTabs()) );
  //Initialize the system watcher
  watcher = new QFileSystemWatcher(this);
    //Make sure the lpreserver log directory exists and watch it
    if(!QFile::exists("/var/log/lpreserver")){
      qDebug() << "Creating the lpreserver log directory (/var/log/lpreserver)";
      QDir dir;
      dir.mkpath("/var/log/lpreserver");
    }
    watcher->addPath("/var/log/lpreserver/");
  //Initialize the waitbox pointer
  waitBox = 0;
  //Initialize the classic dialog pointer
  classicDLG = 0;
  //Create the basic/advanced view options
  viewBasic = new QRadioButton(tr("Basic"), ui->menuView);
	QWidgetAction *WABasic = new QWidgetAction(this); WABasic->setDefaultWidget(viewBasic);
	ui->menuView->addAction(WABasic);
  viewAdvanced = new QRadioButton(tr("Advanced"), ui->menuView);
	QWidgetAction *WAAdv = new QWidgetAction(this); WAAdv->setDefaultWidget(viewAdvanced);
	ui->menuView->addAction(WAAdv);
  connect(viewBasic, SIGNAL(toggled(bool)), this, SLOT(viewChanged()) );
  //Now set the default view type
  settings = new QSettings(QSettings::UserScope, "PC-BSD", "Life-Preserver-GUI", this);
  bool basicMode = settings->value("viewmode", true).toBool(); //basic by default
  if(basicMode){ viewBasic->setChecked(true); } //will automatically call the "viewChanged" function
  else{ viewAdvanced->setChecked(true); } //will automatically call the "viewChanged" function
  //Create the filesystem model and tie it to the treewidget
  fsModel = new QFileSystemModel(this);
	fsModel->setReadOnly(true);
	ui->treeView->setModel(fsModel);
  //Connect the UI to all the functions
  connect(ui->tool_refresh, SIGNAL(clicked()), this, SLOT(updatePoolList()) );
  connect(ui->combo_pools, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTabs()) );
  connect(ui->combo_datasets, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDataset()) );
  connect(ui->slider_snapshots, SIGNAL(valueChanged(int)), this, SLOT(updateSnapshot()) );
  connect(ui->push_prevsnap, SIGNAL(clicked()), this, SLOT(prevSnapshot()) );
  connect(ui->push_nextsnap, SIGNAL(clicked()), this, SLOT(nextSnapshot()) );
  connect(ui->check_hidden, SIGNAL(stateChanged(int)), this, SLOT(setFileVisibility()) );
  connect(ui->push_restore, SIGNAL(clicked()), this, SLOT(restoreFiles()) );
  connect(ui->push_configure, SIGNAL(clicked()), this, SLOT(openConfigGUI()) );
  //Connect the Menu buttons
  connect(ui->menuManage_Pool, SIGNAL(triggered(QAction*)), this, SLOT(menuAddPool(QAction*)) );
  connect(ui->menuUnmanage_Pool, SIGNAL(triggered(QAction*)), this, SLOT(menuRemovePool(QAction*)) );
  connect(ui->action_SaveKeyToUSB, SIGNAL(triggered()), this, SLOT(menuSaveSSHKey()) );
  connect(ui->actionClose_Window, SIGNAL(triggered()), this, SLOT(menuCloseWindow()) );
  connect(ui->menuCompress_Home_Dir, SIGNAL(triggered(QAction*)), this, SLOT(menuCompressHomeDir(QAction*)) );
  connect(ui->actionExtract_Home_Dir, SIGNAL(triggered()), this, SLOT(menuExtractHomeDir()) );
  connect(ui->actionAdd_Disk, SIGNAL(triggered()), this, SLOT(menuAddDisk()) );
  connect(ui->menuRemove_Disk, SIGNAL(triggered(QAction*)), this, SLOT(menuRemoveDisk(QAction*)) );
  connect(ui->menuSet_Disk_Offline, SIGNAL(triggered(QAction*)), this, SLOT(menuOfflineDisk(QAction*)) );
  connect(ui->menuSet_Disk_Online, SIGNAL(triggered(QAction*)), this, SLOT(menuOnlineDisk(QAction*)) );
  connect(ui->action_startScrub, SIGNAL(triggered()), this, SLOT(menuStartScrub()) );
  connect(ui->action_stopScrub, SIGNAL(triggered()), this, SLOT(menuStopScrub()) );
  connect(ui->action_newSnapshot, SIGNAL(triggered()), this, SLOT(menuNewSnapshot()) );
  connect(ui->menuDelete_Snapshot, SIGNAL(triggered(QAction*)), this, SLOT(menuRemoveSnapshot(QAction*)) );
  //Update the interface
  QTimer::singleShot(0,this,SLOT(updatePoolList()) );
  
  //Make sure the status tab is shown initially
  ui->tabWidget->setCurrentWidget(ui->tab_status);
  //Now connect the watcher to the update slot
  connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(autoRefresh()) );
}