Ejemplo n.º 1
2
void MudGameView::onSelectProfile()
{
    Profile current(m_manager.getProfile());
    SelectProfileDlg dlg(current);
    if (dlg.DoModal() != IDOK)
        return;
    const ProfileData& profile = dlg.getProfile();
    if (!profile.create_new)
    {
        // load profile
        if (loadProfile(profile.profile) && profile.create_link)
            createLink(profile.profile);
        return;
    }
    if (!profile.copy_from_src)
    {
        if (!profile.create_empty)
        {
            // new profile from resources
            Profile src; src.group = profile.profile.group; src.name = L"player";
            if (copyProfile(true, profile.profile, src) && profile.create_link)
                createLink(profile.profile);
            return;
        }
        // new empty profile
        if (newProfile(profile.profile) && profile.create_link)
            createLink(profile.profile);
        return;
    }
    // new profile and copy from src profile
    if (copyProfile(false, profile.profile, profile.src) && profile.create_link)
        createLink(profile.profile);
}
Ejemplo n.º 2
0
VLCProfileSelector::VLCProfileSelector( QWidget *_parent ): QWidget( _parent )
{
    QHBoxLayout *layout = new QHBoxLayout( this );

    QLabel *prLabel = new QLabel( qtr( "Profile"), this );
    layout->addWidget( prLabel );

    profileBox = new QComboBox( this );
    layout->addWidget( profileBox );

    QToolButton *editButton = new QToolButton( this );
    editButton->setIcon( QIcon( ":/menu/preferences" ) );
    editButton->setToolTip( qtr( "Edit selected profile" ) );
    layout->addWidget( editButton );

    QToolButton *deleteButton = new QToolButton( this );
    deleteButton->setIcon( QIcon( ":/toolbar/clear" ) );
    deleteButton->setToolTip( qtr( "Delete selected profile" ) );
    layout->addWidget( deleteButton );

    QToolButton *newButton = new QToolButton( this );
    newButton->setIcon( QIcon( ":/new" ) );
    newButton->setToolTip( qtr( "Create a new profile" ) );
    layout->addWidget(newButton);

    BUTTONACT( newButton, newProfile() );
    BUTTONACT( editButton, editProfile() );
    BUTTONACT( deleteButton, deleteProfile() );
    fillProfilesCombo();

    CONNECT( profileBox, activated( int ),
             this, updateOptions( int ) );
    updateOptions( 0 );
}
 TransitionProfile<NondeterministicCoBuechiAutomaton> NondeterministicCoBuechiAutomaton::getEpsilonProfile() const {
   std::vector<std::set<std::pair<size_t,bool> > > newProfile(this->numberOfStates());
   for (size_t state = 0; state < this->numberOfStates(); ++state) {
     newProfile[state].insert(std::make_pair(state, this->isFinal(state)));
   }
   return newProfile;
 }
Ejemplo n.º 4
0
void MainWindow::onQRCodeCapturerResultFound(const QString &uri)
{
    QRCodeCapturer* capturer = qobject_cast<QRCodeCapturer*>(sender());
    // Disconnect immediately to avoid duplicate signals
    disconnect(capturer, &QRCodeCapturer::qrCodeFound,
               this, &MainWindow::onQRCodeCapturerResultFound);
    Connection *newCon = new Connection(uri, this);
    newProfile(newCon);
}
Ejemplo n.º 5
0
void MainWindow::onAddScreenQRCodeCapturer()
{
    QRCodeCapturer *capturer = new QRCodeCapturer(this);
    connect(capturer, &QRCodeCapturer::finished, capturer, &QRCodeCapturer::deleteLater);
    connect(capturer, &QRCodeCapturer::qrCodeFound, [this](const QString &uri) {
        Connection *newCon = new Connection(uri, this);
        newProfile(newCon);
    });
    capturer->exec();
}
Ejemplo n.º 6
0
void MainWindow::onAddScreenQRCode()
{
    QString uri = QRCodeCapturer::scanEntireScreen();
    if (uri.isNull()) {
        QMessageBox::critical(this, tr("QR Code Not Found"), tr("Can't find any QR code image that contains valid URI on your screen(s)."));
    } else {
        Connection *newCon = new Connection(uri, this);
        newProfile(newCon);
    }
}
Ejemplo n.º 7
0
void MainWindow::onAddFromURI()
{
    URIInputDialog *inputDlg = new URIInputDialog(this);
    connect(inputDlg, &URIInputDialog::finished, inputDlg, &URIInputDialog::deleteLater);
    connect(inputDlg, &URIInputDialog::acceptedURI, [&](const QString &uri){
        Connection *newCon = new Connection(uri, this);
        newProfile(newCon);
    });
    inputDlg->exec();
}
Ejemplo n.º 8
0
void MainWindow::onAddFromConfigJSON()
{
    QString file = QFileDialog::getOpenFileName(this, tr("Open config.json"), QString(), "JSON (*.json)");
    if (!file.isNull()) {
        Connection *con = configHelper->configJsonToConnection(file);
        if (con) {
            newProfile(con);
        }
    }
}
Ejemplo n.º 9
0
void ProfileManager::profilePopup()
{
    // profile menu identifiers
#define ADD_NEW_ENTRY_ID    1000
#define LOAD_ENTRY_ID       2000
#define REMOVE_ENTRY_ID     3000
#define OVERWRITE_ENTRY_ID  4000

    // create the menu
    QMenu popup, removePopup, overwritePopup;
    popup.setTitle(i18n("Profiles"));

    for (int i = 0; i != profileList.count() ; i++) {
        KConfigGroup group(krConfig, profileType + " - " + profileList[i]);
        QString name = group.readEntry("Name");
        popup.addAction(name)->setData(QVariant((int)(LOAD_ENTRY_ID + i)));
        removePopup.addAction(name)->setData(QVariant((int)(REMOVE_ENTRY_ID + i)));
        overwritePopup.addAction(name)->setData(QVariant((int)(OVERWRITE_ENTRY_ID + i)));
    }

    popup.addSeparator();

    if (profileList.count()) {
        popup.addMenu(&removePopup)->setText(i18n("Remove entry"));
        popup.addMenu(&overwritePopup)->setText(i18n("Overwrite entry"));
    }

    popup.addAction(i18n("Add new entry"))->setData(QVariant((int)(ADD_NEW_ENTRY_ID)));


    int result = 0;
    QAction * res = popup.exec(QCursor::pos());
    if (res && res->data().canConvert<int>())
        result = res->data().toInt();

    // check out the user's selection
    if (result == ADD_NEW_ENTRY_ID)
        newProfile();
    else if (result >= LOAD_ENTRY_ID && result < LOAD_ENTRY_ID + profileList.count()) {
        emit loadFromProfile(profileType + " - " + profileList[ result - LOAD_ENTRY_ID ]);
    } else if (result >= REMOVE_ENTRY_ID && result < REMOVE_ENTRY_ID + profileList.count()) {
        krConfig->deleteGroup(profileType + " - " + profileList[ result - REMOVE_ENTRY_ID ]);
        profileList.removeAll(profileList[ result - REMOVE_ENTRY_ID ]);

        KConfigGroup group(krConfig, "Private");
        group.writeEntry(profileType, profileList);
        krConfig->sync();
    } else if (result >= OVERWRITE_ENTRY_ID && result < OVERWRITE_ENTRY_ID + profileList.count()) {
        emit saveToProfile(profileType + " - " + profileList[ result - OVERWRITE_ENTRY_ID ]);
    }
}
Ejemplo n.º 10
0
void MainWindow::onAddQRCodeFile()
{
    QString qrFile = QFileDialog::getOpenFileName(this, tr("Open QR Code Image File"), QString(), "Images (*.png *jpg *jpeg *xpm)");
    if (!qrFile.isNull()) {
        QImage img(qrFile);
        QString uri = URIHelper::decodeImage(img);
        if (uri.isNull()) {
            QMessageBox::critical(this, tr("QR Code Not Found"), tr("Can't find any QR code image that contains valid URI on your screen(s)."));
        } else {
            Connection *newCon = new Connection(uri, this);
            newProfile(newCon);
        }
    }
}
 TransitionProfile<NondeterministicCoBuechiAutomaton> NondeterministicCoBuechiAutomaton::getTransitionProfileForLetter(size_t letter) const {
   std::vector<std::set<std::pair<size_t,bool> > > newProfile(this->numberOfStates());
   for (size_t state = 0; state < this->numberOfStates(); ++state) {
     std::set<size_t> targets = this->getTargets(state, letter);
     std::set<size_t>::const_iterator targetIter;
     for (targetIter = targets.begin(); targetIter != targets.end(); ++targetIter) {
       size_t targetState = *targetIter;
       bool finalEdge = this->isFinal(state) && this->isFinal(targetState);
       std::pair<size_t, bool> newPair = std::make_pair(targetState, finalEdge);
       newProfile[state].insert(newPair);
     }
   }
   return TransitionProfile<NondeterministicCoBuechiAutomaton>(newProfile);
 }
Ejemplo n.º 12
0
void MainForm::reloadProfiles()
{
	QString profileName = lineName->text();
	QStringList profiles = getProfileList();
	int index;
	
	listProfiles->clear();
	listProfiles->addItems(profiles);
	
	index = profiles.indexOf(profileName);
	if(index != -1)
	{
		listProfiles->setCurrentRow(index);
		loadProfile();
	}
	else
		newProfile();
}
Ejemplo n.º 13
0
void MainWindow::onAddScreenQRCode()
{
    QString uri;
    QList<QScreen *> screens = qApp->screens();
    for (QList<QScreen *>::iterator sc = screens.begin(); sc != screens.end(); ++sc) {
        QImage raw_sc = (*sc)->grabWindow(qApp->desktop()->winId()).toImage();
        QString result = URIHelper::decodeImage(raw_sc);
        if (!result.isNull()) {
            uri = result;
        }
    }
    if (uri.isNull()) {
        QMessageBox::critical(this, tr("QR Code Not Found"), tr("Can't find any QR code image that contains valid URI on your screen(s)."));
    } else {
        Connection *newCon = new Connection(uri, this);
        newProfile(newCon);
    }
}
Ejemplo n.º 14
0
rpnoc::Profile::Profile( QWidget *parent) 
	: QDialog( parent )
{
	buttonLoadProfile = new QPushButton( "Load" );
	buttonNewProfile = new QPushButton( "New" );
	buttonDeleteProfile = new QPushButton( "Delete" );
	buttonCancel = new QPushButton( "Cancel" );
	buttonSwitchUser = new QPushButton( "Change User" );

	model = new QStringListModel( this );

	listView = new QListView;
	listView->setModel( model );
	listView->setEditTriggers( QAbstractItemView::NoEditTriggers );

	connect( buttonLoadProfile, SIGNAL( clicked() ), this, SLOT( loadProfile() ) );
	connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );
	connect( buttonNewProfile, SIGNAL( clicked() ), this, SLOT( newProfile() ) );
	connect( buttonSwitchUser, SIGNAL( clicked() ), this, SLOT( changeUser() ) );
	connect( buttonDeleteProfile, SIGNAL( clicked() ), this, SLOT( deleteProfile() ) );

	QVBoxLayout* buttonLayoutOne = new QVBoxLayout;
	buttonLayoutOne->addWidget( buttonLoadProfile );
	buttonLayoutOne->addWidget( buttonNewProfile );
	buttonLayoutOne->addWidget( buttonDeleteProfile );
	buttonLayoutOne->addStretch();
	buttonLayoutOne->addWidget( buttonSwitchUser );
	buttonLayoutOne->addStretch();
	buttonLayoutOne->addWidget( buttonCancel );

	QVBoxLayout* listLayout = new QVBoxLayout;
	listLayout->addWidget( listView );

	QHBoxLayout* mainLayout = new QHBoxLayout;
	mainLayout->addLayout( buttonLayoutOne );
	mainLayout->addLayout( listLayout );

	setLayout( mainLayout );
	setWindowTitle( "Profiles" );
}
Ejemplo n.º 15
0
void MainWindow::onAddManually()
{
    Connection *newCon = new Connection;
    newProfile(newCon);
}
Ejemplo n.º 16
0
BitSplit::BitSplit()
{
    fontDb.addApplicationFont(":/fonts/OpenSans-Light.ttf");
    fontDb.addApplicationFont(":/fonts/OpenSans-Regular.ttf");
    exit = true;
    blockToggle = false;
    searchExisting = false;

    /* Timer setup*/
    guiUpdater  = new QTimer( this );
    guiUpdater->setInterval(25);

    syncAnimator  = new QTimer( this );
    syncAnimator->setInterval(75);

    /* Interface setup */
    fileInterface.debug = false;
    fileInterface.copyDirection = BothDirections;
    actionCreator.fileInterface = &fileInterface;
    smartMatch.fileInterface = &fileInterface;
    actionHandler.fileInterface = &fileInterface;
    updater.fileInterface = &fileInterface;

    /* Set up icons */
    remove  = new QIcon(":images/general/remove.png");

    done    = new QIcon(":images/table/tick.png");
    errorIcon   = new QIcon(":images/table/error.png");
    skip    = new QIcon(":images/table/skip.png");

    sync1   = new QIcon(":images/table/sync1.png");
    syncAnimation.append(sync1);
    sync2   = new QIcon(":images/table/sync2.png");
    syncAnimation.append(sync2);
    sync3   = new QIcon(":images/table/sync3.png");
    syncAnimation.append(sync3);
    sync4   = new QIcon(":images/table/sync4.png");
    syncAnimation.append(sync4);
    sync5   = new QIcon(":images/table/sync5.png");
    syncAnimation.append(sync5);
    sync6   = new QIcon(":images/table/sync6.png");
    syncAnimation.append(sync6);
    sync7   = new QIcon(":images/table/sync7.png");
    syncAnimation.append(sync7);
    sync8   = new QIcon(":images/table/sync8.png");
    syncAnimation.append(sync8);


    ui.setupUi( this );
    ui.runButton->setDisabled(true);

    /* Connect buttons to their dialogs */
    connect(ui.editSettingsButton,  SIGNAL(clicked()),  this,   SLOT(editSettings()));
    connect(ui.newProfileButton,    SIGNAL(clicked()),  this,   SLOT(newProfile()));


    /* Log Connections*/
    connect(ui.actionView_Log,  SIGNAL(triggered()),        this,       SLOT(showLog()));
    connect(ui.exitLog,         SIGNAL(clicked()),          this,       SLOT(showMain()));
    connect(&fileInterface,     SIGNAL(updateLog(QString)), ui.log,     SLOT(append(QString)));
    connect(ui.errorViewLog,    SIGNAL(clicked()),          this,       SLOT(showLog()));

    /* Top Bar connections*/
    connect(&fileInterface, SIGNAL(matchComplete()),            this,               SLOT(matchComplete()));
    connect(&fileInterface, SIGNAL(updateSingle(QString)),      ui.topBarSingle,    SLOT(setText(QString)));
    connect(&fileInterface, SIGNAL(updateTopMP(QString)),       ui.mp_top,          SLOT(setText(QString)));
    connect(&fileInterface, SIGNAL(updateBottomMP(QString)),    ui.mp_bottom,       SLOT(setText(QString)));
    connect(&fileInterface, SIGNAL(updateOperationMP(QString)), ui.mp_operation,    SLOT(setText(QString)));
    connect(guiUpdater,     SIGNAL(timeout()),                  &smartMatch,        SLOT(updateGuiLabels()));
    connect(&smartMatch,    SIGNAL(startTime()),                guiUpdater,         SLOT(start()));
    connect(&smartMatch,    SIGNAL(stopTime()),                 guiUpdater,         SLOT(stop()));
    connect(&smartMatch,    SIGNAL(setTopBarLineStack(int)),    this,               SLOT(setTopBarLineStack(int)));

    /* Unmatched files tree Connections */
    connect(ui.unmatchedTree,   SIGNAL(itemChanged(QTreeWidgetItem*,int)),  this,   SLOT(toggleTree(QTreeWidgetItem*,int)));
    connect(&fileInterface,     SIGNAL(updateFileTree(bool, QTreeWidgetItem *)), this, SLOT(insertTreeItem(bool, QTreeWidgetItem *)));
    connect(&fileInterface,     SIGNAL(pop()),                              this,   SLOT(popParent()));
    connect(&fileInterface,     SIGNAL(expandTree()), this, SLOT(expandTree()));

    /* Matched Table Connections */
    connect(&fileInterface, SIGNAL(insertMatchTableRow(QList<QTableWidgetItem*>*)), this, SLOT(insertMatchTableRow(QList<QTableWidgetItem*>*)));

    /* Action Table Connections*/
    connect(&fileInterface, SIGNAL(insertActionTableRow(QList<QTableWidgetItem*>*)), this, SLOT(insertActionTableRow(QList<QTableWidgetItem*>*)));

    /* Error connections */
    connect(&smartMatch,    SIGNAL(operationFailed()),  this, SLOT(error()));
    connect(&actionCreator,    SIGNAL(operationFailed()),  this, SLOT(error()));
    connect(&actionHandler,     SIGNAL(exception()), this, SLOT(error()));

    /* Developer Test Connections */
    connect(ui.actionDeveloper_Test, SIGNAL(triggered()), this, SLOT(runDeveloperTest()));
    connect(&smartMatch, SIGNAL(stopTestTime()), this, SLOT(endTimer()));

    /* Action Handler Connections */
    connect(&actionHandler, SIGNAL(updateProgress(int)),            ui.progressBar,         SLOT(setValue(int)));
    connect(&actionHandler, SIGNAL(updateActionLabel(QString)),     ui.actionLabel,         SLOT(setText(QString)));
    connect(&actionHandler, SIGNAL(updateSpeedLabel(QString)),      ui.speedLabel,          SLOT(setText(QString)));
    connect(&actionHandler, SIGNAL(updatePercentageLabel(QString)), ui.mp_busyIndicator,    SLOT(setText(QString)));
    connect(&actionHandler, SIGNAL(setComplete(int)),               this,                   SLOT(setDone(int)));
    connect(&actionHandler, SIGNAL(setSkipped(int)),                this,                   SLOT(setSkip(int)));
    connect(&actionHandler, SIGNAL(setError(int)),                  this,                   SLOT(setError(int)));
    connect(&actionHandler, SIGNAL(setInProgress(int)),             this,                   SLOT(setSync(int)));

    /* Updater Connections */
    connect(&updater,       SIGNAL(complete()),     this,   SLOT(updaterComplete()));

    /* General Connections & Button Stack Connections */
    connect(syncAnimator,           SIGNAL(timeout()),  this,   SLOT(showSync()));
    connect(ui.finishEditButton,    SIGNAL(clicked()),  this,   SLOT(createActions()));
    connect(&actionCreator,         SIGNAL(complete()), this,   SLOT(actionsComplete()));
    connect(ui.runButton,           SIGNAL(clicked()),  this,   SLOT(runActionHandler()));
    connect(ui.searchButton,        SIGNAL(clicked()),  this,   SLOT(searchForSync()));
    connect(&actionHandler,         SIGNAL(complete()), this,   SLOT(actionHandlerComplete()));

    /* General Setup*/
    frame = 0;
    currentAction = -1;
    actionHandler.table = ui.actionsTable;
    ui.mp_ProfileLabel->fontMetrics().width(ui.mp_ProfileLabel->text());
    createTrayIcon();
    setupTable();
    fileInterface.loadDatabase();
    recentProfiles = fileInterface.loadRecentProfiles();
    if(recentProfiles.size() > 0)
        showRecentProfiles();

}
Ejemplo n.º 17
0
void System::createProfile(QString name, std::vector<QString> interfaces, QString defaultPolicyIN, QString defaultPolicyOUT)
{
    //Writing the profile info to the profile file
    QString pathString;
    QTextStream pathStream(&pathString);
    pathStream << this->systemPath << "/profiles/" << name << ".txt";
    QFile newProfile(pathString);
    newProfile.open(QIODevice::WriteOnly | QIODevice::Text);
    QTextStream out1(&newProfile);
    out1 << name << "\n";
    out1 << defaultPolicyIN << "\n";
    out1 << defaultPolicyOUT << "\n";
    out1 << this->currentProfile->getSystemTime() << "\n";
    out1 << this->currentProfile->getSystemTime() << "\n";
    newProfile.close();

    //Adding it to profileNames vector
    this->profileNames.push_back(name);

    //Writing the interfaces to the profile's interface file
    QString pathString2;
    QTextStream pathStream2(&pathString2);
    pathStream2 << this->systemPath << "/profiles/" << name << "-interfaces.txt";
    QFile newProfileInterfaces(pathString2);
    newProfileInterfaces.open(QIODevice::WriteOnly | QIODevice::Text);
    QTextStream out2(&newProfileInterfaces);

    out2 << interfaces.size() << "\n";
    for (unsigned int i=0;i<interfaces.size();i++)
        out2 << interfaces.at(i) << "\n";

    newProfileInterfaces.close();

    //Writing the default services to profile's services file
    QString pathString3;
    QTextStream pathStream3(&pathString3);
    pathStream3 << this->systemPath << "/profiles/" << name << "-services.txt";
    QFile newProfileServices(pathString3);
    newProfileServices.open(QIODevice::WriteOnly | QIODevice::Text);
    QTextStream out3(&newProfileServices);

    out3 << "FTP,21,tcp,drop\n";
    out3 << "FTP,21,tcp,drop\n";
    out3 << "SSH,22,tcp,accept\n";
    out3 << "Telnet,23,tcp,drop\n";
    out3 << "SMTP,25,tcp,drop\n";
    out3 << "DNS,53,tcp/udp,drop\n";
    out3 << "HTTP,80,tcp,accept\n";
    out3 << "HTTPS,443,tcp,drop\n";
    out3 << "NTP,123,udp,drop\n";
    out3 << "IMAP,143,tcp,drop\n";
    out3 << "SNMP,161,udp,drop\n";
    out3 << "SMB,445,tcp,drop\n";
    out3 << "PPTP,1723,tcp,drop\n";
    out3 << "MySQL,3306,tcp,drop\n";

    newProfileServices.close();

    //Wring profile list to profileList.txt
    QString pathString4;
    QTextStream pathStream4(&pathString4);
    pathStream4 << this->systemPath << "/profileList.txt";
    QFile profileList(pathString4);
    profileList.open(QIODevice::WriteOnly | QIODevice::Text);
    QTextStream out4(&profileList);

    int nrOfProfiles = this->profileNames.size();

    out4 << nrOfProfiles << "\n";

    if (this->firstTimeUse == TRUE)
        out4 << name << "\n";
    else
        out4 << this->currentProfile->getName() << "\n";

    for (int i=0;i<nrOfProfiles;i++)
        out4 << this->profileNames.at(i) << "\n";

    profileList.close();

    if (this->firstTimeUse == TRUE) {
        this->changeCurrentProfile(name);
        this->firstTimeUse = FALSE;
    }
}
Ejemplo n.º 18
0
MainForm::MainForm()
{
	setupUi(this);
	
	connect(checkKeymap, SIGNAL(stateChanged(int)), this, SLOT(updateByCheckbox(int)));
	connect(checkXConf, SIGNAL(stateChanged(int)), this, SLOT(updateByCheckbox(int)));
	connect(checkScreen, SIGNAL(stateChanged(int)), this, SLOT(updateByCheckbox(int)));
	connect(checkXinit, SIGNAL(stateChanged(int)), this, SLOT(updateByCheckbox(int)));
	connect(checkSync, SIGNAL(stateChanged(int)), this, SLOT(updateByCheckbox(int)));
	
	connect(radioRunType1, SIGNAL(clicked()), this, SLOT(switchedRunType()));
	connect(radioRunType2, SIGNAL(clicked()), this, SLOT(switchedRunType()));
	
	connect(comboGpuType, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(handleGpuChange(const QString&)));
	
	connect(toolXConf, SIGNAL(clicked()), this, SLOT(xconfPressed()));
	connect(pushLoad, SIGNAL(clicked()), this, SLOT(loadProfile()));
	connect(pushNew, SIGNAL(clicked()), this, SLOT(newProfile()));
	connect(pushSave, SIGNAL(clicked()), this, SLOT(saveProfile()));
	connect(pushDelete, SIGNAL(clicked()), this, SLOT(deleteProfile()));
	
	connect(listProfiles, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(loadProfile(QListWidgetItem*)));
	connect(pushAbout, SIGNAL(clicked()), this, SLOT(showAbout()));
	
	QStringList list;
	list << "GeForce, GeForce2, Quadro, Quadro2 Pro";
	list << "GeForce4 MX, GeForce4 4xx Go, Quadro4 380,550,580 XGL, Quadro4 NVS";
	list << "GeForce3, Quadro DCC, GeForce4 Ti, GeForce4 4200 Go, Quadro4 700,750,780,900,980 XGL";
	list << "GeForce FX, GeForce 6xxx, GeForce 7xxx, Quadro FX";
	list << "GeForce 8xxx, G8xGL";
	
	g_mapGPUCaps[list[0]] = QList<int>() << -1 << 0 << 3 << 4;
	g_mapGPUCaps[list[1]] = QList<int>() << -1 << 0 << 1 << 2 << 4;
	g_mapGPUCaps[list[2]] = QList<int>() << -1 << 0 << 1 << 2 << 4 << 5 << 6;
	g_mapGPUCaps[list[3]] = QList<int>() << -1 << 0 << 1 << 2 << 4 << 5 << 6 << 7 << 8;
	g_mapGPUCaps[list[4]] = QList<int>() << -1 << 0 << 1 << 4 << 7 << 9 << 10 << 11 << 12 << 13;
	
	comboGpuType->addItems(list);
	
	g_mapAATypes["<default>"] = -1;
	g_mapAATypes["Disabled"] = 0;
	g_mapAATypes["2x Bilinear Multisampling"] = 1;
	g_mapAATypes["2x Quincunx Multisampling"] = 2;
	g_mapAATypes["1.5 x 1.5 Supersampling"] = 3;
	g_mapAATypes["2 x 2 Supersampling / 4x Bilinear Multisampling"] = 4;
	g_mapAATypes["4x Gaussian Multisampling"] = 5;
	g_mapAATypes["2x Bilinear Multisampling by 4x Supersampling"] = 6;
	g_mapAATypes["4x Bilinear Multisampling by 4x Supersampling"] = 7;
	g_mapAATypes["4x Bilinear Multisampling by 2x Supersampling"] = 8;
	g_mapAATypes["8x Bilinear Multisampling"] = 9;
	g_mapAATypes["8x"] = 10;
	g_mapAATypes["16x"] = 11;
	g_mapAATypes["16xQ"] = 12;
	g_mapAATypes["8x Bilinear Multisampling by 4x Supersampling"] = 13;
	
	handleGpuChange(list[0]);
	list.clear();
	
	list << "<default>" << "Disabled" << "Enabled";
	
	comboVblank->addItems(list);
	comboDoom3->addItems(list);
	
	listProfiles->addItems(getProfileList());
	radioRunType1->setChecked(true);
	updateByCheckbox(0);
}
Ejemplo n.º 19
0
void MainForm::loadProfile()
{
	QMap<QString,QString> params;
	QListWidgetItem* item;
	
	item = listProfiles->currentItem();
	
	if(!item) return;
	
	if(!::loadProfile(item->text(),params))
		QMessageBox::critical(0, "Fatal error", "Unable to load the specified profile!");
	else
	{
		newProfile();
		checkXmodmap->setCheckState((params.value("xmodmap","1").toInt()) ? Qt::Checked : Qt::Unchecked);
		lineName->setText(item->text());
		
		((params.value("runtype","0").toInt()) ? radioRunType2 : radioRunType1)->setChecked(true);
		
		if(params.value("keymap","0").toInt())
		{
			checkKeymap->setCheckState(Qt::Checked);
			lineKeymap->setText(params.value("keymap_val","us"));
		}
		
		if(params.value("xconf","0").toInt())
		{
			checkXConf->setCheckState(Qt::Checked);
			lineXConf->setText(params.value("xconf_val","xorg.conf"));
		}
		
		if(params.value("screen","0").toInt())
		{
			checkScreen->setCheckState(Qt::Checked);
			spinScreen->setValue(params.value("screen_val","0").toInt());
		}
		
		if(params.value("xinit","0").toInt())
		{
			checkXinit->setCheckState(Qt::Checked);
			textXinit->setPlainText(params.value("xinit_val",""));
		}
		
		if(params.value("nv_sync","0").toInt())
		{
			checkSync->setCheckState(Qt::Checked);
			lineSync->setText(params.value("nv_sync_val",""));
		}
		
		comboGpuType->setCurrentIndex(params.value("gputype").toInt());
		handleGpuChange(comboGpuType->currentText());
		
		int fsaanum = params.value("__GL_FSAA_MODE","-1").toInt();
		int index = g_mapGPUCaps[comboGpuType->currentText()].indexOf(fsaanum);
		
		comboFSAA->setCurrentIndex((index<0) ? 0 : index);
		
		comboAniso->setCurrentIndex(params.value("__GL_LOG_MAX_ANISO","-1").toInt()+1);
		comboVblank->setCurrentIndex(params.value("__GL_SYNC_TO_VBLANK","-1").toInt()+1);
		comboDoom3->setCurrentIndex(params.value("__GL_DOOM3","-1").toInt()+1);
		
		lineName->setText(item->text());
	}
	
	updateByCheckbox(0);
}
Ejemplo n.º 20
0
MainWindow::MainWindow()
: KXmlGuiWindow()
{
    QWidget* mainWidget = new QWidget;
    setCentralWidget( mainWidget );

    QVBoxLayout* layout = new QVBoxLayout;
    layout->setMargin( 0 );
    layout->setSpacing( 0 );
    mainWidget->setLayout( layout );

    m_searchEdit = new KLineEdit;
    m_searchEdit->setClearButtonShown( true );
    m_searchEdit->setClickMessage( i18n( "Type here to start searching..." ) );
    layout->addWidget( m_searchEdit );

    m_listView = new QListView;
    m_proxyModel = new QSortFilterProxyModel( this );
    m_listModel = new CleanerModel( this );
    m_proxyModel->setFilterCaseSensitivity( Qt::CaseInsensitive );
    m_proxyModel->setSortRole( Qt::UserRole );
    m_proxyModel->setSourceModel( m_listModel );
    m_listView->setSelectionMode( QAbstractItemView::NoSelection );
    m_listView->setUniformItemSizes( true );
    m_listView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    m_listView->setModel( m_proxyModel );
    layout->addWidget( m_listView );

    QHBoxLayout* buttonLayout = new QHBoxLayout;
    buttonLayout->setMargin( 0 );
    buttonLayout->setSpacing( 0 );
    layout->addLayout( buttonLayout );

    m_refreshButton = new KPushButton( i18n( "Refresh" ) );
    m_refreshButton->setIcon( KIcon( "view-refresh" ) );
    buttonLayout->addWidget( m_refreshButton );
    connect( m_refreshButton, SIGNAL(clicked()), m_listModel, SLOT(refresh()) );

    m_cleanupButton = new KPushButton( i18n( "Clean up..." ) );
    m_cleanupButton->setIcon( KIcon( "edit-clear" ) );
    buttonLayout->addWidget( m_cleanupButton );
    connect( m_cleanupButton, SIGNAL(clicked()), m_listModel, SLOT(saolaji()) );

    m_cancelProfileButton = new KPushButton( i18n( "Cancel" ) );
    buttonLayout->addWidget( m_cancelProfileButton );
    connect( m_cancelProfileButton, SIGNAL(clicked()), this, SLOT(cancelProfile()) );

    m_saveProfileButton = new KPushButton( i18n( "Save" ) );
    buttonLayout->addWidget( m_saveProfileButton );
    connect( m_saveProfileButton, SIGNAL(clicked()), this, SLOT(saveProfile()) );

    m_cancelProfileButton->hide();
    m_saveProfileButton->hide();
    m_editingProfile = 0;

    KAction* knsDownloadAction = actionCollection()->addAction( "kns_download" );
    knsDownloadAction->setText( i18n( "&Download scripts..." ) );
    knsDownloadAction->setIcon( KIcon( "get-hot-new-stuff" ) );
    connect( knsDownloadAction, SIGNAL(triggered()), this, SLOT(knsDownload()) );

    KAction* newProfileAction = actionCollection()->addAction( "new_profile" );
    newProfileAction->setText( i18n( "New profile..." ) );
    newProfileAction->setIcon( KIcon( "bookmark-new" ) );
    connect( newProfileAction, SIGNAL(triggered()), this, SLOT(newProfile()) );

    connect( m_searchEdit, SIGNAL(textChanged(QString)), this, SLOT(filterList(QString)) );
    connect( m_listModel, SIGNAL(refreshFinished()), this, SLOT(sortList()) );

    KStandardAction::selectAll( m_listModel, SLOT(selectAll()), actionCollection() );
    KStandardAction::deselect( m_listModel, SLOT(deselect()), actionCollection() );
    KStandardAction::quit( this, SLOT(close()), actionCollection() );

    setupGUI( KXmlGuiWindow::Keys | KXmlGuiWindow::Save | KXmlGuiWindow::Create );

    m_selectProfileSignalMapper = new QSignalMapper( this );
    connect( m_selectProfileSignalMapper, SIGNAL(mapped(QObject*)),
             this, SLOT(selectProfile(QObject*)) );
    m_editProfileSignalMapper = new QSignalMapper( this );
    connect( m_editProfileSignalMapper, SIGNAL(mapped(QObject*)),
             this, SLOT(editProfile(QObject*)) );
    m_deleteProfileSignalMapper = new QSignalMapper( this );
    connect( m_deleteProfileSignalMapper, SIGNAL(mapped(QObject*)),
             this, SLOT(deleteProfile(QObject*)) );

    QTimer::singleShot( 0, this, SLOT(setupProfileActions()) );
}
Ejemplo n.º 21
0
ToolbarEditDialog::ToolbarEditDialog( QWidget *_w, intf_thread_t *_p_intf)
                  : QVLCDialog( _w,  _p_intf )
{
    setWindowTitle( qtr( "Toolbars Editor" ) );
    setWindowRole( "vlc-toolbars-editor" );
    QGridLayout *mainLayout = new QGridLayout( this );
    setMinimumWidth( 600 );
    setAttribute( Qt::WA_DeleteOnClose );

    /* main GroupBox */
    QGroupBox *widgetBox = new QGroupBox( qtr( "Toolbar Elements") , this );
    widgetBox->setSizePolicy( QSizePolicy::Preferred,
                              QSizePolicy::MinimumExpanding );
    QGridLayout *boxLayout = new QGridLayout( widgetBox );

    flatBox = new QCheckBox( qtr( "Flat Button" ) );
    flatBox->setToolTip( qtr( "Next widget style" ) );
    bigBox = new QCheckBox( qtr( "Big Button" ) );
    bigBox->setToolTip( flatBox->toolTip() );
    shinyBox = new QCheckBox( qtr( "Native Slider" ) );
    shinyBox->setToolTip( flatBox->toolTip() );

    boxLayout->addWidget( new WidgetListing( p_intf, this ), 1, 0, 1, -1 );
    boxLayout->addWidget( flatBox, 0, 0 );
    boxLayout->addWidget( bigBox, 0, 1 );
    boxLayout->addWidget( shinyBox, 0, 2 );
    mainLayout->addWidget( widgetBox, 5, 0, 3, 6 );

    QTabWidget *tabWidget = new QTabWidget();
    mainLayout->addWidget( tabWidget, 1, 0, 4, 9 );

    /* Main ToolBar */
    QWidget *mainToolbarBox = new QWidget();
    tabWidget->addTab( mainToolbarBox, qtr( "Main Toolbar" ) );
    QFormLayout *mainTboxLayout = new QFormLayout( mainToolbarBox );

    positionCheckbox = new QCheckBox( qtr( "Above the Video" ) );
    positionCheckbox->setChecked(
                getSettings()->value( "MainWindow/ToolbarPos", false ).toBool() );
    mainTboxLayout->addRow( new QLabel( qtr( "Toolbar position:" ) ),
                            positionCheckbox );

    QString line1 = getSettings()->value( "MainWindow/MainToolbar1",
                                          MAIN_TB1_DEFAULT ).toString();
    controller1 = new DroppingController( p_intf, line1, this );
    mainTboxLayout->addRow( new QLabel( qtr("Line 1:") ), controller1 );

    QString line2 = getSettings()->value( "MainWindow/MainToolbar2",
                                          MAIN_TB2_DEFAULT ).toString();
    controller2 = new DroppingController( p_intf, line2, this );
    mainTboxLayout->addRow( new QLabel( qtr("Line 2:") ), controller2 );

    /* TimeToolBar */
    QString line = getSettings()->value( "MainWindow/InputToolbar",
                                         INPT_TB_DEFAULT ).toString();
    controller = new DroppingController( p_intf, line, this );
    QWidget *timeToolbarBox = new QWidget();
    timeToolbarBox->setLayout( new QVBoxLayout() );
    timeToolbarBox->layout()->addWidget( controller );
    tabWidget->addTab( timeToolbarBox, qtr( "Time Toolbar" ) );

    /* Advanced ToolBar */
    QString lineA = getSettings()->value( "MainWindow/AdvToolbar",
                                          ADV_TB_DEFAULT ).toString();
    controllerA = new DroppingController( p_intf, lineA, this );
    QWidget *advToolbarBox = new QWidget();
    advToolbarBox->setLayout( new QVBoxLayout() );
    advToolbarBox->layout()->addWidget( controllerA );
    tabWidget->addTab( advToolbarBox, qtr( "Advanced Widget" ) );

    /* FSCToolBar */
    QString lineFSC = getSettings()->value( "MainWindow/FSCtoolbar",
                                            FSC_TB_DEFAULT ).toString();
    controllerFSC = new DroppingController( p_intf, lineFSC, this );
    QWidget *FSCToolbarBox = new QWidget();
    FSCToolbarBox->setLayout( new QVBoxLayout() );
    FSCToolbarBox->layout()->addWidget( controllerFSC );
    tabWidget->addTab( FSCToolbarBox, qtr( "Fullscreen Controller" ) );

    /* Profile */
    QGridLayout *profileBoxLayout = new QGridLayout();

    profileCombo = new QComboBox;

    QToolButton *newButton = new QToolButton;
    newButton->setIcon( QIcon( ":/new.svg" ) );
    newButton->setToolTip( qtr("New profile") );
    QToolButton *deleteButton = new QToolButton;
    deleteButton->setIcon( QIcon( ":/toolbar/clear.svg" ) );
    deleteButton->setToolTip( qtr( "Delete the current profile" ) );

    profileBoxLayout->addWidget( new QLabel( qtr( "Select profile:" ) ), 0, 0 );
    profileBoxLayout->addWidget( profileCombo, 0, 1 );
    profileBoxLayout->addWidget( newButton, 0, 2 );
    profileBoxLayout->addWidget( deleteButton, 0, 3 );

    mainLayout->addLayout( profileBoxLayout, 0, 0, 1, 9 );

    /* Fill combos */
    int i_size = getSettings()->beginReadArray( "ToolbarProfiles" );
    for( int i = 0; i < i_size; i++ )
    {
        getSettings()->setArrayIndex(i);
        profileCombo->addItem( getSettings()->value( "ProfileName" ).toString(),
                               getSettings()->value( "Value" ).toString() );
    }
    getSettings()->endArray();

    /* Load defaults ones if we have no combos */
    /* We could decide that we load defaults on first launch of the dialog
       or when the combo is back to 0. I choose the second solution, because some clueless
       user might hit on delete a bit too much, but discussion is opened. -- jb */
    if( i_size == 0 )
    {
        profileCombo->addItem( PROFILE_NAME_6, QString( VALUE_6 ) );
        profileCombo->addItem( PROFILE_NAME_1, QString( VALUE_1 ) );
        profileCombo->addItem( PROFILE_NAME_2, QString( VALUE_2 ) );
        profileCombo->addItem( PROFILE_NAME_3, QString( VALUE_3 ) );
        profileCombo->addItem( PROFILE_NAME_4, QString( VALUE_4 ) );
        profileCombo->addItem( PROFILE_NAME_5, QString( VALUE_5 ) );
    }
    profileCombo->setCurrentIndex( -1 );

    /* Build and prepare our preview */
    PreviewWidget *previewWidget = new PreviewWidget( controller, controller1, controller2,
                                                      positionCheckbox->isChecked() );
    QGroupBox *previewBox = new QGroupBox( qtr("Preview"), this );
    previewBox->setLayout( new QVBoxLayout() );
    previewBox->layout()->addWidget( previewWidget );
    mainLayout->addWidget( previewBox, 5, 6, 3, 3 );
    CONNECT( positionCheckbox, stateChanged(int),
             previewWidget, setBarsTopPosition(int) );

    /* Buttons */
    QDialogButtonBox *okCancel = new QDialogButtonBox;
    QPushButton *okButton = new QPushButton( qtr( "Cl&ose" ), this );
    okButton->setDefault( true );
    QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ), this );
    okCancel->addButton( okButton, QDialogButtonBox::AcceptRole );
    okCancel->addButton( cancelButton, QDialogButtonBox::RejectRole );

    BUTTONACT( deleteButton, deleteProfile() );
    BUTTONACT( newButton, newProfile() );
    CONNECT( profileCombo, currentIndexChanged( int ), this, changeProfile( int ) );
    BUTTONACT( okButton, close() );
    BUTTONACT( cancelButton, cancel() );
    mainLayout->addWidget( okCancel, 8, 0, 1, 9 );
}
Ejemplo n.º 22
0
/* find Profile for Metric */
static Profile *
findProfile(Fetch *f, Metric *m)
{
    Profile	*p;
    int		sts;

    /* find existing Profile */
    p = f->profiles;
    while (p) {
	if (p->indom == m->desc.indom) {
	    m->next = p->metrics;
	    if (p->metrics) p->metrics->prev = m;
	    p->metrics = m;
	    break;
	}
	p = p->next;
    }

    /* create new Profile */
    if (p == NULL) {
	m->next = NULL;
	p = newProfile(f, m->desc.indom);
	p->next = f->profiles;
	if (f->profiles) f->profiles->prev = p;
	f->profiles = p;
	p->metrics = m;
    }

    /* add instances required by Metric to Profile */
    if ((sts = pmUseContext(f->handle)) < 0) {
	fprintf(stderr, "%s: pmUseContext failed: %s\n", pmProgname,
		pmErrStr(sts));
	exit(1);
    }

    /*
     * If any rule requires all instances, then ignore restricted
     * instance lists from all other rules
     */
    if (m->specinst == 0 && p->need_all == 0) {
	sts = pmDelProfile(p->indom, 0, (int *)0);
	if (sts < 0) {
	    fprintf(stderr, "%s: pmDelProfile failed: %s\n", pmProgname,
		    pmErrStr(sts));
	    exit(1);
	}
	sts = pmAddProfile(p->indom, 0, (int *)0);
	p->need_all = 1;
    }
    else if (m->specinst > 0 && p->need_all == 0)
	sts = pmAddProfile(p->indom, m->m_idom, m->iids);
    else
	sts = 0;

    if (sts < 0) {
	fprintf(stderr, "%s: pmAddProfile failed: %s\n", pmProgname,
		pmErrStr(sts));
	exit(1);
    }

    m->profile = p;
    return p;
}