void MediaPlayer :: checkPlaylist(int currentIndex)
{
    // this fires on startup with index -1 for some reason
    if(currentIndex != -1)
    {
        setArtist(plModel->data(plModel->index(currentIndex), plModel->Artist).toString());
        setTitle(plModel->data(plModel->index(currentIndex), plModel->Title).toString());

        qDebug() << "currIndex: " << currentIndex;

        emit currentIndexChanged();

        if(autoQueue)
        {
            //check if current item is the last in list
            if(currentIndex == (playlist->mediaCount() -1))
            {
                //insert random item next
                tracker->randomItem();
            }
        }
    }
}
FormGenChoiceCompositionComboListContainer::FormGenChoiceCompositionComboListContainer(bool listMode, QWidget *parent)
    : FormGenChoiceCompositionContainer(parent)
    , mComboBox(nullptr)
    , mListView(nullptr)
    , mListModel(nullptr)
    , mElementContainer(new QWidget)
    , mElementLayout(new QStackedLayout)
{
    mElementContainer->setLayout(mElementLayout);

    auto outerLayout = new QGridLayout;
    outerLayout->setContentsMargins(0, 0, 0, 0);

    if( listMode ) {
        mListView = new QListView;
        mListModel = new QStringListModel;
        mListView->setModel(mListModel);
        connect(mListView->selectionModel(), &QItemSelectionModel::currentChanged,
                [this] ()
        {
            const int row = mListView->selectionModel()->currentIndex().row();
            mElementLayout->setCurrentIndex(row);
            emit currentIndexChanged(row);
        });
        outerLayout->addWidget(mListView, 0, 0, 1, 2);
    } else {
        mComboBox = new QComboBox;
        connect(mComboBox, SIGNAL(currentIndexChanged(int)), mElementLayout, SLOT(setCurrentIndex(int)));
        connect(mComboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(currentIndexChanged(int)));
        outerLayout->addWidget(mComboBox, 0, 0, 1, 2);
    }

    outerLayout->addItem(new QSpacerItem(s_frameSubContentMargin, 1), 1, 0);
    outerLayout->addWidget(mElementContainer, 1, 1);

    setLayout(outerLayout);
}
bool HelpDialog::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: showTopic((int)static_QUType_int.get(_o+1),(QListBoxItem*)static_QUType_ptr.get(_o+2),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+3))); break;
    case 1: showTopic((int)static_QUType_int.get(_o+1),(QListViewItem*)static_QUType_ptr.get(_o+2),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+3))); break;
    case 2: showTopic((QListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 3: loadIndexFile(); break;
    case 4: insertContents(); break;
    case 5: setupFullTextIndex(); break;
    case 6: currentTabChanged((const QString&)static_QUType_QString.get(_o+1)); break;
    case 7: currentIndexChanged((QListBoxItem*)static_QUType_ptr.get(_o+1)); break;
    case 8: showTopic(); break;
    case 9: searchInIndex((const QString&)static_QUType_QString.get(_o+1)); break;
    case 10: addBookmark(); break;
    case 11: removeBookmark(); break;
    case 12: currentBookmarkChanged((QListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 13: currentContentsChanged((QListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 14: startSearch(); break;
    case 15: showSearchHelp(); break;
    case 16: initialize(); break;
    case 17: toggleContents(); break;
    case 18: toggleIndex(); break;
    case 19: toggleBookmarks(); break;
    case 20: toggleSearch(); break;
    case 21: lastWinClosed(); break;
    case 22: showResultPage((int)static_QUType_int.get(_o+1),(QListBoxItem*)static_QUType_ptr.get(_o+2),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+3))); break;
    case 23: showResultPage((QListBoxItem*)static_QUType_ptr.get(_o+1)); break;
    case 24: setIndexingProgress((int)static_QUType_int.get(_o+1)); break;
    case 25: showItemMenu((QListBoxItem*)static_QUType_ptr.get(_o+1),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+2))); break;
    case 26: showItemMenu((QListViewItem*)static_QUType_ptr.get(_o+1),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+2))); break;
    case 27: insertBookmarks(); break;
    case 28: processEvents(); break;
    default:
	return HelpDialogBase::qt_invoke( _id, _o );
    }
    return TRUE;
}
Example #4
0
NewGameDialog::NewGameDialog(QWidget* parent)
	: QDialog(parent),
	  ui(new Ui::NewGameDialog)
{
	ui->setupUi(this);

	m_engines = new EngineConfigurationModel(
		CuteChessApplication::instance()->engineManager(), this);

	connect(ui->m_configureWhiteEngineButton, SIGNAL(clicked(bool)), this,
		SLOT(configureWhiteEngine()));
	connect(ui->m_configureBlackEngineButton, SIGNAL(clicked(bool)), this,
		SLOT(configureBlackEngine()));

	connect(ui->m_timeControlBtn, SIGNAL(clicked()),
		this, SLOT(showTimeControlDialog()));

	m_proxyModel = new EngineConfigurationProxyModel(this);
	m_proxyModel->setSourceModel(m_engines);
	m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
	m_proxyModel->sort(0);
	m_proxyModel->setDynamicSortFilter(true);

	ui->m_whiteEngineComboBox->setModel(m_proxyModel);
	ui->m_blackEngineComboBox->setModel(m_proxyModel);

	ui->m_variantComboBox->addItems(Chess::BoardFactory::variants());
	connect(ui->m_variantComboBox, SIGNAL(currentIndexChanged(QString)),
		this, SLOT(onVariantChanged(QString)));

	int index = ui->m_variantComboBox->findText("standard");
	ui->m_variantComboBox->setCurrentIndex(index);

	m_timeControl.setMovesPerTc(40);
	m_timeControl.setTimePerTc(300000);
	ui->m_timeControlBtn->setText(m_timeControl.toVerboseString());
}
void PropertiesManager::createEventPortProperties(EventPortTextItem *ep)
{
    //move up down
    root->actionMove_Up->setEnabled(true);
    root->actionMove_Down->setEnabled(true);
    root->actionDeleteItems->setEnabled(true);

    QLabel *label = new QLabel("<b>Edit Event Port</b>");
    addRow(label);

    QComboBox *mode = new QComboBox();
    mode->addItem("Send");
    mode->addItem("Receive");
    EventPortMode m = ep->getPortMode();
    switch(m){
    case(EventSendPort):{
        mode->setCurrentIndex(0);
        break;
    }
    case(EventRecvPort):{
        mode->setCurrentIndex(1);
        break;
    }
    default:{
        mode->setCurrentIndex(-1);
    }
    }
    connect(mode, SIGNAL(currentIndexChanged(QString)), ep, SLOT(setPortMode(QString)));
    addRow(tr("Event &Mode:"), mode);

    QLineEdit *name = new QLineEdit();
    name->installEventFilter(&eventFilterObject);
    name->setText(ep->getName());
    name->setValidator(validator);
    connect(name, SIGNAL(textEdited(QString)), ep, SLOT(setName(QString)));
    addRow(tr("&Name:"),name);
}
processByDignityWidget::processByDignityWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::processByDignityWidget),
    fechaModel(new QSqlTableModel),
    resultModel(new QSqlTableModel),
    noaaResultModel(new QSqlTableModel),
    information(new dataProcessor)
{
    ui->setupUi(this);
    QStringList items;

    connect(ui->filterButton, SIGNAL(clicked()), this, SLOT(doCalc()));
    connect(ui->dignityFilterButton, SIGNAL(clicked()), this, SLOT(calcDignity()));

    connect(ui->addButton, SIGNAL(clicked()), this, SLOT(add()));
    connect(ui->delButton, SIGNAL(clicked()), this, SLOT(del()));

    items << "Normal" << "Luna llena" << "Luna nueva" << "Equinoccios" << "Solsticios";
    ui->tipoComboBox->addItems(items);
    fechaModel->setTable("view_estadotiempos");
    fechaModel->select();
    //resultModel->setTable("validweather");
    resultModel->setTable("view_estadotiempos");
    noaaResultModel->setTable("estadotiempos_diarios");
    ui->tableView->setModel(resultModel);
    ui->noaaTableView->setModel(noaaResultModel);
    ui->fechaComboBox->setModel(fechaModel);
    ui->fechaComboBox->setModelColumn(0);
    dateTypeChanged("Normal");
    setWindowTitle("Procesar por Dignidades");
    connect(ui->tipoComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(dateTypeChanged(QString)));

    ui->noaaTableView->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->tableView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->noaaTableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(noaaMenu(QPoint)));
    connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(dailyMenu(QPoint)));
}
MusicUserDialog::MusicUserDialog(QWidget *parent)
    : MusicAbstractMoveDialog(parent),
      ui(new Ui::MusicUserDialog)
{
    ui->setupUi(this);

    m_userModel = new MusicUserModel(this);

    MusicTime::timeSRand();
    changeVerificationCode();

    ui->topTitleCloseButton->setIcon(QIcon(":/share/searchclosed"));
    ui->topTitleCloseButton->setStyleSheet(MusicUIObject::MToolButtonStyle03);
    ui->topTitleCloseButton->setCursor(QCursor(Qt::PointingHandCursor));
    ui->topTitleCloseButton->setToolTip(tr("Close"));
    connect(ui->topTitleCloseButton, SIGNAL(clicked()), SLOT(close()));

    firstStatckWidget();
    secondStatckWidget();
    thirdStatckWidget();

    ui->userComboBox->addItems(m_userModel->getAllUsers());
    connect(ui->userComboBox, SIGNAL(currentIndexChanged(QString)),
                              SLOT(userComboBoxChanged(QString)));
    connect(ui->userComboBox, SIGNAL(editTextChanged(QString)),
                              SLOT(userEditTextChanged(QString)));
    m_userName = ui->userComboBox->currentText();
    readFromUserConfig();

    QButtonGroup *buttonGroup = new QButtonGroup(this);
    buttonGroup->addButton(ui->useTencentLogin, 0);
    buttonGroup->addButton(ui->useRenrenLogin, 1);
    buttonGroup->addButton(ui->useWechatLogin, 2);
    buttonGroup->addButton(ui->useSinaLogin, 3);
    connect(buttonGroup, SIGNAL(buttonClicked(int)), SLOT(buttonClicked(int)));
}
Example #8
0
void PaperManager::paperClosed( const QVariant & var )
{
    QQuickItem *paper = var.value<QQuickItem*>();
    if( p->buffer.indexOf(paper) == 0 && p->current != 0 )
    {
        paper->setProperty( "x" ,paper->property("closeX") );
        return;
    }

    if( p->current >= p->papers.count() )
        QMetaObject::invokeMethod( paper, "save" );

    p->current++;
    emit currentPaperChanged();
    emit currentIndexChanged();

    if( p->current == 1 )
    {
        p->buffer.last()->setProperty( "visible" ,true );
        load_buffers();
        return;
    }

    QQuickItem *top = p->buffer.takeFirst();
    p->buffer << top;
    reindexBuffer();

    top->setProperty( "anim" ,false );
    top->setProperty( "x" ,0 );

    top->setProperty( "opacity", 0 );
    QMetaObject::invokeMethod( top, "startAnimation" );
    top->setProperty( "opacity", 1 );

    load_buffers();
}
Example #9
0
QWidget* Strings::createEditor(QWidget * parent, const QModelIndex & index)
{
    Q_UNUSED(index);
    QStringList variants = propertyVariants();
    if (!variants.isEmpty()) {
        QComboBox * cb = new QComboBox(parent);
        cb->addItems(variants);
        connect(cb, SIGNAL(currentIndexChanged(QString)), this, SLOT(setValue(QString)));
        return cb;
    } else {
        QLineEdit *le = new QLineEdit(parent);
        if (validator(QVariant::String))
        {
            validator(QVariant::String)->setObject(object());
            validator(QVariant::String)->setProperty(objectPropertyName());
            le->setValidator(validator(QVariant::String));
        }
        le->setText(value().toString());
        connect(le, SIGNAL(textChanged(const QString&)), this, SLOT(setValue(const QString&)));
        le->setFrame(false);
        return le;
    }

}
Example #10
0
DataPlotUI::DataPlotUI(int deploymentId, QWidget *parent)
    : QDialog(parent) {
    ui.setupUi(this);

    this->deploymentId = deploymentId;

    // init combo boxes
    initComboArea();

    // connect signals and slots
    connect(ui.cbMeasurementProfileID, SIGNAL(currentIndexChanged(QString)), this, SLOT(measurementProfileChanged()));
    connect(ui.btnClose, SIGNAL(clicked()), this, SLOT(closeButtonClicked()));

    //ui.plData->setTitle("Data");
    ui.plData->setAxisTitle(QwtPlot::xBottom, "Time");
    ui.plData->setAxisTitle(QwtPlot::yLeft, "Temperature [Celsius]");
    ui.plData->setCanvasBackground(Qt::white);

    curve1 = new QwtPlotCurve("Measurements");
    curve1->attach(ui.plData);
    curve1->setPen(QPen(Qt::black, 1, Qt::SolidLine));

    ui.plData->replot();
}
Example #11
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    ontology_viewer.show();
    label_viewer.show();
    tracker_output_viewer.show();

    // Action menu for opening the files
    connect(this->ui->actionOpen_ontology, SIGNAL(triggered()), this, SLOT(openOntology()));
    connect(this->ui->actionOpen_dialogs, SIGNAL(triggered()), this, SLOT(openDialogs()));
    connect(this->ui->actionOpen_tracker_output, SIGNAL(triggered()), this, SLOT(openTrackerOutput()));

    // Leave on quit
    connect(this->ui->actionQuit, SIGNAL(triggered()), this, SLOT(close()));

    // Show an help message when requested
    connect(this->ui->actionManual, SIGNAL(triggered()), this, SLOT(showTips()));

    // Detecting that a new dialog is selected
    connect(this->ui->dialog_combBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeDialog(QString)));

    // Browsing the dialogs
    connect(this->ui->dialog_prevButton, SIGNAL(clicked()), this, SLOT(prev_dialog()));
    connect(this->ui->dialog_nextButton, SIGNAL(clicked()), this, SLOT(next_dialog()));

    // Using the possibility to filter the dialogs by a prefix
    connect(this->ui->dialog_prefix_lineedit, SIGNAL(textChanged(QString)), this, SLOT(dialog_prefix_textChanged(QString)));

    // Getting the info the tracker output wants to be sync to the mainwindow session id
    connect(&tracker_output_viewer, SIGNAL(sig_sync_to_dialog(bool)), this, SLOT(sync_tracker_output_to_session(bool)));


}
void AddNetworkSinkDialog::initializeGUI()
{
    setupUi(this);
    connect(mCbNAPIImpl, SIGNAL(currentIndexChanged(QString)), this, SLOT(NAPISelectionChanged(QString)));

    if (!CONF.DebuggingEnabled())
    {
        mGbRequirements->hide();
        mGbInterface->hide();
        // minimize layout
        ShrinkWidgetToMinimumSize();
    }
    if ((mDataType != DATA_TYPE_VIDEO) && (mDataType != DATA_TYPE_AUDIO))
    {
        mCbRtp->hide();
    }

    // is the source something different than a muxer?
    if (!mMediaSource->SupportsMuxing())
    {// the input stream from the source has to relayed, without RTP an additional encapsulation
        mCbRtp->setChecked(false);
        mCbRtp->setEnabled(false);
    }
}
Example #13
0
startDialog::startDialog(QApplication *a, int argc, char *argv[], QWidget *parent) : QWidget(parent) {
    ui = new Ui::Form;
    ui->setupUi(this);
    app = a;
    scanSkins();
    loadSettings();
    bool st = false;
    for (int i = 0; i < argc; i++) {
        QString cur = argv[i];
        if ((cur == "-i") || (cur == "--ip"))
            ui->lineEdit_2->setText(argv[i + 1]);
        else if ((cur == "-p") || (cur == "--port"))
            ui->spinBox->setValue(QString(argv[i + 1]).toInt());
        else if ((cur == "-n") || (cur == "--name"))
            ui->lineEdit->setText(QString(argv[i + 1]));
        else if ((cur == "-s") || (cur == "--start"))
            st = true;
        else if ((cur == "-h") || (cur == "--help")) {
            printf("Welcome to labyrus-client documentation\n");
            printf("-i --ip int.int.int.int        to set ip address\n");
            printf("-p --port int                  to set port number\n");
            printf("-n --name name                 to set name of player\n");
            printf("-s --start                     to auto start game\n");
            printf("-h --help                      to show this help\n");
            exit(0);
        }
    }

    if (st) {
        QTimer::singleShot(100, this, SLOT(start()));
    } else {
        QObject::connect(ui->commandLinkButton, SIGNAL(clicked()), this, SLOT(start()));
        QObject::connect(ui->comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPix(QString)));
    }
    ui->commandLinkButton->setFocus();
}
Example #14
0
void KNCategoryTabBar::setCurrentIndex(int buttonIndex)
{
    Q_ASSERT(buttonIndex>-1 && buttonIndex<m_buttonList.size());
    //If the current index is button clicked, do nothing.
    if(m_locked || buttonIndex==m_currentIndex)
    {
        return;
    }
    KNCategoryButton *button;
    //Reset the old current index button, check the index first.
    if(m_currentIndex!=-1 && m_currentIndex<m_buttonList.size())
    {
        button=m_buttonList.at(m_currentIndex);
        button->setChecked(false);
    }
    //Set to the current index.
    m_currentIndex=buttonIndex;
    button=m_buttonList.at(m_currentIndex);
    button->setChecked(true);
    //Lock the tabbed
    m_locked=true;
    //Emit index changed signal.
    emit currentIndexChanged(m_currentIndex);
}
Example #15
0
// AppearanceSettings ----------------------------------------------------
AppearanceSettings::AppearanceSettings( QWidget* parent, Qt::WFlags fl )
    : QDialog(parent, fl),
    mIsStatusView(false), mIsFromActiveProfile(false)
{
    setupUi();
    readThemeSettings();
    readColorSchemeSettings();

    // Populate the first combo box (theme).
    populate();

    // Select the theme to populate the other combo boxes.
    // Note that they are not connected yet, so no preview is requested.
    themeSelected(mActiveThemeIndex);

    // Connect the combo boxes.
    connect( mThemeCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(themeSelected(int)) );
    connect( mColorCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(colorSelected(int)) );
    connect( mBgCombo, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(backgroundSelected(QString)) );
    connect( mLabelCkBox, SIGNAL(toggled(bool)),
            this, SLOT(labelToggled(bool)) );

    connect( qApp, SIGNAL(appMessage(QString,QByteArray)),
        this, SLOT(receive(QString,QByteArray)) );

    // Re-select the theme to request the previews.
    themeSelected(mActiveThemeIndex);

    QSoftMenuBar::menuFor( this )->addAction
        ( QIcon( ":icon/Note" ), tr( "Add to current profile" ), this, SLOT(pushSettingStatus()) );
    QSoftMenuBar::menuFor( this )->addAction
        ( QIcon( ":image/homescreen/homescreen" ), tr( "Homescreen Settings..." ), this, SLOT(openHomescreenSettings()) );
}
Example #16
0
//==========
//    PUBLIC
//==========
page_mouse_trueos::page_mouse_trueos(QWidget *parent) : PageWidget(parent), ui(new Ui::page_mouse_trueos()){
  ui->setupUi(this);
  QString program = "/usr/sbin/moused";
  
  ui->slider_mouseAcceleration->setRange(1,200);
  ui->slider_mouseAcceleration->setValue(100);
  connect( ui->slider_mouseAcceleration, SIGNAL(valueChanged(int)), this, SLOT(setValue(double)));
  realAccelValue = ( ui->slider_mouseAcceleration->value() / divisor);
  realAccelValueString = QString::number(ui->slider_mouseAcceleration->value() / divisor, 'f', 2);
  
  ui->slider_doubleClickThreshold->setRange(1,1000);
  ui->slider_doubleClickThreshold->setValue(500);
  connect( ui->slider_doubleClickThreshold, SIGNAL(valueChanged(int)), this, SLOT(setValue(double)));
  realDoubleClickValue = (ui->slider_doubleClickThreshold->value());
  realDoubleClickValueString = QString::number(ui->slider_doubleClickThreshold->value());

  ui->combobox_resolutionBox->setCurrentIndex(1);
  connect(ui->combobox_resolutionBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setMouseResolution()) );

  connect(ui->checkBoxHandedness, SIGNAL(toggled(bool)), this, SLOT(swapHandedness()) );
  connect(ui->checkBoxTerminateDrift, SIGNAL(toggled(bool)), this, SLOT(terminateDrift()) );

  connect( ui->button_apply, SIGNAL(clicked()), this, SLOT(updateMoused()));
}
Example #17
0
crmaccountMerge::crmaccountMerge(QWidget* parent, const char* name, Qt::WFlags fl)
    : QWizard(parent, fl)
{
  setupUi(this);
  if (name)
    setObjectName(name);
  _data = new crmaccountMergePrivate(this);
  QPixmap *pixmap = new QPixmap(":/images/icon128x32.png");
  if (pixmap)
  {
#ifdef Q_WS_MAC
  setPixmap(BackgroundPixmap, *pixmap);
#else
  setPixmap(BannerPixmap,     *pixmap);
#endif
  }

  QWizardPage *picktaskpage = new CrmaccountMergePickTaskPage(this);
  QWizardPage *pickacctpage = new CrmaccountMergePickAccountsPage(this);
  QWizardPage *pickdatapage = new CrmaccountMergePickDataPage(this);
  QWizardPage *mergerespage = new CrmaccountMergeResultPage(this);
  QWizardPage *mergeprgpage = new CrmaccountMergePurgePage(this);

  setPage(Page_PickTask,        picktaskpage);
  setPage(Page_PickAccounts,    pickacctpage);
  setPage(Page_PickData,        pickdatapage);
  setPage(Page_Result,          mergerespage);
  setPage(Page_Purge,           mergeprgpage);

  setButtonText(CancelButton, tr("Close"));

  setDefaultProperty("XComboBox", "text", SIGNAL(currentIndexChanged(QString)));

  connect(mergeprgpage, SIGNAL(mergeSetChanged()), picktaskpage, SLOT(sUpdateComboBoxes()));
  connect(mergeprgpage, SIGNAL(mergeSetChanged()), mergerespage, SLOT(clearIfPurged()));
}
Example #18
0
TestPanel::TestPanel(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::TestPanel)
{
    ui->setupUi(this);

    connect(ui->laserCommState, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(handleLaserComms(QString)));
    connect(ui->cameraCommsState, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(handleCameraComms(QString)));
    connect(ui->laserOpState, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(handleLaserOpState(QString)));
    connect(ui->cameraOpState, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(handleCameraOpState(QString)));
    connect(ui->roverOpState, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(handleRoverOpState(QString)));
    connect(ui->laserActiveState, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(handleLaserFireState(QString)));
    show();
}
Example #19
0
Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
    : QDialog(parent)
    , ui(new Ui::Preferences)
    , p_QupZilla(mainClass)
    , m_pluginsList(0)
{
    setAttribute(Qt::WA_DeleteOnClose);
    ui->setupUi(this);

#ifdef KDE
    ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
    ui->listWidget->item(1)->setIcon(QIcon::fromTheme("format-stroke-color", QIcon(":/icons/preferences/application-x-theme.png")));
    ui->listWidget->item(2)->setIcon(QIcon::fromTheme("tab-new-background", QIcon(":/icons/preferences/applications-internet.png")));
    ui->listWidget->item(3)->setIcon(QIcon::fromTheme("preferences-system-network", QIcon(":/icons/preferences/applications-webbrowsers.png")));
    ui->listWidget->item(4)->setIcon(QIcon::fromTheme("preferences-desktop-font", QIcon(":/icons/preferences/applications-fonts.png")));
    ui->listWidget->item(5)->setIcon(QIcon::fromTheme("download", QIcon(":/icons/preferences/mail-inbox.png")));
    ui->listWidget->item(6)->setIcon(QIcon::fromTheme("user-identity", QIcon(":/icons/preferences/dialog-password.png")));
    ui->listWidget->item(7)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png")));
    ui->listWidget->item(8)->setIcon(QIcon::fromTheme("preferences-desktop-notification", QIcon(":/icons/preferences/dialog-question.png")));
    ui->listWidget->item(9)->setIcon(QIcon::fromTheme("preferences-plugin", QIcon(":/icons/preferences/extension.png")));
    ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
#else
    ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
    ui->listWidget->item(1)->setIcon(QIcon::fromTheme("application-x-theme", QIcon(":/icons/preferences/application-x-theme.png")));
    ui->listWidget->item(2)->setIcon(QIcon::fromTheme("applications-internet", QIcon(":/icons/preferences/applications-internet.png")));
    ui->listWidget->item(3)->setIcon(QIcon::fromTheme("applications-webbrowsers", QIcon(":/icons/preferences/applications-webbrowsers.png")));
    ui->listWidget->item(4)->setIcon(QIcon::fromTheme("applications-fonts", QIcon(":/icons/preferences/applications-fonts.png")));
    ui->listWidget->item(5)->setIcon(QIcon::fromTheme("mail-inbox", QIcon(":/icons/preferences/mail-inbox.png")));
    ui->listWidget->item(6)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png")));
    ui->listWidget->item(7)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png")));
    ui->listWidget->item(8)->setIcon(QIcon::fromTheme("dialog-question", QIcon(":/icons/preferences/dialog-question.png")));
    ui->listWidget->item(9)->setIcon(QIcon::fromTheme("extension", QIcon(":/icons/preferences/extension.png")));
    ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
#endif

    Settings settings;
    //GENERAL URLs
    settings.beginGroup("Web-URL-Settings");
    m_homepage = settings.value("homepage", "qupzilla:start").toString();
    m_newTabUrl = settings.value("newTabUrl", "qupzilla:speeddial").toString();
    ui->homepage->setText(m_homepage);
    ui->newTabUrl->setText(m_newTabUrl);
    int afterLaunch = settings.value("afterLaunch", 1).toInt();
    settings.endGroup();
    ui->afterLaunch->setCurrentIndex(afterLaunch);
    ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", DEFAULT_CHECK_UPDATES).toBool());
    ui->dontLoadTabsUntilSelected->setChecked(settings.value("Web-Browser-Settings/LoadTabsOnActivation", false).toBool());

    ui->newTabFrame->setVisible(false);
    if (m_newTabUrl.isEmpty()) {
        ui->newTab->setCurrentIndex(0);
    }
    else if (m_newTabUrl == m_homepage) {
        ui->newTab->setCurrentIndex(1);
    }
    else if (m_newTabUrl == "qupzilla:speeddial") {
        ui->newTab->setCurrentIndex(2);
    }
    else {
        ui->newTab->setCurrentIndex(3);
        ui->newTabFrame->setVisible(true);
    }

    afterLaunchChanged(ui->afterLaunch->currentIndex());
    connect(ui->afterLaunch, SIGNAL(currentIndexChanged(int)), this, SLOT(afterLaunchChanged(int)));
    connect(ui->newTab, SIGNAL(currentIndexChanged(int)), this, SLOT(newTabChanged(int)));
    connect(ui->useCurrentBut, SIGNAL(clicked()), this, SLOT(useActualHomepage()));
    connect(ui->newTabUseCurrent, SIGNAL(clicked()), this, SLOT(useActualNewTab()));

    //PROFILES
    m_actProfileName = mApp->getActiveProfilPath();
    m_actProfileName = m_actProfileName.left(m_actProfileName.length() - 1);
    m_actProfileName = m_actProfileName.mid(m_actProfileName.lastIndexOf("/"));
    m_actProfileName.remove("/");

    ui->activeProfile->setText("<b>" + m_actProfileName + "</b>");

    QSettings profileSettings(mApp->PROFILEDIR + "profiles/profiles.ini", QSettings::IniFormat);
    QString actProfileName = profileSettings.value("Profiles/startProfile", "default").toString();

    ui->startProfile->addItem(actProfileName);
    QDir profilesDir(mApp->PROFILEDIR + "profiles/");
    QStringList list_ = profilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
    foreach(const QString & name, list_) {
        if (actProfileName == name) {
            continue;
        }
        ui->startProfile->addItem(name);
    }
    connect(ui->createProfile, SIGNAL(clicked()), this, SLOT(createProfile()));
    connect(ui->deleteProfile, SIGNAL(clicked()), this, SLOT(deleteProfile()));
    connect(ui->startProfile, SIGNAL(currentIndexChanged(QString)), this, SLOT(startProfileIndexChanged(QString)));
    startProfileIndexChanged(ui->startProfile->currentText());

    //APPEREANCE
    m_themesManager = new ThemeManager(ui->themesWidget, this);
    settings.beginGroup("Browser-View-Settings");
    ui->showStatusbar->setChecked(settings.value("showStatusBar", true).toBool());
    ui->showBookmarksToolbar->setChecked(p_QupZilla->bookmarksToolbar()->isVisible());
    ui->showNavigationToolbar->setChecked(p_QupZilla->navigationBar()->isVisible());
    ui->showHome->setChecked(settings.value("showHomeButton", true).toBool());
    ui->showBackForward->setChecked(settings.value("showBackForwardButtons", true).toBool());
    ui->showAddTabButton->setChecked(settings.value("showAddTabButton", false).toBool());
    ui->useTransparentBg->setChecked(settings.value("useTransparentBackground", false).toBool());
    ui->askOnPrivateBrowsing->setChecked(settings.value("AskOnPrivate", true).toBool());
    settings.endGroup();
#ifdef Q_WS_WIN
    ui->useTransparentBg->setEnabled(QtWin::isCompositionEnabled());
#endif

    //TABS
    settings.beginGroup("Browser-Tabs-Settings");
    ui->makeMovable->setChecked(settings.value("makeTabsMovable", true).toBool());
    ui->hideTabsOnTab->setChecked(settings.value("hideTabsWithOneTab", false).toBool());
    ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool());
    ui->openNewTabAfterActive->setChecked(settings.value("newTabAfterActive", true).toBool());
    ui->dontQuitOnTab->setChecked(settings.value("dontQuitWithOneTab", false).toBool());
    ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
    ui->closedInsteadOpened->setChecked(settings.value("closedInsteadOpenedTabs", false).toBool());
    settings.endGroup();
    //AddressBar
    settings.beginGroup("AddressBar");
    ui->selectAllOnFocus->setChecked(settings.value("SelectAllTextOnDoubleClick", true).toBool());
    ui->selectAllOnClick->setChecked(settings.value("SelectAllTextOnClick", false).toBool());
    ui->addCountryWithAlt->setChecked(settings.value("AddCountryDomainWithAltKey", true).toBool());
    settings.endGroup();

    //BROWSING
    settings.beginGroup("Web-Browser-Settings");
    ui->allowPlugins->setChecked(settings.value("allowFlash", true).toBool());
    ui->allowJavaScript->setChecked(settings.value("allowJavaScript", true).toBool());
    ui->allowJava->setChecked(settings.value("allowJava", true).toBool());
    ui->allowDNSPrefetch->setChecked(settings.value("DNS-Prefetch", false).toBool());
    ui->linksInFocusChain->setChecked(settings.value("IncludeLinkInFocusChain", false).toBool());
    ui->zoomTextOnly->setChecked(settings.value("zoomTextOnly", false).toBool());
    ui->printEBackground->setChecked(settings.value("PrintElementBackground", true).toBool());
    ui->wheelScroll->setValue(settings.value("wheelScrollLines", qApp->wheelScrollLines()).toInt());
    ui->defaultZoom->setValue(settings.value("DefaultZoom", 100).toInt());
    ui->xssAuditing->setChecked(settings.value("XSSAuditing", false).toBool());

    if (!ui->allowJavaScript->isChecked()) {
        ui->blockPopup->setEnabled(false);
    }
    connect(ui->allowJavaScript, SIGNAL(toggled(bool)), this, SLOT(allowJavaScriptChanged(bool)));
    //Cache
    ui->pagesInCache->setValue(settings.value("maximumCachedPages", 3).toInt());
    connect(ui->pagesInCache, SIGNAL(valueChanged(int)), this, SLOT(pageCacheValueChanged(int)));
    ui->pageCacheLabel->setText(QString::number(ui->pagesInCache->value()));

    ui->allowCache->setChecked(settings.value("AllowLocalCache", true).toBool());
    ui->cacheMB->setValue(settings.value("LocalCacheSize", 50).toInt());
    ui->MBlabel->setText(settings.value("LocalCacheSize", 50).toString() + " MB");
    connect(ui->allowCache, SIGNAL(clicked(bool)), this, SLOT(allowCacheChanged(bool)));
    connect(ui->cacheMB, SIGNAL(valueChanged(int)), this, SLOT(cacheValueChanged(int)));
    allowCacheChanged(ui->allowCache->isChecked());

    //PASSWORD MANAGER
    ui->allowPassManager->setChecked(settings.value("SavePasswordsOnSites", true).toBool());
    connect(ui->allowPassManager, SIGNAL(toggled(bool)), this, SLOT(showPassManager(bool)));

    m_autoFillManager = new AutoFillManager(this);
    ui->autoFillFrame->addWidget(m_autoFillManager);
    showPassManager(ui->allowPassManager->isChecked());

    //PRIVACY
    //Web storage
    ui->saveHistory->setChecked(settings.value("allowHistory", true).toBool());
    ui->deleteHistoryOnClose->setChecked(settings.value("deleteHistoryOnClose", false).toBool());
    if (!ui->saveHistory->isChecked()) {
        ui->deleteHistoryOnClose->setEnabled(false);
    }
    connect(ui->saveHistory, SIGNAL(toggled(bool)), this, SLOT(saveHistoryChanged(bool)));

    // Html5Storage
    ui->html5storage->setChecked(settings.value("HTML5StorageEnabled", true).toBool());
    ui->deleteHtml5storageOnClose->setChecked(settings.value("deleteHTML5StorageOnClose", false).toBool());
    connect(ui->html5storage, SIGNAL(toggled(bool)), this, SLOT(allowHtml5storageChanged(bool)));
    // Other
    ui->blockPopup->setChecked(!settings.value("allowJavaScriptOpenWindow", false).toBool());
    ui->jscanAccessClipboard->setChecked(settings.value("JavaScriptCanAccessClipboard", true).toBool());
    ui->doNotTrack->setChecked(settings.value("DoNotTrack", false).toBool());
    ui->sendReferer->setChecked(settings.value("SendReferer", true).toBool());

    // UserAgent
    const QString &os = qz_buildSystem();
    QStringList items;
    items << QString("Opera/9.80 (%1) Presto/2.10.229 Version/11.61").arg(os)
          << QString("Mozilla/5.0 (%1) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7").arg(os)
          << QString("Mozilla/5.0 (%1) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1").arg(os)
          << QString("Mozilla/5.0 (%1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1").arg(os);

    const QString &savedUserAgent = settings.value("UserAgent", "").toString();
    ui->changeUserAgent->setChecked(!savedUserAgent.isEmpty());
    ui->userAgentCombo->addItems(items);

    int index = ui->userAgentCombo->findText(savedUserAgent);
    if (index >= 0) {
        ui->userAgentCombo->setCurrentIndex(index);
    }
    else {
        ui->userAgentCombo->lineEdit()->setText(savedUserAgent);
    }

    ui->userAgentCombo->lineEdit()->setCursorPosition(0);
    connect(ui->changeUserAgent, SIGNAL(toggled(bool)), this, SLOT(changeUserAgentChanged(bool)));
    changeUserAgentChanged(ui->changeUserAgent->isChecked());

    //CSS Style
    ui->userStyleSheet->setText(settings.value("userStyleSheet", "").toString());
    connect(ui->chooseUserStylesheet, SIGNAL(clicked()), this, SLOT(chooseUserStyleClicked()));
    settings.endGroup();

    //Cookies
    settings.beginGroup("Cookie-Settings");
    ui->saveCookies->setChecked(settings.value("allowCookies", true).toBool());
    if (!ui->saveCookies->isChecked()) {
        ui->deleteCookiesOnClose->setEnabled(false);
    }
    connect(ui->saveCookies, SIGNAL(toggled(bool)), this, SLOT(saveCookiesChanged(bool)));
    ui->deleteCookiesOnClose->setChecked(settings.value("deleteCookiesOnClose", false).toBool());
    ui->matchExactly->setChecked(settings.value("allowCookiesFromVisitedDomainOnly", false).toBool());
    ui->filterTracking->setChecked(settings.value("filterTrackingCookie", false).toBool());
    settings.endGroup();

    //DOWNLOADS
    settings.beginGroup("DownloadManager");
    ui->downLoc->setText(settings.value("defaultDownloadPath", "").toString());
    ui->closeDownManOnFinish->setChecked(settings.value("CloseManagerOnFinish", false).toBool());
    ui->downlaodNativeSystemDialog->setChecked(settings.value("useNativeDialog", DEFAULT_USE_NATIVE_DIALOG).toBool());
    if (ui->downLoc->text().isEmpty()) {
        ui->askEverytime->setChecked(true);
    }
    else {
        ui->useDefined->setChecked(true);
    }
    ui->useExternalDownManager->setChecked(settings.value("UseExternalManager", false).toBool());
    ui->externalDownExecutable->setText(settings.value("ExternalManagerExecutable", "").toString());
    ui->externalDownArguments->setText(settings.value("ExternalManagerArguments", "").toString());

    connect(ui->useExternalDownManager, SIGNAL(toggled(bool)), this, SLOT(useExternalDownManagerChanged(bool)));
    connect(ui->useDefined, SIGNAL(toggled(bool)), this, SLOT(downLocChanged(bool)));
    connect(ui->downButt, SIGNAL(clicked()), this, SLOT(chooseDownPath()));
    connect(ui->chooseExternalDown, SIGNAL(clicked()), this, SLOT(chooseExternalDownloadManager()));
    downLocChanged(ui->useDefined->isChecked());
    useExternalDownManagerChanged(ui->useExternalDownManager->isChecked());
    settings.endGroup();

    //FONTS
    settings.beginGroup("Browser-Fonts");
    ui->fontStandard->setCurrentFont(QFont(settings.value("StandardFont", mApp->webSettings()->fontFamily(QWebSettings::StandardFont)).toString()));
    ui->fontCursive->setCurrentFont(QFont(settings.value("CursiveFont", mApp->webSettings()->fontFamily(QWebSettings::CursiveFont)).toString()));
    ui->fontFantasy->setCurrentFont(QFont(settings.value("FantasyFont", mApp->webSettings()->fontFamily(QWebSettings::FantasyFont)).toString()));
    ui->fontFixed->setCurrentFont(QFont(settings.value("FixedFont", mApp->webSettings()->fontFamily(QWebSettings::FixedFont)).toString()));
    ui->fontSansSerif->setCurrentFont(QFont(settings.value("SansSerifFont", mApp->webSettings()->fontFamily(QWebSettings::SansSerifFont)).toString()));
    ui->fontSerif->setCurrentFont(QFont(settings.value("SerifFont", mApp->webSettings()->fontFamily(QWebSettings::SerifFont)).toString()));

    ui->sizeDefault->setValue(settings.value("DefaultFontSize", mApp->webSettings()->fontSize(QWebSettings::DefaultFontSize)).toInt());
    ui->sizeFixed->setValue(settings.value("FixedFontSize", mApp->webSettings()->fontSize(QWebSettings::DefaultFixedFontSize)).toInt());
    ui->sizeMinimum->setValue(settings.value("MinimumFontSize", mApp->webSettings()->fontSize(QWebSettings::MinimumFontSize)).toInt());
    ui->sizeMinimumLogical->setValue(settings.value("MinimumLogicalFontSize", mApp->webSettings()->fontSize(QWebSettings::MinimumLogicalFontSize)).toInt());
    settings.endGroup();

    //PLUGINS
    m_pluginsList = new PluginsList(this);
    ui->pluginsFrame->addWidget(m_pluginsList);

    //NOTIFICATIONS
#ifdef Q_WS_X11
    ui->useNativeSystemNotifications->setEnabled(true);
#endif
    DesktopNotificationsFactory::Type notifyType;
    settings.beginGroup("Notifications");
    ui->notificationTimeout->setValue(settings.value("Timeout", 6000).toInt() / 1000);
#ifdef Q_WS_X11
    notifyType = settings.value("UseNativeDesktop", true).toBool() ? DesktopNotificationsFactory::DesktopNative : DesktopNotificationsFactory::PopupWidget;
#else
    notifyType = DesktopNotificationsFactory::PopupWidget;
#endif
    if (notifyType == DesktopNotificationsFactory::DesktopNative) {
        ui->useNativeSystemNotifications->setChecked(true);
    }
    else {
        ui->useOSDNotifications->setChecked(true);
    }

    connect(ui->useNativeSystemNotifications, SIGNAL(toggled(bool)), this, SLOT(setNotificationPreviewVisible(bool)));
    connect(ui->useOSDNotifications, SIGNAL(toggled(bool)), this, SLOT(setNotificationPreviewVisible(bool)));

    ui->doNotUseNotifications->setChecked(!settings.value("Enabled", true).toBool());
    m_notifPosition = settings.value("Position", QPoint(10, 10)).toPoint();
    settings.endGroup();

    //OTHER
    //Languages
    QString activeLanguage = "";
    if (!p_QupZilla->activeLanguage().isEmpty()) {
        activeLanguage = p_QupZilla->activeLanguage();
        QString loc = activeLanguage;
        loc.remove(".qm");
        QLocale locale(loc);
        QString country = QLocale::countryToString(locale.country());
        QString language = QLocale::languageToString(locale.language());
        ui->languages->addItem(language + ", " + country + " (" + loc + ")", activeLanguage);
    }
    ui->languages->addItem("English (en_US)");

    QDir lanDir(mApp->TRANSLATIONSDIR);
    QStringList list = lanDir.entryList(QStringList("*.qm"));
    foreach(const QString & name, list) {
        if (name.startsWith("qt_") || name == activeLanguage) {
            continue;
        }

        QString loc = name;
        loc.remove(".qm");
        QLocale locale(loc);
        QString country = QLocale::countryToString(locale.country());
        QString language = QLocale::languageToString(locale.language());
        ui->languages->addItem(language + ", " + country + " (" + loc + ")", name);
    }

    // Proxy Configuration
    settings.beginGroup("Web-Proxy");
    NetworkProxyFactory::ProxyPreference proxyPreference = NetworkProxyFactory::ProxyPreference(settings.value("UseProxy", NetworkProxyFactory::SystemProxy).toInt());
    QNetworkProxy::ProxyType proxyType = QNetworkProxy::ProxyType(settings.value("ProxyType", QNetworkProxy::HttpProxy).toInt());

    ui->systemProxy->setChecked(proxyPreference == NetworkProxyFactory::SystemProxy);
    ui->noProxy->setChecked(proxyPreference == NetworkProxyFactory::NoProxy);
    ui->manualProxy->setChecked(proxyPreference == NetworkProxyFactory::DefinedProxy);
    if (proxyType == QNetworkProxy::HttpProxy) {
        ui->proxyType->setCurrentIndex(0);
    }
    else {
        ui->proxyType->setCurrentIndex(1);
    }

    ui->proxyServer->setText(settings.value("HostName", "").toString());
    ui->proxyPort->setText(settings.value("Port", 8080).toString());
    ui->proxyUsername->setText(settings.value("Username", "").toString());
    ui->proxyPassword->setText(settings.value("Password", "").toString());

    ui->useHttpsProxy->setChecked(settings.value("UseDifferentProxyForHttps", false).toBool());
    ui->httpsProxyServer->setText(settings.value("HttpsHostName", "").toString());
    ui->httpsProxyPort->setText(settings.value("HttpsPort", 8080).toString());
    ui->httpsProxyUsername->setText(settings.value("HttpsUsername", "").toString());
    ui->httpsProxyPassword->setText(settings.value("HttpsPassword", "").toString());

    ui->proxyExceptions->setText(settings.value("ProxyExceptions", QStringList() << "localhost" << "127.0.0.1").toStringList().join(","));
    settings.endGroup();

    useDifferentProxyForHttpsChanged(ui->useHttpsProxy->isChecked());
    setManualProxyConfigurationEnabled(proxyPreference == NetworkProxyFactory::DefinedProxy);

    connect(ui->manualProxy, SIGNAL(toggled(bool)), this, SLOT(setManualProxyConfigurationEnabled(bool)));
    connect(ui->useHttpsProxy, SIGNAL(toggled(bool)), this, SLOT(useDifferentProxyForHttpsChanged(bool)));

    //CONNECTS
    connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
    connect(ui->cookieManagerBut, SIGNAL(clicked()), this, SLOT(showCookieManager()));
    connect(ui->sslManagerButton, SIGNAL(clicked()), this, SLOT(openSslManager()));
    connect(ui->preferredLanguages, SIGNAL(clicked()), this, SLOT(showAcceptLanguage()));
    connect(ui->deleteHtml5storage, SIGNAL(clicked()), this, SLOT(deleteHtml5storage()));

    connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*)));
    ui->listWidget->setItemSelected(ui->listWidget->itemAt(5, 5), true);

    ui->version->setText(" QupZilla v" + QupZilla::VERSION);
    showStackedPage(ui->listWidget->item(0));
}
Example #20
0
void SettingsDialog::on_saveSettingsButton_clicked()
{

    Settings s;
    if (ui->nameLine->text().isEmpty() || ui->txtIPAddress->text().isEmpty() || ui->txtPort->text().isEmpty() )
    {
        QMessageBox::warning(this, tr("Remote OM"), tr("Please enter all required settings"));
        return;
    }

    //Adding new entry
    if (ui->newentrySettingsButton->isHidden() && !ui->nameLine->text().isEmpty())
    {
        //Check name if exists
        for (int i = 0; i < items.count(); i++ )
        {
            int t = QString::compare(items.keys().at(i), ui->nameLine->text(), Qt::CaseInsensitive);
            if (t == 0)
            {
                QMessageBox::warning(this, tr("Remote OM"), tr("Setting with same name already exists"));
                return;
            }
        }
    }

    bool found = false;
    if (!items.isEmpty())
    {
        for (int i = 0; i < items.count(); i++ )
        {
            int t = QString::compare(items.keys().at(i), ui->nameLine->text(), Qt::CaseInsensitive);
            if (t == 0)
            {
                found = true;
                break;
            }
        }
    }

    if (found)
    {
        //Update existing item
        items[ui->nameLine->text()] = ui->txtIPAddress->text()+";"+ui->txtPort->text()+";"+ui->txtPassword->text();
    }
    else
    {
        //Add new item
        items.insert(ui->nameLine->text(), ui->txtIPAddress->text()+";"+ui->txtPort->text()+";"+ui->txtPassword->text());
    }


    if (!s.saveXmlFile(items))
    {
        QMessageBox::warning(this, tr("Remote OM"), tr("Saving settings failed."));
        return;
    }

    /*if (!s.saveXmlFile(ui->nameLine->text(), ui->txtIPAddress->text(), ui->txtPort->text(), ui->txtPassword->text()))
    {
        QMessageBox::warning(this, tr("Remote OM"), tr("Saving settings failed."));
        return;
    }*/

    QMessageBox::information(this, tr("Remote OM"), tr("Settings saved."));

    if (ui->comboSettings->currentIndex() == -1)
    {
        connect(ui->comboSettings, SIGNAL(currentIndexChanged(QString)), this, SLOT(activeComboBox(QString)));
    }

    if (found == false)
    {
        ui->comboSettings->clear();
        ui->comboSettings->addItems(items.keys());

        ui->newentrySettingsButton->show();
        ui->delete_entrySettingsButton->show();
        ui->backButton->hide();
    }

    ui->nameLine->hide();
    ui->labelName->hide();
    ui->comboSettings->show();
    ui->labelSettings->show();

    if (!s.readXmlFile(items))
    {
        return;
    }

    QStringList list = items[ui->comboSettings->currentText()].split(";");
    if (!list.isEmpty())
    {
        ui->txtIPAddress->setText(list[0]);
        ui->txtPort->setText(list[1]);
        ui->txtPassword->setText(list[2]);

        set_ipaddress = list[0];
        set_port = list[1];
        set_password = list[2];
    }


}
Example #21
0
}


void PppoeWidget::createFilter()
{
    // session mac
    ui->lineEdit_session->setInputMask(QString(">00000:hh:hh:hh:hh:hh:hh"));
    // mac
    ui->lineEdit_mac->setInputMask(QString(">hh:hh:hh:hh:hh:hh"));
}


void PppoeWidget::createActions()
{
    connect(ui->pushButton_pppoeAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
    connect(ui->comboBox_connection, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeMode(QString)));
    connect(ui->pushButton_options, SIGNAL(clicked(bool)), this, SLOT(selectOptionsFile()));
}


void PppoeWidget::changeMode(const QString currentText)
{
    ui->widget_timeout->setHidden(currentText == QString("persist"));
}


void PppoeWidget::selectOptionsFile()
{
    QString filename = QFileDialog::getOpenFileName(this,
                QApplication::translate("PppoeWidget", "Select options file"),
                QDir::currentPath(),
void MusicFunctionTableWidget::listCellClicked(int row, int column)
{
    Q_UNUSED(column);
    emit currentIndexChanged(row + m_listIndex);
}
Example #23
0
VCMatrix::VCMatrix(QWidget *parent, Doc *doc)
    : VCWidget(parent, doc)
    , m_matrixID(Function::invalidId())
    , m_instantApply(true)
{
    /* Set the class name "VCLabel" as the object name as well */
    setObjectName(VCMatrix::staticMetaObject.className());
    setFrameStyle(KVCFrameStyleSunken);

    QHBoxLayout *hBox = new QHBoxLayout(this);
    //hBox->setContentsMargins(3, 3, 3, 10);
    //hBox->setSpacing(5);

    m_slider = new ClickAndGoSlider();
    m_slider->setStyleSheet(CNG_DEFAULT_STYLE);
    m_slider->setFixedWidth(32);
    m_slider->setRange(0, 255);
    m_slider->setPageStep(1);
    m_slider->setInvertedAppearance(false);
    hBox->addWidget(m_slider);

    connect(m_slider, SIGNAL(valueChanged(int)),
            this, SLOT(slotSliderMoved(int)));

    QVBoxLayout *vbox = new QVBoxLayout(this);

    m_startColorButton = new QToolButton(this);
    m_startColorButton->setFixedSize(48, 48);
    m_startColorButton->setIconSize(QSize(42, 42));

    QWidgetAction* scAction = new QWidgetAction(this);
    m_scCnGWidget = new ClickAndGoWidget();
    m_scCnGWidget->setType(ClickAndGoWidget::RGB, NULL);
    scAction->setDefaultWidget(m_scCnGWidget);
    QMenu *startColorMenu = new QMenu();
    startColorMenu->addAction(scAction);
    m_startColorButton->setMenu(startColorMenu);
    m_startColorButton->setPopupMode(QToolButton::InstantPopup);

    connect(m_scCnGWidget, SIGNAL(colorChanged(QRgb)),
            this, SLOT(slotStartColorChanged(QRgb)));

    m_endColorButton = new QToolButton(this);
    m_endColorButton->setFixedSize(48, 48);
    m_endColorButton->setIconSize(QSize(42, 42));

    QWidgetAction* ecAction = new QWidgetAction(this);
    m_ecCnGWidget = new ClickAndGoWidget();
    m_ecCnGWidget->setType(ClickAndGoWidget::RGB, NULL);
    ecAction->setDefaultWidget(m_ecCnGWidget);
    QMenu *endColorMenu = new QMenu();
    endColorMenu->addAction(ecAction);
    m_endColorButton->setMenu(endColorMenu);
    m_endColorButton->setPopupMode(QToolButton::InstantPopup);

    connect(m_ecCnGWidget, SIGNAL(colorChanged(QRgb)),
            this, SLOT(slotEndColorChanged(QRgb)));

    m_label = new QLabel(this);
    m_label->setAlignment(Qt::AlignCenter);
    m_label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
    vbox->addWidget(m_label);

    QHBoxLayout *btnHbox = new QHBoxLayout(this);

    btnHbox->addWidget(m_startColorButton);
    btnHbox->addWidget(m_endColorButton);

    vbox->addLayout(btnHbox);

    m_presetCombo = new QComboBox(this);
    //m_presetCombo->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    m_presetCombo->addItems(doc->rgbScriptsCache()->names());
    connect(m_presetCombo, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(slotAnimationChanged(QString)));
    vbox->addWidget(m_presetCombo);

    hBox->addLayout(vbox);

    m_controlsLayout = new FlowLayout();
    vbox->addLayout(m_controlsLayout);

    setType(VCWidget::AnimationWidget);
    setCaption(QString());
    /* Initial size */
    QSettings settings;
    QVariant var = settings.value(SETTINGS_RGBMATRIX_SIZE);
    if (var.isValid() == true)
        resize(var.toSize());
    else
        resize(defaultSize);

    /* Update the slider according to current mode */
    slotModeChanged(m_doc->mode());
    setLiveEdit(m_liveEdit);
}
processByCyclesWidget::processByCyclesWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::processByCyclesWidget),
    fechaModel(new QSqlTableModel),
    phase19Model(new QSqlTableModel),
    phase37Model(new QSqlTableModel),
    phase96Model(new QSqlTableModel),
    nPhaseModel(new QSqlTableModel),
    monthlyModel(new QSqlTableModel),
    dailyModel(new QSqlTableModel),
    astralDailyModel(new QSqlTableModel)
{
    ui->setupUi(this);

    connect(ui->filterButton, SIGNAL(clicked()), this, SLOT(doCalc()));


    connect(ui->phase19ListView, SIGNAL(clicked(QModelIndex)), this, SLOT(phaseSelected(QModelIndex)));
    connect(ui->phase37ListView, SIGNAL(clicked(QModelIndex)), this, SLOT(phaseSelected(QModelIndex)));
    connect(ui->phase96ListView, SIGNAL(clicked(QModelIndex)), this, SLOT(phaseSelected(QModelIndex)));
    connect(ui->nMonthListView, SIGNAL(clicked(QModelIndex)), this, SLOT(phaseSelected(QModelIndex)));

    connect(ui->phase19ListView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(phaseMenu(QPoint)));
    connect(ui->phase37ListView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(phaseMenu(QPoint)));
    connect(ui->phase96ListView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(phaseMenu(QPoint)));
    connect(ui->nMonthListView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(phaseMenu(QPoint)));
    QStringList items;
    items << "Normal" << "Luna llena" << "Luna nueva" << "Equinoccios" << "Solsticios";
    ui->tipoFechaComboBox->addItems(items);

    fechaModel->setTable("estadotiempos");
    phase19Model->setTable("estadotiempos_diarios");
    phase19Model->setSort(0, Qt::AscendingOrder);
    phase37Model->setTable("estadotiempos_diarios");
    phase37Model->setSort(0, Qt::AscendingOrder);
    phase96Model->setTable("estadotiempos_diarios");
    phase96Model->setSort(0, Qt::AscendingOrder);
    nPhaseModel->setTable("estadotiempos_diarios");
    nPhaseModel->setSort(0, Qt::AscendingOrder);
    monthlyModel->setTable("estadotiempos_mensuales");
    dailyModel->setTable("estadotiempos_diarios");
    astralDailyModel->setTable("view_estadotiempos");

    ui->phase19ListView->setModel(phase19Model);
    //ui->phase19ListView->setModelColumn(1);
    ui->phase37ListView->setModel(phase37Model);
    //ui->phase37ListView->setModelColumn(1);
    ui->phase96ListView->setModel(phase96Model);
    //ui->phase96ListView->setModelColumn(1);
    ui->nMonthListView->setModel(nPhaseModel);

    ui->astrologycalDaysTableView->setModel(astralDailyModel);
    ui->daysTableView->setModel(dailyModel);
    ui->monthTableView->setModel(monthlyModel);

    phase19Model->select();
    phase37Model->select();
    phase96Model->select();
    nPhaseModel->select();

    ui->diaComboBox->setModel(fechaModel);
    ui->diaComboBox->setModelColumn(1);    
    typeChanged("Normal");

    setWindowTitle("Proceso por Ciclos Lunares");

    ui->astrologycalDaysTableView->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->daysTableView->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->monthTableView->setContextMenuPolicy(Qt::CustomContextMenu);

    ui->phase19ListView->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->phase37ListView->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->phase96ListView->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->nMonthListView->setContextMenuPolicy(Qt::CustomContextMenu);

    connect(ui->astrologycalDaysTableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(astralMenu(QPoint)));
    connect(ui->daysTableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(noaaMenu(QPoint)));
    connect(ui->monthTableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(monthMenu(QPoint)));
    connect(ui->tipoFechaComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(typeChanged(QString)));


}
Example #25
0
void ConfigStation::addbutton_clicked()
{
    QHBoxLayout *hlayout =new QHBoxLayout;
    QLineEdit *stale = new QLineEdit;
    QComboBox *chancb = new QComboBox;
    QComboBox *compcb = new QComboBox;
    QLineEdit *locle = new QLineEdit;
    locle->setEnabled(false);
    QLineEdit *netle = new QLineEdit;
    QLineEdit *latle = new QLineEdit;
    QLineEdit *lonle = new QLineEdit;
    QLineEdit *elevle = new QLineEdit;

    qlist.push_back(stale);

    sta.resize(qlist.count()); chan.resize(qlist.count()); comp.resize(qlist.count()); loc.resize(qlist.count()); net.resize(qlist.count());
    lat.resize(qlist.count()); lon.resize(qlist.count()); elev.resize(qlist.count());
    chan[qlist.count()-1] = "HG";
    comp[qlist.count()-1] = "Z";
    loc[qlist.count()-1] = "--";

    int i=0;
    stale->setObjectName("lineedit_" + QString::number(qlist.count()) + "_" + QString::number(i+1) ); i++;
    chancb->setObjectName("lineedit_" + QString::number(qlist.count()) + "_" + QString::number(i+1) ); i++;
    compcb->setObjectName("lineedit_" + QString::number(qlist.count()) + "_" + QString::number(i+1) ); i++;
    locle->setObjectName("lineedit_" + QString::number(qlist.count()) + "_" + QString::number(i+1) ); i++;
    netle->setObjectName("lineedit_" + QString::number(qlist.count()) + "_" + QString::number(i+1) ); i++;
    latle->setObjectName("lineedit_" + QString::number(qlist.count()) + "_" + QString::number(i+1) ); i++;
    lonle->setObjectName("lineedit_" + QString::number(qlist.count()) + "_" + QString::number(i+1) ); i++;
    elevle->setObjectName("lineedit_" + QString::number(qlist.count()) + "_" + QString::number(i+1) );

    stale->setAlignment(Qt::AlignCenter);
    locle->setAlignment(Qt::AlignCenter);
    netle->setAlignment(Qt::AlignCenter);
    latle->setAlignment(Qt::AlignCenter);
    lonle->setAlignment(Qt::AlignCenter);
    elevle->setAlignment(Qt::AlignCenter);

    locle->setText("--");
    QStringList chan;
    chan << "HG" << "BG" << "HH" << "BH" << "EL" << "SL";
    chancb->addItems(chan); chancb->setCurrentIndex(0);

    QStringList comp;
    comp << "Z" << "N" << "E" << "Z/N/E" << "N/E";
    compcb->addItems(comp); compcb->setCurrentIndex(0);

    hlayout->addWidget(stale);
    hlayout->addWidget(chancb);
    hlayout->addWidget(compcb);
    hlayout->addWidget(locle);
    hlayout->addWidget(netle);
    hlayout->addWidget(latle);
    hlayout->addWidget(lonle);
    hlayout->addWidget(elevle);

    chancb->setMaximumWidth(130);
    chancb->setMinimumWidth(130);
    compcb->setMaximumWidth(130);
    compcb->setMinimumWidth(130);

    middlelayout->addLayout(hlayout);

    connect(stale, SIGNAL(textChanged(QString)), SLOT(lineedit_textChanged(QString)));
    connect(chancb, SIGNAL(currentIndexChanged(QString)), SLOT(lineedit_textChanged(QString)));
    connect(compcb, SIGNAL(currentIndexChanged(QString)), SLOT(lineedit_textChanged(QString)));
    connect(locle, SIGNAL(textChanged(QString)), SLOT(lineedit_textChanged(QString)));
    connect(netle, SIGNAL(textChanged(QString)), SLOT(lineedit_textChanged(QString)));
    connect(latle, SIGNAL(textChanged(QString)), SLOT(lineedit_textChanged(QString)));
    connect(lonle, SIGNAL(textChanged(QString)), SLOT(lineedit_textChanged(QString)));
    connect(elevle, SIGNAL(textChanged(QString)), SLOT(lineedit_textChanged(QString)));
}
void PropertiesManager::createImpulsePortProperties(ImpulsePortTextItem *ip)
{
    //move up down
    root->actionMove_Up->setEnabled(true);
    root->actionMove_Down->setEnabled(true);
    root->actionDeleteItems->setEnabled(true);

    QLabel *label = new QLabel("<b>Edit Impulse Port</b>");
    addRow(label);

    ImpulsePortMode m = ip->getPortMode();

    //if mode == send
    if (m == ImpulseSendPort){
        QComboBox *param = new QComboBox();
        for (int i=0; i< root->al->ParameterList.size(); i++)
        {
            param->addItem(root->al->ParameterList[i]->getName());
            if (ip->getParameter() != NULL){
                if (root->al->ParameterList[i]->getName().compare(ip->getParameter()->getName()) == 0)
                    param->setCurrentIndex(i);
            }
        }
        for (int i=0; i< root->al->StateVariableList.size(); i++)
        {
            param->addItem(root->al->StateVariableList[i]->getName());
            if (ip->getParameter() != NULL){
                if (root->al->StateVariableList[i]->getName().compare(ip->getParameter()->getName()) == 0)
                    param->setCurrentIndex(i);
            }
        }
        for (int i=0; i< root->al->AliasList.size(); i++)
        {
            param->addItem(root->al->AliasList[i]->getName());
            if (ip->getParameter() != NULL){
                if (root->al->AliasList[i]->getName().compare(ip->getParameter()->getName()) == 0)
                    param->setCurrentIndex(i);
            }
        }
        if (ip->getParameter() == NULL)
            param->setCurrentIndex(-1);
        connect(param, SIGNAL(currentIndexChanged(QString)), ip, SLOT(setParameter(QString)));
        addRow(tr("&Par/Var:"),param);
    }
    //otherwise m == Recv
    else
    {
        QLineEdit *name = new QLineEdit();
        name->installEventFilter(&eventFilterObject);
        name->setText(ip->getName());
        name->setValidator(validator);
        connect(name, SIGNAL(textEdited(QString)), ip, SLOT(setName(QString)));
        addRow(tr("&Name:"),name);
    }

    QComboBox *mode = new QComboBox();
    mode->addItem("Send");
    mode->addItem("Receive");
    switch(m){
    case(ImpulseSendPort):
        mode->setCurrentIndex(0);
        break;
    case(ImpulseRecvPort):
        mode->setCurrentIndex(1);
        break;
    }
    connect(mode, SIGNAL(currentIndexChanged(QString)), ip, SLOT(setPortMode(QString)));
    addRow(tr("Impulse &Mode"), mode);

    if (m == ImpulseRecvPort){
        QComboBox *dims_prefix = getPrefixCombo(ip->port->dims->getPrefix());
        connect(dims_prefix, SIGNAL(currentIndexChanged(QString)), ip, SLOT(setDimsPrefix(QString)));
        addRow(tr("Dimensionality &Prefix:"),dims_prefix);

        QComboBox *dims_unit = getUnitCombo(ip->port->dims->getUnit());
        connect(dims_unit, SIGNAL(currentIndexChanged(QString)), ip, SLOT(setDimsUnit(QString)));
        addRow(tr("Dimensionality &Unit:"),dims_unit);
    }

}
void PropertiesManager::createAnalogPortProperties(AnalogPortTextItem *ap)
{
    //move up down
    root->actionMove_Up->setEnabled(true);
    root->actionMove_Down->setEnabled(true);
    root->actionDeleteItems->setEnabled(true);

    QLabel *label = new QLabel("<b>Edit Analog Port</b>");
    addRow(label);

    //if mode == send
    if (ap->getPortMode() == AnalogSendPort){
        QComboBox *var = new QComboBox();
        for (int i=0; i< root->al->StateVariableList.size(); i++)
        {
            var->addItem(root->al->StateVariableList[i]->getName());
            if (ap->getVariable() != NULL){
                if (root->al->StateVariableList[i]->getName().compare(ap->getVariable()->getName()) == 0)
                    var->setCurrentIndex(i);
            }
        }
        for (int i=0; i< root->al->AliasList.size(); i++)
        {
            var->addItem(root->al->AliasList[i]->getName());
            if (ap->getVariable() != NULL){
                if (root->al->AliasList[i]->getName().compare(ap->getVariable()->getName()) == 0)
                    var->setCurrentIndex(i+root->al->StateVariableList.size());
            }
        }
        if (ap->getVariable() == NULL)
            var->setCurrentIndex(-1);
        connect(var, SIGNAL(currentIndexChanged(QString)), ap, SLOT(setVariable(QString)));
        addRow(tr("&Variable:"),var);
    }
    //otherwise
    else
    {

        QLineEdit *name = new QLineEdit();
        name->installEventFilter(&eventFilterObject);
        name->setText(ap->getName());
        name->setValidator(validator);
        connect(name, SIGNAL(textEdited(QString)), ap, SLOT(setName(QString)));
        addRow(tr("&Name:"),name);
    }

    QComboBox *mode = new QComboBox();
    mode->addItem("Send");
    mode->addItem("Receive");
    mode->addItem("Reduce");
    AnalogPortMode m = ap->getPortMode();
    switch(m){
    case(AnalogSendPort):
        mode->setCurrentIndex(0);
        break;
    case(AnalogRecvPort):
        mode->setCurrentIndex(1);
        break;
    case(AnalogReducePort):
        mode->setCurrentIndex(2);
        break;
    }
    connect(mode, SIGNAL(currentIndexChanged(QString)), ap, SLOT(setPortMode(QString)));
    addRow(tr("Analog &Mode"), mode);

    if(m == AnalogReducePort){
        QComboBox *reduce = new QComboBox();
        reduce->addItem("None");
        reduce->addItem("Addition");
        ReduceOperation r = ap->getPortReduceOp();
        switch(r){
        case(ReduceOperationNone):
            reduce->setCurrentIndex(0);
            break;
        case(ReduceOperationAddition):
            reduce->setCurrentIndex(1);
            break;
        }
        connect(reduce, SIGNAL(currentIndexChanged(QString)), ap, SLOT(setPortReduceOp(QString)));
        addRow(tr("&Reduce Operation:"), reduce);
    }

    if ((m == AnalogRecvPort)||(m == AnalogReducePort)){
        QComboBox *dims_prefix = getPrefixCombo(ap->port->dims->getPrefix());
        connect(dims_prefix, SIGNAL(currentIndexChanged(QString)), ap, SLOT(setDimsPrefix(QString)));
        addRow(tr("Dimensionality &Prefix:"),dims_prefix);

        QComboBox *dims_unit = getUnitCombo(ap->port->dims->getUnit());
        connect(dims_unit, SIGNAL(currentIndexChanged(QString)), ap, SLOT(setDimsUnit(QString)));
        addRow(tr("Dimensionality &Unit:"),dims_unit);
    }
}
void PropertiesManager::createTimeDerivativeProperties(TimeDerivativeTextItem *td)
{
    //move up down
    root->actionMove_Up->setEnabled(true);
    root->actionMove_Down->setEnabled(true);
    root->actionDeleteItems->setEnabled(true);

    QLabel *label = new QLabel("<b>Edit Time Derivative</b>");
    addRow(label);
    QComboBox *var = new QComboBox();
    for (int i=0; i< root->al->StateVariableList.size(); i++)
    {
        var->addItem(root->al->StateVariableList[i]->getName());
        if (td->getVariable() != NULL){
            if (root->al->StateVariableList[i]->getName().compare(td->getVariable()->getName()) == 0)
            {
                var->setCurrentIndex(i);
            }
        }
        else
            var->setCurrentIndex(-1);
    }
    connect(var, SIGNAL(currentIndexChanged(QString)), td, SLOT(setVariable(QString)));
    addRow(tr("&Variable:"),var);

    QLineEdit *maths = new QLineEdit();
    maths->installEventFilter(&eventFilterObject);
    maths->setText(td->getMaths()->equation);
    connect(maths, SIGNAL(textEdited(QString)), td, SLOT(setMaths(QString)));
    addRow(tr("&Maths:"),maths);
    addWidget(new QLabel(tr("<i>in physiological units</i>")));

    QStringList errs;
    td->time_derivative->maths->validateMathInLine(root->al.data(), &errs);

    // sort out errors
    QSettings settings;
    int num_errs = settings.beginReadArray("warnings");
    settings.endArray();

    if (num_errs != 0) {

        // show errors by changing lineedit colour
        QPalette p = maths->palette();
        p.setColor( QPalette::Normal, QPalette::Base, QColor(255, 200, 200) );
        maths->setPalette(p);

        // clear errors
        settings.remove("warnings");

    }
    if (num_errs == 0) {

        // show no errors by changing lineedit colour
        QPalette p = maths->palette();
        p.setColor( QPalette::Normal, QPalette::Base, QColor(255, 255, 255) );
        maths->setPalette(p);

        // clear errors
        settings.remove("warnings");
    }
}
void PropertiesManager::createEmptySelectionProperties()
{
    root->addItemsToolbar->addAction(root->actionAddRegime);
    root->actionMove_Up->setEnabled(false);
    root->actionMove_Down->setEnabled(false);
    root->actionDeleteItems->setEnabled(false);

    //component name
    QLabel *label = new QLabel("<b>Component Class</b>");
    addRow(label);
    QLineEdit *edit_name = new QLineEdit();
    edit_name->installEventFilter(&eventFilterObject);
    edit_name->setValidator(componentNameValidator);
    edit_name->setText(root->al->name);
    connect(edit_name, SIGNAL(textEdited(QString)), root, SLOT(setComponentClassName(QString)));
    addRow(tr("&Name:"),edit_name);

    //component type
    QComboBox *type = new QComboBox();
    type->addItem("neuron_body");
    type->addItem("weight_update");
    type->addItem("postsynapse");
    //type->addItem("generic_component");
    int typeVal;
    if (root->al->type == "neuron_body")
        typeVal = 0;
    if (root->al->type == "weight_update")
        typeVal = 1;
    if (root->al->type == "postsynapse")
        typeVal = 2;
    if (root->al->type == "generic_component")
        typeVal = 3;
    type->setCurrentIndex(typeVal);
    connect(type, SIGNAL(currentIndexChanged(QString)), root, SLOT(setComponentClassType(QString)));
    addRow(tr("&Component Type:"),type);

    //initial regime
    QComboBox *initial_regime = new QComboBox();
    bool match_init_r = false;
    for (int i=0; i<root->al->RegimeList.size(); i++){
        initial_regime->addItem(root->al->RegimeList[i]->name);
        if (root->al->initial_regime == root->al->RegimeList[i]){
            initial_regime->setCurrentIndex(i);
            match_init_r = true;
        }
    }
    if (!match_init_r){
        initial_regime->setCurrentIndex(-1);
    }
    connect(initial_regime, SIGNAL(currentIndexChanged(QString)), root, SLOT(setInitialRegime(QString)));
    addRow(tr("&Initial Regime:"),initial_regime);

    // add path combobox - NO LONGER USED
    /*QComboBox * path = new QComboBox;
    path->addItem("model");
    path->addItem("temp");
    path->addItem("lib");

    path->setToolTip("Store the component externally as a file (temp) or internally in the library (lib)");

    // select current path - NO LONGER USED
    if (root->al->path == "")
        root->al->path = "temp";
    if (root->al->path == "model")
        path->setCurrentIndex(0);
    else if (root->al->path == "temp")
        path->setCurrentIndex(1);
    else if (root->al->path == "lib")
        path->setCurrentIndex(2);

    // disable model path
    QModelIndex ind = path->model()->index(0,0);
    path->model()->setData(ind, QVariant(0), Qt::UserRole-1);
    addRow(tr("Path"), path);
    connect(path, SIGNAL(currentIndexChanged(QString)), root, SLOT(setPath(QString)));*/

    QPushButton * duplicate = new QPushButton("Duplicate component");
    connect(duplicate, SIGNAL(clicked()), root->main, SLOT(duplicate_component()));
    addWidget(duplicate);


    QPushButton * remove = new QPushButton("Remove component");
    connect(remove, SIGNAL(clicked()), root, SLOT(deleteComponent()));
    addWidget(remove);

}
Example #30
0
void Cconfig::setup_gui()
{
    this->this_Widget = new QWidget;

    //dialog
    this->gui_checkForUpdateNowButton = new QPushButton( QIcon( ":/resources/img/refresh.png" ), tr( "Check for an Update" ) );
    QObject::connect( this->gui_checkForUpdateNowButton, SIGNAL(clicked()),
                      this, SLOT(showUpdateDialog()) );
#ifdef Q_WS_WIN
    this->gui_checkForUpdateNowButton->setEnabled( false );
#endif


    this->gui_styleComboBox = new QComboBox( this );
    this->gui_styleComboBox->addItem( QIcon( ":/resources/img/gui_style_elegant.png" ), tr( "White" ) );
    this->gui_styleComboBox->addItem( QIcon( ":/resources/img/gui_style_simple.png" ), tr( "Normal" ) );
    this->gui_styleComboBox->addItem( QIcon( ":/resources/img/gui_style_haxor.png" ), tr( "Matrix" ) );
    this->gui_styleComboBox->addItem( QIcon( ":/resources/img/gui_style_pink.png" ), tr( "Pink" ) );
    this->gui_styleComboBox->addItem( QIcon( ":/resources/img/gui_style_inverted.png" ), tr( "Inverted" ) );
    this->gui_styleComboBox->setCurrentIndex( this->config_file_system->guiStyle );
    this->gui_styleMainMenuBtnz_ComboBox = new QComboBox( this );
    this->gui_styleMainMenuBtnz_ComboBox->addItem( QIcon( ":/resources/img/naked_button.png" ), tr( "Normal" ) );
    this->gui_styleMainMenuBtnz_ComboBox->addItem( QIcon( ":/resources/img/wood_label.png" ), tr( "Wooden" ) );
    this->gui_styleMainMenuBtnz_ComboBox->addItem( QIcon( ":/resources/img/menu_fruity_bg.png" ), tr( "Fruity" ) );
    this->gui_styleMainMenuBtnz_ComboBox->setCurrentIndex( this->config_file_system->guiStyle );
    QObject::connect( this->gui_styleMainMenuBtnz_ComboBox, SIGNAL(currentIndexChanged(int)),
                      this, SLOT(allTheGuiTweaks()) );
    this->gui_style_show_textCheckBox = new QCheckBox( this );
    this->gui_style_show_textCheckBox->setText( "Show text on the buttons" );
    this->gui_style_show_textCheckBox->setChecked( false );
    QObject::connect( this->gui_style_show_textCheckBox, SIGNAL(clicked()), this, SLOT(allTheGuiTweaks()) );
    this->gui_style_show_iconsCheckBox = new QCheckBox( this );
    this->gui_style_show_iconsCheckBox->setText( "Show icons on the buttons" );
    this->gui_style_show_iconsCheckBox->setChecked( false );
    QObject::connect( this->gui_style_show_iconsCheckBox, SIGNAL(clicked()), this, SLOT(allTheGuiTweaks()) );

    //*** setting up the gui to avoid trouble like getting language without a btn to store
    //'em into and so on
    this->setWindowIcon( QIcon( ":/resources/img/tool.png" ));
    this->setWindowTitle( tr( "GNU RPG Maker's Preferences" ) );
    this->setModal( true );

    this->gui_typeComboBox = new QComboBox(this);
    this->gui_typeComboBox->addItem(QIcon(":/resources/img/form_desktop.png"),tr("Desktop or Laptop"));
    this->gui_typeComboBox->addItem(QIcon(":/resources/img/form_netbook.png"),tr("Netbook"));
    QObject::connect( this->gui_typeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(allTheGuiTweaks()) );
//    this->gui_typeComboBox->addItem(QIcon(":/resources/img/form_tablet.png"),tr("Touch- and Tablet-Laptops"));
//    this->gui_typeComboBox->addItem(QIcon(":/resources/img/config_accessibility.png"),tr("Accessibility Support"));
    this->gui_typeComboBox->setCurrentIndex( this->config_file_system->guiType );

    this->gui_update_enable_updates_btn = new QCheckBox( "", this->this_Widget );
    QObject::connect( this->gui_update_enable_updates_btn, SIGNAL(clicked()), this, SLOT(allTheGuiTweaks()) );
    //this->gui_updateCycle_daily_radioButton = new QRadioButton( tr( "Check Daily" ), this->this_Widget );
    //this->gui_updateCycle_weekly_radioButton = new QRadioButton( tr( "Check Weekly" ), this->this_Widget );
    //this->gui_updateCycle_monthly_radioButton = new QRadioButton( tr( "Check Monthly" ), this->this_Widget );
    this->gui_updateCycle_currentVersion_line = new QLineEdit( this );
    this->gui_updateCycle_currentVersion_line->setText( QString( "%1" ).arg( (quint32) DEF_CURRENT_VERSION ) );
    this->gui_updateCycle_currentVersion_line->setEnabled( false );
    this->gui_updateCycle_lastUpdatedate_line = new QLineEdit( this );
    this->gui_updateCycle_lastUpdatedate_line->setText( this->config_file_system->updateLastUpdateDate.toString() );
    this->gui_updateCycle_lastUpdatedate_line->setEnabled( false );

    //this->gui_updateCycle_enable_updates_btn->setVisible( false );
    //this->gui_updateCycle_daily_radioButton->setVisible( false );
    //this->gui_updateCycle_weekly_radioButton->setVisible( false );
    //this->gui_updateCycle_monthly_radioButton->setVisible( false );
    //this->gui_updateCycle_lastUpdatedate_line->setVisible( false);
    //also uncomment the addRow ( .. ) commands


    this->gui_lastProjectFilePathLineEdit = new QLineEdit( this->config_file_system->lastProjectFilePath ,this);

    this->gui_showTutorialsCheckBox = new QCheckBox( this );
    QObject::connect( this->gui_showTutorialsCheckBox, SIGNAL(clicked()), this, SLOT(allTheGuiTweaks()) );
    this->gui_showTutorials_tileset_info_CheckBox  = new QCheckBox( tr( "Show infos about tilesets" ), this );
    this->gui_showTutorials_preject_preferences_scripting_CheckBox = new QCheckBox( tr( "Show infos about project preferences-scripting" ), this );

    this->gui_languageComboBox = new QComboBox(this);
    //get languages from ./languages
    QDir lang( "/usr/share/gnurpgm/languages" );
    if ( lang.exists() )
    {
        //TODO
        //get all files here
        this->availableLanguageFiles = lang.entryList(QDir::Files , QDir::Name);
        //just *pwned myself
    }
    else
    {
        QMessageBox::warning( this, tr( "No languages"), tr( "The folder /usr/share/gnurpgm/languages does not exist.\nIf you want to use gnurpgm in another language you'll have to copy some language files in there." ) );
    }
    //add std[eng]::language and the found filez
    // "English (Default)" would be creepy enough for a filename - so I'm  sure noone will try to name his language files
    // this way - and the main window omits the language change and falls back to this default written english. Bingo biatch!
    this->gui_languageComboBox->addItem( QIcon( ":/resources/img/config_language.png" ), tr( "English (Default)" ) );
    this->gui_languageComboBox->addItems( this->availableLanguageFiles );
    QObject::connect( this->gui_languageComboBox, SIGNAL(currentIndexChanged(QString)),
                      this, SLOT(show_language_change_warning()) );

    this->gui_oxygenTrayIconCheckBox = new QCheckBox( "" );
    QObject::connect( this->gui_oxygenTrayIconCheckBox, SIGNAL(clicked()), this, SLOT(allTheGuiTweaks()) );


    this->gui_depugCheckBox = new QCheckBox( this );
    this->gui_depugCheckBox->setIcon( QIcon( ":/icons/icons/tools-report-bug.png"));

    this->gui_okButton = new QPushButton(QIcon(":/resources/img/ok.png"),tr("Save & Apply"),this);
    this->gui_cancelButton = new QPushButton(QIcon(":/resources/img/exit.png"),tr("Cancel"),this);
    this->gui_okCancelButtonsLayout = new QHBoxLayout();
    this->gui_okCancelButtonsLayout->addStretch();
    this->gui_okCancelButtonsLayout->addWidget(this->gui_okButton);
    this->gui_okCancelButtonsLayout->addWidget(this->gui_cancelButton);

    this->mainLayout = new QFormLayout();
    this->mainLayout->addRow( new funny_head_widget( ":/resources/img/config_gui_style.png", tr( "Style" ) , this ) );
    this->mainLayout->addRow(tr("Choose your prefered GUI style"),this->gui_styleComboBox);
    this->mainLayout->addRow(tr("Choose your prefered MainMenu\nButton style"),this->gui_styleMainMenuBtnz_ComboBox);
    this->mainLayout->addRow( "",this->gui_style_show_textCheckBox);
    this->mainLayout->addRow( "",this->gui_style_show_iconsCheckBox);
    this->mainLayout->addRow( "", this->gui_depugCheckBox);

    this->mainLayout->addRow( new funny_head_widget( ":/resources/img/config_gui_inputs.png", tr( "Workspace" ) , this ) );
    this->mainLayout->addRow(tr("Choose your input/desktop type"),this->gui_typeComboBox);
    this->mainLayout->addRow( "", this->gui_depugCheckBox);

    this->mainLayout->addRow( new funny_head_widget( ":/resources/img/document-revert.png", tr( "Last used Project" ) , this ) );
    this->mainLayout->addRow(tr("Path to the last used Project File"),this->gui_lastProjectFilePathLineEdit);
    this->mainLayout->addRow( "", this->gui_depugCheckBox);

    this->mainLayout->addRow( new funny_head_widget( ":/resources/img/tools-wizard.png", tr( "Tutorials" ) , this ) );
    this->mainLayout->addRow( tr( "Show Tutorials and Hints" ),this->gui_showTutorialsCheckBox);
    this->mainLayout->addRow( tr( "" ),this->gui_showTutorials_tileset_info_CheckBox);
    this->mainLayout->addRow( tr( "" ),this->gui_showTutorials_preject_preferences_scripting_CheckBox);
    this->mainLayout->addRow( "", this->gui_depugCheckBox);

    this->mainLayout->addRow( new funny_head_widget( ":/resources/img/config_language.png", tr( "Language" ) , this ) );
    this->mainLayout->addRow(tr("Choose a prefered language"),this->gui_languageComboBox);
    this->mainLayout->addRow( "", this->gui_depugCheckBox);

    this->mainLayout->addRow( new funny_head_widget( ":/resources/img/start-here-kde.png", tr( "KDE Integration" ) , this ) );
    this->mainLayout->addRow(tr( "Use Oxygen-Styled Tray Icon" ),this->gui_oxygenTrayIconCheckBox);
    this->mainLayout->addRow( "", this->gui_depugCheckBox);

    this->mainLayout->addRow( new funny_head_widget( ":/resources/img/config_update.png", tr( "Updates" ) , this ) );
    this->mainLayout->addRow(tr("Enable Automatic Updates"),this->gui_update_enable_updates_btn);
//    this->mainLayout->addRow( "", this->gui_updateCycle_daily_radioButton );
//    this->mainLayout->addRow( "", this->gui_updateCycle_weekly_radioButton );
//    this->mainLayout->addRow( "", this->gui_updateCycle_monthly_radioButton );
    this->mainLayout->addRow( "", this->gui_checkForUpdateNowButton );
    this->mainLayout->addRow( "Current Version", this->gui_updateCycle_currentVersion_line);
    this->mainLayout->addRow( "Last Update", this->gui_updateCycle_lastUpdatedate_line);
    this->mainLayout->addRow( "", this->gui_depugCheckBox);

    this->mainLayout->addRow( "", this->gui_depugCheckBox);
    this->mainLayout->addRow( tr( "Use Debug Mode" ), this->gui_depugCheckBox);

    //the main widgetz disaster
    QVBoxLayout *layz = new QVBoxLayout();
    this->this_scrollArea = new QScrollArea( this );
    layz->addWidget( this->this_scrollArea );
    layz->addLayout( this->gui_okCancelButtonsLayout );
    this->setLayout( layz );

    this->this_Widget->setLayout( this->mainLayout );
    this->this_Widget->setMinimumHeight( this->this_Widget->height() );
    this->this_scrollArea->setWidget( this->this_Widget );
    this->this_scrollArea->setAlignment( Qt::AlignCenter );

    QObject::connect(this->gui_okButton,                    SIGNAL(clicked()),
                     this,                              SLOT(accept()));
    QObject::connect(this->gui_cancelButton,                 SIGNAL(clicked()),
                     this,                              SLOT(deny()));

    this->resize( this->this_Widget->size().width() + 80, 400 );
    this->allTheGuiTweaks();
}