Ejemplo n.º 1
0
SecurityLabel::SecurityLabel(
        QWidget *parent, QString _xmlDesc) :
    _QWidget(parent), xmlDesc(_xmlDesc)
{
    setObjectName("Security-High");

    modelLabel = new QLabel("Model:", this);
    model = new QComboBox(this);
    model->addItems(QStringList()<<"SELinux"<<"AppArmor"<<"DAC");
    labelTypeLabel = new QComboBox(this);
    labelTypeLabel->addItems(QStringList()<<"Label"<<"BaseLabel"<<"ImageLabel");
    label = new QLineEdit(this);
    relabelLabel = new QLabel("Relabel:", this);
    relabel = new QComboBox(this);
    relabel->addItems(QStringList()<<"Default"<<"Yes"<<"No");
    baseLayout = new QGridLayout();
    baseLayout->addWidget(modelLabel, 0, 0);
    baseLayout->addWidget(model, 0, 1);
    baseLayout->addWidget(labelTypeLabel, 1, 0);
    baseLayout->addWidget(label, 1, 1);
    baseLayout->addWidget(relabelLabel, 2, 0);
    baseLayout->addWidget(relabel, 2, 1);
    baseWdg = new QWidget(this);
    baseWdg->setLayout(baseLayout);
    baseWdg->setVisible(false);

    useSecLabel = new QCheckBox("Use Security Label", this);
    typeLabel = new QLabel("Type:", this);
    type = new QComboBox(this);
    type->addItems(QStringList()<<"None"<<"Dynamic"<<"Static");
    typeLayout = new QHBoxLayout(this);
    typeLayout->addWidget(typeLabel);
    typeLayout->addWidget(type);
    typeWdg = new QWidget(this);
    typeWdg->setLayout(typeLayout);

    add = new QPushButton(QIcon::fromTheme("list-add"), "", this);
    del = new QPushButton(QIcon::fromTheme("list-remove"), "", this);
    list = new QListWidget(this);
    listLayout = new QGridLayout();
    listLayout->addWidget(add, 0, 0);
    listLayout->addWidget(del, 0, 3);
    listLayout->addWidget(list, 1, 0, 2, 4);
    listWdg = new QWidget(this);
    listWdg->setLayout(listLayout);

    restorePanel = new RestorePanel(this);
    commonLayout = new QVBoxLayout(this);
    commonLayout->addWidget(restorePanel, 0, Qt::AlignRight);
    commonLayout->addWidget(useSecLabel);
    commonLayout->addWidget(typeWdg);
    commonLayout->addWidget(baseWdg);
    commonLayout->addWidget(listWdg);
    commonLayout->addStretch(-1);
    setLayout(commonLayout);
    usedStateChanged(false);
    connect(useSecLabel, SIGNAL(toggled(bool)),
            this, SLOT(usedStateChanged(bool)));
    connect(type, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(securityTypeChanged(QString)));
    connect(model, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(modelTypeChanged(QString)));
    connect(add, SIGNAL(clicked()),
            this, SLOT(addSecLabel()));
    connect(del, SIGNAL(clicked()),
            this, SLOT(delSecLabel()));
    readXMLDesciption();
    // dataChanged connections
    connect(model, SIGNAL(currentIndexChanged(int)),
            this, SLOT(stateChanged()));
    connect(label, SIGNAL(textEdited(QString)),
            this, SLOT(stateChanged()));
    connect(labelTypeLabel, SIGNAL(currentIndexChanged(int)),
            this, SLOT(stateChanged()));
    connect(relabel, SIGNAL(currentIndexChanged(int)),
            this, SLOT(stateChanged()));
    connect(type, SIGNAL(currentIndexChanged(int)),
            this, SLOT(stateChanged()));
    connect(useSecLabel, SIGNAL(toggled(bool)),
            this, SLOT(stateChanged()));
    connect(this, SIGNAL(dataChanged()),
            restorePanel, SLOT(stateChanged()));
    // action connections
    connect(restorePanel, SIGNAL(resetData()),
            this, SLOT(resetSecData()));
    connect(restorePanel, SIGNAL(revertData()),
            this, SLOT(revertSecData()));
    connect(restorePanel, SIGNAL(saveData()),
            this, SLOT(saveSecData()));
}
 static QStringList themeNames()
 {
     return QStringList() << QLatin1String("generic_eglfs");
 }
Ejemplo n.º 3
0
  return children;
}

QString QgsGdalLayerItem::layerName() const
{
  QFileInfo info( name() );
  if ( info.suffix() == "gz" )
    return info.baseName();
  else
    return info.completeBaseName();
}

// ---------------------------------------------------------------------------

static QString filterString;
static QStringList extensions = QStringList();
static QStringList wildcards = QStringList();

QGISEXTERN int dataCapabilities()
{
  return QgsDataProvider::File | QgsDataProvider::Dir | QgsDataProvider::Net;
}

QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
{
  if ( thePath.isEmpty() )
    return 0;

  QgsDebugMsgLevel( "thePath = " + thePath, 2 );

  // zip settings + info
Ejemplo n.º 4
0
DeformPaintOpPlugin::DeformPaintOpPlugin(QObject *parent, const QVariantList &)
    : QObject(parent)
{
    KisPaintOpRegistry *r = KisPaintOpRegistry::instance();
    r->add(new KisSimplePaintOpFactory<KisDeformPaintOp, KisDeformPaintOpSettings, KisDeformPaintOpSettingsWidget>("deformbrush", i18n("Deform"), KisPaintOpFactory::categoryStable(), "krita-deform.png", QString(), QStringList(COMPOSITE_COPY), 16));
}
QgsRasterFormatSaveOptionsWidget::QgsRasterFormatSaveOptionsWidget( QWidget* parent, QString format,
    QgsRasterFormatSaveOptionsWidget::Type type, QString provider )
    : QWidget( parent ), mFormat( format ), mProvider( provider ), mRasterLayer( 0 ),
    mRasterFileName( QString() ), mPyramids( false ),
    mPyramidsFormat( QgsRaster::PyramidsGTiff )

{
  setupUi( this );

  setType( type );

  if ( mBuiltinProfiles.isEmpty() )
  {
    // key=profileKey values=format,profileName,options
    mBuiltinProfiles[ "z_adefault" ] = ( QStringList() << "" << tr( "Default" ) << "" );

    // these GTiff profiles are based on Tim's benchmarks at
    // http://linfiniti.com/2011/05/gdal-efficiency-of-various-compression-algorithms/
    // big: no compression | medium: reasonable size/speed tradeoff | small: smallest size
    mBuiltinProfiles[ "z_gtiff_1big" ] =
      ( QStringList() << "GTiff" << tr( "No compression" )
        << "COMPRESS=NONE BIGTIFF=IF_NEEDED" );
    mBuiltinProfiles[ "z_gtiff_2medium" ] =
      ( QStringList() << "GTiff" << tr( "Low compression" )
        << "COMPRESS=PACKBITS" );
    mBuiltinProfiles[ "z_gtiff_3small" ] =
      ( QStringList() << "GTiff" << tr( "High compression" )
        << "COMPRESS=DEFLATE PREDICTOR=2 ZLEVEL=9" );
    mBuiltinProfiles[ "z_gtiff_4jpeg" ] =
      ( QStringList() << "GTiff" << tr( "JPEG compression" )
        << "COMPRESS=JPEG JPEG_QUALITY=75" );

    // overview compression schemes for GTiff format, see
    // http://www.gdal.org/gdaladdo.html and http://www.gdal.org/frmt_gtiff.html
    // TODO - should we offer GDAL_TIFF_OVR_BLOCKSIZE option here or in QgsRasterPyramidsOptionsWidget ?
    mBuiltinProfiles[ "z__pyramids_gtiff_1big" ] =
      ( QStringList() << "_pyramids" << tr( "No compression" )
        << "COMPRESS_OVERVIEW=NONE BIGTIFF_OVERVIEW=IF_NEEDED" );
    mBuiltinProfiles[ "z__pyramids_gtiff_2medium" ] =
      ( QStringList() << "_pyramids" << tr( "Low compression" )
        << "COMPRESS_OVERVIEW=PACKBITS" );
    mBuiltinProfiles[ "z__pyramids_gtiff_3small" ] =
      ( QStringList() << "_pyramids" << tr( "High compression" )
        << "COMPRESS_OVERVIEW=DEFLATE PREDICTOR_OVERVIEW=2 ZLEVEL=9" ); // how to set zlevel?
    mBuiltinProfiles[ "z__pyramids_gtiff_4jpeg" ] =
      ( QStringList() << "_pyramids" << tr( "JPEG compression" )
        << "JPEG_QUALITY_OVERVIEW=75 COMPRESS_OVERVIEW=JPEG PHOTOMETRIC_OVERVIEW=YCBCR INTERLEAVE_OVERVIEW=PIXEL" );
  }

  connect( mProfileComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
           this, SLOT( updateOptions() ) );
  connect( mOptionsTable, SIGNAL( cellChanged( int, int ) ), this, SLOT( optionsTableChanged() ) );
  connect( mOptionsHelpButton, SIGNAL( clicked() ), this, SLOT( helpOptions() ) );
  connect( mOptionsValidateButton, SIGNAL( clicked() ), this, SLOT( validateOptions() ) );

  // create eventFilter to map right click to swapOptionsUI()
  // mOptionsLabel->installEventFilter( this );
  mOptionsLineEdit->installEventFilter( this );
  mOptionsStackedWidget->installEventFilter( this );

  updateControls();
  updateProfiles();

  QgsDebugMsg( "done" );
}
Ejemplo n.º 6
0
void PosService::on_btSave_clicked()
{
    QMessageBox box;
    QString fileToCopy = "db.sqlite3";

    QProcess udisks;
    udisks.start("udisks", QStringList() << "--dump");
    if (!udisks.waitForFinished())
    {
        box.setText(_S("Ошибка получения списка дисков udisks --dump"));
        box.exec();
        return;
    }
    QString result = QString::fromUtf8(udisks.readAll());
    QStringList list = result.split(QRegularExpression("={72}"));

    QString interface;
    QString lastProperDevice;
    for(int i=0;i<list.count();++i)
    {
        QRegularExpressionMatch match;
        QString drv = list.at(i);

        if(drv.contains("drive:")){
            interface = "";
            match = QRegularExpression("(?<interface>interface:.*)").match(drv);
            if (!match.hasMatch())
                continue;

            interface = match.captured("interface").mid(10).replace(" ","");

            continue;
        }

        if(interface!="usb")
            continue;

        match = QRegularExpression("(?<device>is mounted:.*)").match(drv);
        if (!match.hasMatch())
            continue;

        QString isMounted = match.captured("device").mid(11).replace(" ","");
        if(isMounted=="1")
            continue;

        match = QRegularExpression("(?<device>device-file:.*)").match(drv);
        if (!match.hasMatch())
            continue;

        lastProperDevice = match.captured("device").mid(12).replace(" ","");

    }

    if(lastProperDevice.isEmpty())
    {
        box.setText(_S("Ошибка - нет подходящего устройства для сохранения"));
        box.exec();
        return;
    }

    udisks.start("udisks", QStringList() << "--mount"<<lastProperDevice<<"/media");
    if (!udisks.waitForFinished())
    {
        box.setText(_S("Ошибка подключения диска udisks --mount %1 /media").arg(lastProperDevice));
        box.exec();
        return;
    }

    QString mountresult = QString::fromUtf8(udisks.readAll());

    QRegularExpressionMatch match = QRegularExpression("(?<device>at .*)").match(mountresult);
    if (!match.hasMatch())
    {
        box.setText(_S("Не удалось обнаружить подключенное устройство\n").arg(mountresult));
        box.exec();
        return;
    }

    QString mountpath = match.captured("device").mid(3).replace(" ","");

    udisks.start("cp", QStringList()<<fileToCopy<<QStringLiteral("%1/db.sqlite").arg(mountpath));
    if (!udisks.waitForFinished())
    {
        box.setText(_S("Не удалось скопировать %1 в %2").arg(fileToCopy).arg(QStringLiteral("%1/db.sqlite").arg(mountpath)));
        box.exec();
        return;
    }

    udisks.start("udisks", QStringList() << "--unmount"<<lastProperDevice);
    if (!udisks.waitForFinished())
    {
        box.setText(_S("Не удалось отключить устройство"));
        box.exec();
        return;
    }

    box.setText(_S("База данных успешно сохранена"));
    box.exec();

    return;

}
Ejemplo n.º 7
0
std::shared_ptr<const OsmAnd::EmbeddedFontFinder> OsmAnd::EmbeddedFontFinder::getDefaultInstance()
{
    return s_embeddedFontFinderDefaultInstance;
}

void OsmAnd::EmbeddedFontFinder_initialize()
{
    s_embeddedFontFinderDefaultInstance.reset(new EmbeddedFontFinder());
}

void OsmAnd::EmbeddedFontFinder_release()
{
    s_embeddedFontFinderDefaultInstance.reset();
}

const QStringList OsmAnd::EmbeddedFontFinder::resources = QStringList()
    // OpenSans
    << QLatin1String("map/fonts/OpenSans/OpenSans-Regular.ttf")
    << QLatin1String("map/fonts/OpenSans/OpenSans-Italic.ttf")
    << QLatin1String("map/fonts/OpenSans/OpenSans-Semibold.ttf")
    << QLatin1String("map/fonts/OpenSans/OpenSans-SemiboldItalic.ttf")

    // Noto Kufi Arabic
    << QLatin1String("map/fonts/NotoKufi/NotoKufiArabic-Regular.ttf")
    << QLatin1String("map/fonts/NotoKufi/NotoKufiArabic-Bold.ttf")

    // Noto Naskh Arabic
    << QLatin1String("map/fonts/NotoNaskh/NotoNaskhArabic-Regular.ttf")
    << QLatin1String("map/fonts/NotoNaskh/NotoNaskhArabic-Bold.ttf")

    // NotoSans family, all fonts support regular and italic
Solver::Properties SecondOrderRungeKuttaSolverPlugin::solverProperties() const
{
    // Return the properties supported by the solver

    Descriptions stepDescriptions;

    stepDescriptions.insert("en", QString::fromUtf8("Step"));
    stepDescriptions.insert("fr", QString::fromUtf8("Pas"));

    return Solver::Properties() << Solver::Property(Solver::Property::Double, StepId, stepDescriptions, QStringList(), StepDefaultValue, true);
}
Ejemplo n.º 9
0
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include "sensorfwsensorbase.h"


SensorManagerInterface* SensorfwSensorBase::m_remoteSensorManager = 0;

//According to wikipedia link http://en.wikipedia.org/wiki/Standard_gravity
//const float sensorfwsensorbase::GRAVITY_EARTH = 9.812865328;
const float SensorfwSensorBase::GRAVITY_EARTH_THOUSANDTH = 0.009812865328;
const int SensorfwSensorBase::KErrNotFound=-1;
const int SensorfwSensorBase::KErrInUse=-14;
QStringList SensorfwSensorBase::m_bufferingSensors = QStringList()
        <<"sensorfw.accelerometer"<<"sensorfw.magnetometer"
       <<"sensorfw.gyroscope"<<"sensorfw.rotationsensor";

SensorfwSensorBase::SensorfwSensorBase(QSensor *sensor)
    : QSensorBackend(sensor), m_sensorInterface(0), m_bufferSize(-1), m_prevOutputRange(0), m_efficientBufferSize(1), m_maxBufferSize(1)
{
    if (!m_remoteSensorManager)
        m_remoteSensorManager = &SensorManagerInterface::instance();
}

SensorfwSensorBase::~SensorfwSensorBase()
{
    if (m_sensorInterface) {
        stop();
        delete m_sensorInterface, m_sensorInterface = 0;
Ejemplo n.º 10
0
RepositoryDialog::RepositoryDialog(KConfig& cfg, OrgKdeCervisia5CvsserviceCvsserviceInterface* cvsService,
                                   const QString& cvsServiceInterfaceName, QWidget* parent)
    : QDialog(parent)
    , m_partConfig(cfg)
    , m_cvsService(cvsService)
    , m_cvsServiceInterfaceName(cvsServiceInterfaceName)
{
    setWindowTitle(i18n("Configure Access to Repositories"));
    setModal(true);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(okButton, SIGNAL(clicked()), this, SLOT(slotOk()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QBoxLayout* hbox = new QHBoxLayout;
    hbox->setMargin(0);
    mainLayout->addLayout(hbox);

    m_repoList = new QTreeWidget;
    hbox->addWidget(m_repoList, 10);
    m_repoList->setMinimumWidth(fontMetrics().width('0') * 60);
    m_repoList->setAllColumnsShowFocus(true);
    m_repoList->setRootIsDecorated(false);
    m_repoList->setHeaderLabels(QStringList() << i18n("Repository") << i18n("Method")
                                              << i18n("Compression") << i18n("Status"));
    m_repoList->setFocus();

    connect(m_repoList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
            this, SLOT(slotDoubleClicked(QTreeWidgetItem*, int)));
    connect(m_repoList, SIGNAL(itemSelectionChanged()),
            this,       SLOT(slotSelectionChanged()));

    QDialogButtonBox* actionbox = new QDialogButtonBox(Qt::Vertical);
    QPushButton* addbutton = actionbox->addButton(i18n("Add..."), QDialogButtonBox::ActionRole);
    m_modifyButton = actionbox->addButton(i18n("Modify..."), QDialogButtonBox::ActionRole);
    m_removeButton = actionbox->addButton(i18n("Remove"), QDialogButtonBox::ActionRole);
    m_loginButton  = actionbox->addButton(i18n("Login..."), QDialogButtonBox::ActionRole);
    m_logoutButton = actionbox->addButton(i18n("Logout"), QDialogButtonBox::ActionRole);
    hbox->addWidget(actionbox, 0);

    m_loginButton->setEnabled(false);
    m_logoutButton->setEnabled(false);

    connect( addbutton, SIGNAL(clicked()),
             this, SLOT(slotAddClicked()) );
    connect( m_modifyButton, SIGNAL(clicked()),
             this, SLOT(slotModifyClicked()) );
    connect( m_removeButton, SIGNAL(clicked()),
             this, SLOT(slotRemoveClicked()) );
    connect( m_loginButton, SIGNAL(clicked()),
             this, SLOT(slotLoginClicked()) );
    connect( m_logoutButton, SIGNAL(clicked()),
             this, SLOT(slotLogoutClicked()) );

    // open cvs DBUS service configuration file
    m_serviceConfig = new KConfig("cvsservicerc");

    readCvsPassFile();
    readConfigFile();

    if (QTreeWidgetItem *item = m_repoList->topLevelItem(0))
    {
        m_repoList->setCurrentItem(item);
        item->setSelected(true);
    }
    else
    {
        // we have no item so disable modify and remove button
        slotSelectionChanged();
    }

    connect(buttonBox, &QDialogButtonBox::helpRequested, this, &RepositoryDialog::slotHelp);

    setAttribute(Qt::WA_DeleteOnClose, true);

    KConfigGroup cg(&m_partConfig, "RepositoryDialog");
    restoreGeometry(cg.readEntry<QByteArray>("geometry", QByteArray()));

    QByteArray state = cg.readEntry<QByteArray>("RepositoryListView", QByteArray());
    m_repoList->header()->restoreState(state);

    mainLayout->addWidget(buttonBox);
}
Ejemplo n.º 11
0
int main(int argc, char *argv[])
{
  timer.start();

  QString feature;

  if (!feature.isEmpty())
    feature = I18N_NOOP("Compiled with the following settings:\n") + feature;

  KAboutData aboutData("kmymoney", 0, ki18n("KMyMoney"),
                       VERSION, ki18n("\nKMyMoney, the Personal Finance Manager for KDE.\n\nPlease consider contributing to this project with code and/or suggestions."), KAboutData::License_GPL,
                       ki18n("(c) 2000-2014 The KMyMoney development team"), /*feature*/KLocalizedString(),
                       I18N_NOOP("http://kmymoney.org/")/*,
                                                      "*****@*****.**")*/);

  //Temporarily, the product name to report bugs in BKO is different than the application name
  aboutData.setProductName("kmymoney4");

  aboutData.addAuthor(ki18n("Michael Edwardes."), ki18n("Initial idea, much initial source code, Project admin"), "*****@*****.**");
  aboutData.addAuthor(ki18n("Thomas Baumgart"), ki18n("Core engine, Release Manager, Project admin"), "*****@*****.**");
  aboutData.addAuthor(ki18n("Ace Jones"), ki18n("Reporting logic, OFX Import"), "*****@*****.**");
  aboutData.addAuthor(ki18n("Tony Bloomfield"), ki18n("Database backend, maintainer stable branch"), "*****@*****.**");
  aboutData.addAuthor(ki18n("Alvaro Soliverez"), ki18n("Forecast, Reports"), "*****@*****.**");
  aboutData.addAuthor(ki18n("Felix Rodriguez"), ki18n("Project Admin"), "*****@*****.**");
  aboutData.addAuthor(ki18n("John C"), ki18n("Developer"), "*****@*****.**");
  aboutData.addAuthor(ki18n("Fernando Vilas"), ki18n("Database backend"), "*****@*****.**");
  aboutData.addAuthor(ki18n("Cristian Oneț"), ki18n("Developer"), "*****@*****.**");

  aboutData.addCredit(ki18n("Kevin Tambascio"), ki18n("Initial investment support"), "*****@*****.**");
  aboutData.addCredit(ki18n("Javier Campos Morales"), ki18n("Developer & Artist"), "*****@*****.**");
  aboutData.addCredit(ki18n("Robert Wadley"), ki18n("Icons & splash screen"), "*****@*****.**");
  aboutData.addCredit(ki18n("Laurent Montel"), ki18n("Patches and port to kde4"), "*****@*****.**");
  aboutData.addCredit(ki18n("Wolfgang Rohdewald"), ki18n("Patches"), "*****@*****.**");
  aboutData.addCredit(ki18n("Marko Käning"), ki18n("Patches and packaging for OS X"), "*****@*****.**");
  aboutData.setOrganizationDomain("kde.org");
  KCmdLineOptions options;
  options.add("lang <lang-code>", ki18n("language to be used"));
  options.add("n", ki18n("do not open last used file"));
  options.add("timers", ki18n("enable performance timers"));
  options.add("nocatch", ki18n("do not globally catch uncaught exceptions"));

#ifdef KMM_DEBUG
  // The following options are only available when compiled in debug mode
  options.add("trace", ki18n("turn on program traces"));
  options.add("dump-actions", ki18n("dump the names of all defined KAction objects to stdout and quit"));
#endif

  // INSERT YOUR COMMANDLINE OPTIONS HERE
  options.add("+[File]", ki18n("file to open"));

  KCmdLineArgs::init(argc, argv, &aboutData);
  KCmdLineArgs::addCmdLineOptions(options);   // Add our own options.

  // create the singletons before we start memory checking
  // to avoid false error reports
  MyMoneyFile::instance();

  KMyMoneyUtils::checkConstants();

  KApplication* a = new KApplication();

  if (KGlobal::locale()->monetaryDecimalSymbol().isEmpty()) {
    KMessageBox::error(0, i18n("The monetary decimal symbol is not correctly set in the KDE System Settings module Country/Region & Language. Please set it to a reasonable value and start KMyMoney again."), i18n("Invalid settings"));
    delete a;
    exit(1);
  }

  // show startup logo
  KStartupLogo* splash = new KStartupLogo();
  a->processEvents();

  args = KCmdLineArgs::parsedArgs();

  // setup the MyMoneyMoney locale settings according to the KDE settings
  MyMoneyMoney::setThousandSeparator(KGlobal::locale()->monetaryThousandsSeparator()[0]);
  MyMoneyMoney::setDecimalSeparator(KGlobal::locale()->monetaryDecimalSymbol()[0]);
  MyMoneyMoney::setNegativeMonetarySignPosition(static_cast<MyMoneyMoney::signPosition>(KGlobal::locale()->negativeMonetarySignPosition()));
  MyMoneyMoney::setPositiveMonetarySignPosition(static_cast<MyMoneyMoney::signPosition>(KGlobal::locale()->positiveMonetarySignPosition()));
  MyMoneyMoney::setNegativePrefixCurrencySymbol(KGlobal::locale()->negativePrefixCurrencySymbol());
  MyMoneyMoney::setPositivePrefixCurrencySymbol(KGlobal::locale()->positivePrefixCurrencySymbol());

  QString language = args->getOption("lang");
  if (!language.isEmpty()) {
    if (!KGlobal::locale()->setLanguage(QStringList() << language)) {
      qWarning("Unable to select language '%s'. This has one of two reasons:\n\ta) the standard KDE message catalog is not installed\n\tb) the KMyMoney message catalog is not installed", qPrintable(language));
    }
  }

#ifdef KMM_DEBUG
  if (args->isSet("trace"))
    MyMoneyTracer::on();
  timersOn = args->isSet("timers");
#endif

  kmymoney = 0;
  kmymoney = new KMyMoneyApp();

#ifdef KMM_DEBUG
  if (args->isSet("dump-actions")) {
    kmymoney->dumpActions();

    // Before we delete the application, we make sure that we destroy all
    // widgets by running the event loop for some time to catch all those
    // widgets that are requested to be destroyed using the deleteLater() method.
    //QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput, 10);
    QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 10);

    delete kmymoney;
    delete splash;
    delete a;
    exit(0);
  }
#endif

  int rc = 0;
  if (args->isSet("catch") == false) {
    qDebug("Running w/o global try/catch block");
    rc = runKMyMoney(a, splash);
  } else {
    try {
      rc = runKMyMoney(a, splash);
    } catch (const MyMoneyException &e) {
      KMessageBox::detailedError(0, i18n("Uncaught error. Please report the details to the developers"),
                                 i18n("%1 in file %2 line %3", e.what(), e.file(), e.line()));
      throw e;
    }
  }
  delete a;

  return rc;
}
Ejemplo n.º 12
0
//Put the system into the suspend state
void LOS::systemSuspend(){
  QString state = LUtils::getCmdOutput("sysctl -n hw.acpi.suspend_state").join("").simplified();
  QProcess::startDetached("acpiconf", QStringList() << "-s" << state );
}
Ejemplo n.º 13
0
//Set the current volume
void LOS::setAudioVolume(int percent){
  if(percent<0){percent=0;}
  else if(percent>100){percent=100;}
  bool remoteSession = !QString(getenv("PICO_CLIENT_LOGIN")).isEmpty();
  if(remoteSession){
    LUtils::runCmd(QString("pactl set-sink-volume @DEFAULT_SINK@ ")+QString::number(percent)+"%");
  }else{
    QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
    if(!info.isEmpty()){
      int L = info.section(":",1,1).toInt();
      int R = info.section(":",2,2).toInt();
      int diff = L-R;
      if((percent == L) && (L==R)){ return; } //already set to that volume
      if(diff<0){ R=percent; L=percent+diff; } //R Greater
      else{ L=percent; R=percent-diff; } //L Greater or equal
      //Check bounds
      if(L<0){L=0;}else if(L>100){L=100;}
      if(R<0){R=0;}else if(R>100){R=100;}
      //Run Command
      LUtils::runCmd("mixer vol "+QString::number(L)+":"+QString::number(R));
    }
  }
  audiovolume = percent; //save for checking later
  LUtils::writeFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/.currentvolume", QStringList() << QString::number(percent), true);
}
Ejemplo n.º 14
0
//Read the current volume
int LOS::audioVolume(){ //Returns: audio volume as a percentage (0-100, with -1 for errors)
  int out = audiovolume;
  if(out < 0){
    //First time session check: Load the last setting for this user
    QString info = LUtils::readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/.currentvolume").join("");
    if(!info.isEmpty()){
      out = info.simplified().toInt();
      audiovolume = out; //reset this internal flag
      return out;
    }
  }
  bool remoteSession = !QString(getenv("PICO_CLIENT_LOGIN")).isEmpty();
  if(remoteSession){
     QStringList info = LUtils::getCmdOutput("pactl list short sinks");
     qDebug() << "Got PA sinks:" << info;
     out = 50; //TEMPORARY - still need to write up the info parsing
     audiovolume = out;
  }else{
    //probe the system for the current volume (other utils could be changing it)
      QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
      if(!info.isEmpty()){
        int L = info.section(":",1,1).toInt();
        int R = info.section(":",2,2).toInt();
        if(L>R){ out = L; }
        else{ out = R; }
	if(out != audiovolume){
	  //Volume changed by other utility: adjust the saved value as well
	  LUtils::writeFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/.currentvolume", QStringList() << QString::number(out), true);
	}
	audiovolume = out;
      }
  }
  return out;
}
Ejemplo n.º 15
0
 QStringList MemcachedApi::callTips(const QStringList& context, int commas, QsciScintilla::CallTipsStyle style, QList<int>& shifts)
 {
     return QStringList();
 }
Ejemplo n.º 16
0
QStringList
MediaPlayer2::SupportedUriSchemes() const
{
    return QStringList() << "lastfm";
}
Ejemplo n.º 17
0
QStringList QICOPlugin::keys() const
{
    return QStringList() << QLatin1String("ico");
}
Ejemplo n.º 18
0
QStringList
MediaPlayer2::SupportedMimeTypes() const
{
    return QStringList();
}
Ejemplo n.º 19
0
QStringList LOS::DiskUsage(){ //Returns: List of current read/write stats for each device
  return QStringList(); //not implemented yet
}
Ejemplo n.º 20
0
ServerChoice::ServerChoice(TeamHolder* team) :
    ui(new Ui::ServerChoice), wasConnected(false), team(team)
{
    ui->setupUi(this);
    ui->announcement->hide();

    ServerChoiceModel *model = new ServerChoiceModel();
    model->setParent(ui->serverList);
    filter = new QSortFilterProxyModel(ui->serverList);
    filter->setSourceModel(model);
    filter->setSortRole(ServerChoiceModel::SortRole);
    ui->serverList->setModel(filter);

    connect(ui->description, SIGNAL(anchorClicked(QUrl)), SLOT(anchorClicked(QUrl)));

    QSettings settings;

    registry_connection = new Analyzer(true);
    connect(registry_connection, SIGNAL(connected()), SLOT(connected()));

    registry_connection->connectTo(
        settings.value("ServerChoice/RegistryServer", "pokemon-online-registry.dynalias.net").toString(),
        settings.value("ServerChoice/RegistryPort", 5090).toUInt()
    );
    registry_connection->setParent(this);

    ui->switchPort->setIcon(QApplication::style()->standardIcon(QStyle::SP_BrowserReload));

    connect(registry_connection, SIGNAL(connectionError(int,QString)), SLOT(connectionError(int , QString)));
    connect(registry_connection, SIGNAL(regAnnouncementReceived(QString)), ui->announcement, SLOT(setText(QString)));
    connect(registry_connection, SIGNAL(regAnnouncementReceived(QString)), ui->announcement, SLOT(show()));

    connect(registry_connection, SIGNAL(serverReceived(ServerInfo)), model, SLOT(addServer(ServerInfo)));
    connect(this, SIGNAL(clearList()), model, SLOT(clear()));
    connect(registry_connection, SIGNAL(serverReceived(ServerInfo)), SLOT(serverAdded()));

    //TO-DO: Make  the item 0 un-resizable and unselectable - Latios

    ui->serverList->setColumnWidth(0, settings.value("ServerChoice/PasswordProtectedWidth", 26).toInt());
    ui->serverList->setColumnWidth(1, settings.value("ServerChoice/ServerNameWidth", 152).toInt());
    if (settings.contains("ServerChoice/PlayersInfoWidth")) {
        ui->serverList->setColumnWidth(2, settings.value("ServerChoice/PlayersInfoWidth").toInt());
    }
    ui->serverList->horizontalHeader()->setStretchLastSection(true);

    connect(ui->serverList, SIGNAL(activated(QModelIndex)), SLOT(regServerChosen(QModelIndex)));
    connect(ui->serverList, SIGNAL(currentCellChanged(QModelIndex)), SLOT(showDetails(QModelIndex)));

    ui->nameEdit->setText(team->name());
    ui->advServerEdit->addItem(settings.value("ServerChoice/DefaultServer").toString());
    connect(ui->nameEdit, SIGNAL(returnPressed()), SLOT(advServerChosen()));
    connect(ui->advServerEdit->lineEdit(), SIGNAL(returnPressed()), SLOT(advServerChosen()));

    QCompleter *completer = new QCompleter(ui->advServerEdit);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    QStringList res = settings.value("ServerChoice/SavedServers").toStringList();

    foreach (QString r, res) {
        if (r.contains("-")) {
            savedServers.push_back(QStringList() << r.section("-", -1).trimmed() << r.section("-", 0, -2).trimmed());
        } else {
            savedServers.push_back(QStringList() << r << "");
        }
    }

    QStringListModel *m = new QStringListModel(res, completer);

    completer->setModel(m);
    ui->advServerEdit->setCompleter(completer);
    ui->advServerEdit->setModel(m);

    connect(ui->goBack, SIGNAL(clicked()), SIGNAL(rejected()));
    connect(ui->advancedConnection, SIGNAL(clicked()), SLOT(advServerChosen()));

    QTimer *t = new QTimer(this);
    t->singleShot(5000, this, SLOT(timeout()));

#if QT_VERSION >= QT_VERSION_CHECK(4,8,0)
    ui->serverList->sortByColumn(ServerChoiceModel::Players, Qt::SortOrder(filter->headerData(ServerChoiceModel::Players, Qt::Horizontal, Qt::InitialSortOrderRole).toInt()));
#else
    ui->serverList->sortByColumn(ServerChoiceModel::Players, Qt::DescendingOrder);
#endif
}
Ejemplo n.º 21
0
int main(int argc, char *argv[])
{
  // Fix for Issue 1377, if locale is not set to the default one, some
  // numbers will be displayed in the systems default locale:
  setlocale(LC_ALL, "C");

  // Fix of Issue with Text centering on OSX Mavericks
#ifdef Q_OS_MACX

  if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8)
    {
      // fix Mac OS X 10.9 (mavericks) font issue
      // https://bugreports.qt-project.org/browse/QTBUG-32789
      QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
    }

#endif

  CQCopasiApplication a(argc, argv);

  a.setAttribute(Qt::AA_DontShowIconsInMenus, false);

  Q_INIT_RESOURCE(copasi);

  // Parse the commandline options
  try
    {
      // Create the root container.
      CCopasiRootContainer::init(argc, argv, true);
    }
  catch (copasi::option_error & msg)
    {
      CQMessageBox::critical(NULL, "Initialization Error",
                             msg.what(),
                             QMessageBox::Ok , QMessageBox::Ok);

      return 1;
    }

#ifdef Darwin
  std::string PluginDir;

  COptions::getValue("CopasiDir", PluginDir);
  PluginDir += "/Contents/plugins";

  QApplication::setLibraryPaths(QStringList(FROM_UTF8(PluginDir)));
#endif // Darwin

  // Create the global data model.
  CCopasiRootContainer::addDatamodel();

  // Create the main application window.
  CopasiUI3Window *pWindow = CopasiUI3Window::create();

#ifdef COPASI_SBW_INTEGRATION

  if (COptions::compareValue("SBWRegister", true))
    goto finish;

#endif // COPASI_SBW_INTEGRATION

  if (pWindow != NULL)
    {
      a.setMainWindow(pWindow);
      a.exec();
    }

finish:

  try // To suppress any access violations during destruction works only under Windows
    {
      pdelete(pWindow);
      CCopasiRootContainer::destroy();
    }
  catch (...)
    {}

  return 0;
}
Ejemplo n.º 22
0
QWidget *MiscEditor::buildPage2()
{
	QWidget *ret = new QWidget(this);

	QFont font;
	font.setPointSize(10);

	tutoE_list = new QTreeWidget(ret);
	tutoE_list->setFont(font);
	tutoE_list->setHeaderLabel(tr("Catégorie"));
	tutoE_list->setIndentation(0);
	tutoE_list->setUniformRowHeights(true);

	QStringList tutoStrings;
	tutoStrings
			<< tr("Lieux/Mine de souffre") << tr("Lieux/Dollet") << tr("Lieux/Timber")
			<< tr("Lieux/Chaîne TV Timber") << tr("Lieux/Galbadia") << tr("Lieux/Tombe du roi inconnu")
			<< tr("Lieux/Winhill") << tr("Lieux/Prison du désert") << tr("Lieux/Base des missiles")
			<< tr("Lieux/Aqueduc d'Horizon") << tr("Lieux/Horizon") << tr("Lieux/Trabia")
			<< tr("Lieux/Esthar(1)") << tr("Lieux/Esthar(2)") << tr("Lieux/Esthar(3)")
			<< tr("Lieux/Station balnéaire") << tr("Lieux/Salt Lake") << tr("Lieux/Lune")
			<< tr("Lieux/Labo de Deep Sea") << tr("Lieux/Fouilles de Deep Sea") << tr("Termes/Compression Temporelle")
			<< tr("Termes/Origine de la BGU") << tr("Termes/Ondes hertziennes(1)") << tr("Termes/Ondes hertziennes(2)")
			<< tr("Termes/Larme sélénite") << tr("Termes/Centra") << tr("Termes/Compteur Geyser")
			<< tr("Termes/Mages et sorcières") << tr("Termes/Pouvoirs magiques") << tr("Termes/Monolithe")
			<< tr("Termes/Lunatic Pandora") << tr("Termes/Tears Point") << tr("Termes/Sanctuaire d'Adel")
			<< tr("Termes/L'Hydre") << tr("Termes/Niveau MD") << tr("Termes/Refuge de Centra")
			<< tr("Termes/Timber Maniacs") << tr("Termes/Eyes On Me") << tr("Personnages/Dr. Geyser")
			<< tr("Personnages/Hyne") << tr("Personnages/Seeds Blancs") << tr("Personnages/Moomba")
			<< tr("Personnages/Tribu Shumi") << tr("Personnages/Chocobo") << tr("Personnages/Maire Dobe")
			<< tr("Zell") << tr("Quistis") << tr("Seifer")
			<< tr("Selphie") << tr("Linoa") << tr("Irvine")
			<< tr("Edea") << tr("Laguna") << tr("Kiros")
			<< tr("Ward") << tr("Linoa 2 (Canonisation)") << tr("Inutilisé")
			<< tr("Inutilisé") << tr("Termes/Réincarnation occulte") << tr("Rapport de combat")
			<< tr("Rapport Perso") << tr("Rapport G-Force") << tr("Actions/Association G-Force (inutilisé)")
			<< tr("Actions/Association magique") << tr("Actions/Association élémentale") << tr("Actions/Association mentale")
			<< tr("Actions/Tutorial G-Forces") << tr("Actions/Écran situation Squall") << tr("Actions/Écran situation Zell")
			<< tr("Actions/Écran situation Linoa") << tr("Actions/Intervertir") << tr("Inutilisé")
			<< tr("Minimog") << tr("Rapport G-Force/Golgotha") << tr("Rapport G-Force/Shiva")
			<< tr("Rapport G-Force/Ifrit") << tr("Rapport G-Force/Ondine") << tr("Rapport G-Force/Taurus")
			<< tr("Rapport G-Force/Nosferatu") << tr("Rapport G-Force/Ahuri") << tr("Rapport G-Force/Leviathan")
			<< tr("Rapport G-Force/Zéphyr") << tr("Rapport G-Force/Cerberus") << tr("Rapport G-Force/Alexander")
			<< tr("Rapport G-Force/Helltrain") << tr("Rapport G-Force/Bahamut") << tr("Rapport G-Force/Pampa")
			<< tr("Rapport G-Force/Tomberry") << tr("Rapport G-Force/Orbital") << tr("Créa-Mgi-Cél")
			<< tr("Créa-Mgi-Cél 2") << tr("Créa-Mgi-Gla") << tr("Créa-Mgi-Gla 2")
			<< tr("Créa-Mgi-Inc") << tr("Créa-Mgi-Inc 2") << tr("Créa-Mgi-Méd")
			<< tr("Créa-Mgi-Méd 2") << tr("Créa-Mgi-Temp") << tr("Créa-Mgi-Temp 2")
			<< tr("Créa-Mgi-Mtl") << tr("Créa-Mgi-Mtl 2") << tr("Créa-Mgi-Pro")
			<< tr("Créa-Mgi-Pro 2") << tr("Créa-Mgi-Tab") << tr("Créa-Mgi-Tab 2")
			<< tr("Créa-Mgi-Thér") << tr("Créa-Mgi-Thér 2") << tr("Créa-Mgi-Ana")
			<< tr("Créa-Mgi-Ana 2") << tr("Créa-balles") << tr("Créa-balles 2")
			<< tr("Créa-outils") << tr("Créa-outils 2") << tr("Créa-Thér-Tab")
			<< tr("Créa-Thér-Tab 2") << tr("Créa-Thér-GF") << tr("Créa-Thér-GF 2")
			<< tr("Créa-Capa-GF") << tr("Créa-Capa-GF 2") << tr("Créa-Mgi-Plus")
			<< tr("Créa-Mgi-Plus 2") << tr("Thér-Niv +") << tr("Thér-Niv + 2")
			<< tr("Freud") << tr("Créa-Mgi-Max") << tr("Créa-Mgi-Max 2")
			<< tr("Inutilisé") << tr("Diplôme Minotaure");

	QTreeWidgetItem *item;
	foreach(QString tutoString, tutoStrings) {
		item = new QTreeWidgetItem(QStringList(tutoString));
		item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
		tutoE_list->addTopLevelItem(item);
	}
Ejemplo n.º 23
0
extern "C" Q_DECL_EXPORT int kdemain( int argc, char* argv[] )
{
    sanity_check(argc, argv);

    putenv((char*)"SESSION_MANAGER=");
    checkComposite();

    // force xcb QPA plugin as ksmserver is very X11 specific
    const QByteArray origQpaPlatform = qgetenv("QT_QPA_PLATFORM");
    qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("xcb"));

    QQuickWindow::setDefaultAlphaBuffer(true);
    QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
    QApplication *a = new QApplication(argc, argv);

    // now the QPA platform is set, unset variable again to not launch apps with incorrect environment
    if (origQpaPlatform.isEmpty()) {
        qunsetenv("QT_QPA_PLATFORM");
    } else {
        qputenv("QT_QPA_PLATFORM", origQpaPlatform);
    }

    QApplication::setApplicationName( QStringLiteral( "ksmserver") );
    QApplication::setApplicationVersion( QString::fromLatin1( version ) );
    QApplication::setOrganizationDomain( QStringLiteral( "kde.org") );

    fcntl(ConnectionNumber(QX11Info::display()), F_SETFD, 1);

    a->setQuitOnLastWindowClosed(false); // #169486

    QCommandLineParser parser;
    parser.setApplicationDescription(i18n(description));
    parser.addHelpOption();
    parser.addVersionOption();

    QCommandLineOption restoreOption(QStringList() << QStringLiteral("r") << QStringLiteral("restore"),
                                     i18n("Restores the saved user session if available"));
    parser.addOption(restoreOption);

    QCommandLineOption wmOption(QStringList() << QStringLiteral("w") << QStringLiteral("windowmanager"),
                                i18n("Starts <wm> in case no other window manager is \nparticipating in the session. Default is 'kwin'"),
                                i18n("wm"));
    parser.addOption(wmOption);

    QCommandLineOption nolocalOption(QStringLiteral("nolocal"),
                                     i18n("Also allow remote connections"));
    parser.addOption(nolocalOption);

    QCommandLineOption lockscreenOption(QStringLiteral("lockscreen"),
                                        i18n("Starts the session in locked mode"));
    parser.addOption(lockscreenOption);

    QCommandLineOption noLockscreenOption(QStringLiteral("no-lockscreen"),
                                         i18n("Starts without lock screen support. Only needed if other component provides the lock screen."));
    parser.addOption(noLockscreenOption);

    parser.process(*a);

//TODO: should we still use this?
//    if( !QDBusConnection::sessionBus().interface()->
//            registerService( QStringLiteral( "org.kde.ksmserver" ),
//                             QDBusConnectionInterface::DontQueueService ) )
//    {
//        qCWarning(KSMSERVER, "Could not register with D-BUS. Aborting.");
//        return 1;
//    }

    QString wm = parser.value(wmOption);

    bool only_local = !parser.isSet(nolocalOption);
#ifndef HAVE__ICETRANSNOLISTEN
    /* this seems strange, but the default is only_local, so if !only_local
     * the option --nolocal was given, and we warn (the option --nolocal
     * does nothing on this platform, as here the default is reversed)
     */
    if (!only_local) {
        qCWarning(KSMSERVER, "--nolocal is not supported on your platform. Sorry.");
    }
    only_local = false;
#endif

    KSMServer::InitFlags flags = KSMServer::InitFlag::None;
    if (only_local) {
        flags |= KSMServer::InitFlag::OnlyLocal;
    }
    if (parser.isSet(lockscreenOption)) {
        flags |= KSMServer::InitFlag::ImmediateLockScreen;
    }
    if (parser.isSet(noLockscreenOption)) {
        flags |= KSMServer::InitFlag::NoLockScreen;
    }

    KSMServer *server = new KSMServer( wm, flags);

    // for the KDE-already-running check in startkde
    KSelectionOwner kde_running( "_KDE_RUNNING", 0 );
    kde_running.claim( false );

    IceSetIOErrorHandler( IoErrorHandler );

    KConfigGroup config(KSharedConfig::openConfig(), "General");

    int realScreenCount = ScreenCount( QX11Info::display() );
    bool screenCountChanged =
         ( config.readEntry( "screenCount", realScreenCount ) != realScreenCount );

    QString loginMode = config.readEntry( "loginMode", "restorePreviousLogout" );

    if ( parser.isSet( restoreOption ) && ! screenCountChanged )
        server->restoreSession( QStringLiteral( SESSION_BY_USER ) );
    else if ( loginMode == QStringLiteral( "default" ) || screenCountChanged )
        server->startDefaultSession();
    else if ( loginMode == QStringLiteral( "restorePreviousLogout" ) )
        server->restoreSession( QStringLiteral( SESSION_PREVIOUS_LOGOUT ) );
    else if ( loginMode == QStringLiteral( "restoreSavedSession" ) )
        server->restoreSession( QStringLiteral( SESSION_BY_USER ) );
    else
        server->startDefaultSession();

    KDBusService service(KDBusService::Unique);

    int ret = a->exec();
    kde_running.release(); // needs to be done before QApplication destruction
    delete a;
    return ret;
}
Ejemplo n.º 24
0
void MythUtilCommandLineParser::LoadArguments(void)
{
    CommandLineArg::AllowOneOf( QList<CommandLineArg*>()
        // fileutils.cpp
        << add("--copyfile", "copyfile", false,
                "Copy a MythTV Storage Group file", "")
                ->SetGroup("File")
                ->SetRequiredChild(QStringList("infile") << "outfile")

        // mpegutils.cpp
        << add("--pidcounter", "pidcounter", false,
                "Count pids in a MythTV Storage Group file", "")
                ->SetGroup("MPEG-TS")
                ->SetRequiredChild("infile")
        << add("--pidfilter", "pidfilter", false,
                "Filter pids in a MythTV Storage Group file", "")
                ->SetGroup("MPEG-TS")
                ->SetRequiredChild(QStringList("infile") << "outfile")
        << add("--pidprinter", "pidprinter", false,
                "Print PSIP pids in a MythTV Storage Group file", "")
                ->SetGroup("MPEG-TS")
                ->SetRequiredChild("infile")
                ->SetChild("outfile")

        // markuputils.cpp
        << add("--gencutlist", "gencutlist", false,
                "Copy the commercial skip list to the cutlist.", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--getcutlist", "getcutlist", false,
                "Display the current cutlist.", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--setcutlist", "setcutlist", "",
                "Set a new cutlist in the form:\n"
                "#-#[,#-#]... (ie, 1-100,1520-3012,4091-5094)", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--clearcutlist", "clearcutlist", false,
                "Clear the cutlist.", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--getskiplist", "getskiplist", false,
                "Display the current commercial skip list.", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--setskiplist", "setskiplist", "",
                "Set a new commercial skip list in the form:\n"
                "#-#[,#-#]... (ie, 1-100,1520-3012,4091-5094)", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")
        << add("--clearskiplist", "clearskiplist", false,
                "Clear the commercial skip list.", "")
                ->SetGroup("Recording Markup")
                ->SetRequiredChild(QStringList("chanid") << "starttime")

        // backendutils.cpp
        << add("--resched", "resched", false,
                "Trigger a run of the recording scheduler on the existing "
                "master backend.",
                "This command will connect to the master backend and trigger "
                "a run of the recording scheduler. The call will return "
                "immediately, however the scheduler run may take several "
                "seconds to a minute or longer to complete.")
                ->SetGroup("Backend")
        << add("--scanvideos", "scanvideos", false,
                "Trigger a rescan of media content in MythVideo.",
                "This command will connect to the master backend and trigger "
                "a run of the Video scanner. The call will return "
                "immediately, however the scanner may take several seconds "
                "to tens of minutes, depending on how much new or moved "
                "content it has to hash, and how quickly the scanner can "
                "access those files to do so. If enabled, this will also "
                "trigger the bulk metadata scanner upon completion.")
                ->SetGroup("Backend")
        << add("--event", "event", QVariant::StringList, 
                "Send a backend event test message.", "")
                ->SetGroup("Backend")
        << add("--systemevent", "systemevent", "",
                "Send a backend SYSTEM_EVENT test message.", "")
                ->SetGroup("Backend")
        << add("--clearcache", "clearcache", false,
                "Trigger a cache clear on all connected MythTV systems.",
                "This command will connect to the master backend and trigger "
                "a cache clear event, which will subsequently be pushed to "
                "all other connected programs. This event will clear the "
                "local database settings cache used by each program, causing "
                "options to be re-read from the database upon next use.")
                ->SetGroup("Backend")
        << add("--parse-video-filename", "parsevideo", "", "",
                "Diagnostic tool for testing filename formats against what "
                "the Video Library name parser will detect them as.")
                ->SetGroup("Backend")

        // jobutils.cpp
        << add("--queuejob", "queuejob", "",
                "Insert a new job into the JobQueue.",
                "Schedule the specified job type (transcode, commflag, "
                "metadata, userjob1, userjob2, userjob3, userjob4) to run "
                "for the recording with the given chanid and starttime.")
                ->SetGroup("JobQueue")
                ->SetRequiredChild("chanid")
                ->SetRequiredChild("starttime")

        // messageutils.cpp
        << add("--message", "message", false,
                "Display a message on a frontend", "")
                ->SetGroup("Messaging")
        << add("--print-template", "printtemplate", false,
                "Print the template to be sent to the frontend", "")
                ->SetGroup("Messaging")
        );

    // mpegutils.cpp
    add("--pids", "pids", "", "Pids to process", "")
        ->SetRequiredChildOf("pidfilter")
        ->SetRequiredChildOf("pidprinter");
    add("--ptspids", "ptspids", "", "Pids to extract PTS from", "")
        ->SetGroup("MPEG-TS");
    add("--packetsize", "packetsize", 188, "TS Packet Size", "")
        ->SetChildOf("pidcounter")
        ->SetChildOf("pidfilter");
    add("--noautopts", "noautopts", false, "Disables PTS discovery", "")
        ->SetChildOf("pidprinter");
    add("--xml", "xml", false, "Enables XML output of PSIP", "")
        ->SetChildOf("pidprinter");

    // messageutils.cpp
    add("--udpport", "udpport", 6948, "(optional) UDP Port to send to", "")
        ->SetChildOf("message");
    add("--bcastaddr", "bcastaddr", "127.0.0.1", "(optional) IP address to send to", "")
        ->SetChildOf("message");

    // Generic Options used by more than one utility
    addRecording();
    addInFile(true);
    addSettingsOverride();
    addHelp();
    addVersion();
    addLogging();
    allowExtras();
}
PlatformInfo PlatformInfo::localHostInfo()
{
    PlatformInfo pi;
    pi.insert(PI_HostName, QHostInfo::localHostName());
    pi.insert(PI_QtVersion, QLS(qVersion()));
    pi.insert(PI_QMakeSpec, QString(QLS(QMAKESPEC)).remove(QRegExp(QLS("^.*mkspecs/"))));
#if QT_VERSION >= 0x050000
    pi.insert(PI_QtBuildMode, QLibraryInfo::isDebugBuild() ? QLS("QtDebug") : QLS("QtRelease"));
#endif
#if defined(Q_OS_LINUX)
    pi.insert(PI_OSName, QLS("Linux"));
    QProcess uname;
    uname.start(QLS("uname"), QStringList() << QLS("-r"));
    if (uname.waitForFinished(3000))
        pi.insert(PI_OSVersion, QString::fromLocal8Bit(uname.readAllStandardOutput().constData()).simplified());
#elif defined(Q_OS_WINCE)
    pi.insert(PI_OSName, QLS("WinCE"));
    pi.insert(PI_OSVersion, QString::number(QSysInfo::windowsVersion()));
#elif defined(Q_OS_WIN)
    pi.insert(PI_OSName, QLS("Windows"));
    pi.insert(PI_OSVersion, QString::number(QSysInfo::windowsVersion()));
#elif defined(Q_OS_MAC)
    pi.insert(PI_OSName, QLS("MacOS"));
    pi.insert(PI_OSVersion, QString::number(QSysInfo::macVersion()));
#else
    pi.insert(PI_OSName, QLS("Other"));
#endif

#ifndef QT_NO_PROCESS
    QProcess git;
    QString cmd;
    QStringList args;
#if defined(Q_OS_WIN)
    cmd = QLS("cmd.exe");
    args << QLS("/c") << QLS("git");
#else
    cmd = QLS("git");
#endif
    args << QLS("log") << QLS("--max-count=1") << QLS("--pretty=%H [%an] [%ad] %s");
    git.start(cmd, args);
    git.waitForFinished(3000);
    if (!git.exitCode())
        pi.insert(PI_GitCommit, QString::fromLocal8Bit(git.readAllStandardOutput().constData()).simplified());
    else
        pi.insert(PI_GitCommit, QLS("Unknown"));

    QByteArray gb = qgetenv("PULSE_GIT_BRANCH");
    if (!gb.isEmpty()) {
        pi.insert(PI_PulseGitBranch, QString::fromLatin1(gb));
        pi.setAdHocRun(false);
    }
    QByteArray tb = qgetenv("PULSE_TESTR_BRANCH");
    if (!tb.isEmpty()) {
        pi.insert(PI_PulseTestrBranch, QString::fromLatin1(tb));
        pi.setAdHocRun(false);
    }
    if (!qgetenv("JENKINS_HOME").isEmpty()) {
        pi.setAdHocRun(false);
        gb = qgetenv("GIT_BRANCH");
        if (!gb.isEmpty()) {
            // FIXME: the string "Pulse" should be eliminated, since that is not the used tool.
            pi.insert(PI_PulseGitBranch, QString::fromLatin1(gb));
        }
    }
#endif // !QT_NO_PROCESS

    return pi;
}
Ejemplo n.º 26
0
QStringList ServerView::mimeTypes() const {
	QStringList qsl;
	qsl << QStringList(QLatin1String("text/uri-list"));
	qsl << QStringList(QLatin1String("text/plain"));
	return qsl;
}
Ejemplo n.º 27
0
QStringList StateServiceNull::getAllApplicationStateNames() const { return QStringList(); }
Ejemplo n.º 28
0
QStringList FreqHistParser::functions() const
{
    return QStringList() << "Freq Hist Parser";
}
Ejemplo n.º 29
0
QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
{
  if ( thePath.isEmpty() )
    return 0;

  QgsDebugMsgLevel( "thePath = " + thePath, 2 );

  // zip settings + info
  QSettings settings;
  QString scanZipSetting = settings.value( "/qgis/scanZipInBrowser2", "basic" ).toString();
  QString vsiPrefix = QgsZipItem::vsiPrefix( thePath );
  bool is_vsizip = ( vsiPrefix == "/vsizip/" );
  bool is_vsigzip = ( vsiPrefix == "/vsigzip/" );
  bool is_vsitar = ( vsiPrefix == "/vsitar/" );

  // should we check ext. only?
  // check if scanItemsInBrowser2 == extension or parent dir in scanItemsFastScanUris
  // TODO - do this in dir item, but this requires a way to inform which extensions are supported by provider
  // maybe a callback function or in the provider registry?
  bool scanExtSetting = false;
  if (( settings.value( "/qgis/scanItemsInBrowser2",
                        "extension" ).toString() == "extension" ) ||
      ( settings.value( "/qgis/scanItemsFastScanUris",
                        QStringList() ).toStringList().contains( parentItem->path() ) ) ||
      (( is_vsizip || is_vsitar ) && parentItem && parentItem->parent() &&
       settings.value( "/qgis/scanItemsFastScanUris",
                       QStringList() ).toStringList().contains( parentItem->parent()->path() ) ) )
  {
    scanExtSetting = true;
  }

  // get suffix, removing .gz if present
  QString tmpPath = thePath; //path used for testing, not for layer creation
  if ( is_vsigzip )
    tmpPath.chop( 3 );
  QFileInfo info( tmpPath );
  QString suffix = info.suffix().toLower();
  // extract basename with extension
  info.setFile( thePath );
  QString name = info.fileName();

  QgsDebugMsgLevel( "thePath= " + thePath + " tmpPath= " + tmpPath + " name= " + name
                    + " suffix= " + suffix + " vsiPrefix= " + vsiPrefix, 3 );

  // allow only normal files or VSIFILE items to continue
  if ( !info.isFile() && vsiPrefix == "" )
    return 0;

  // get supported extensions
  if ( extensions.isEmpty() )
  {
    buildSupportedRasterFileFilterAndExtensions( filterString, extensions, wildcards );
    QgsDebugMsgLevel( "extensions: " + extensions.join( " " ), 2 );
    QgsDebugMsgLevel( "wildcards: " + wildcards.join( " " ), 2 );
  }

  // skip *.aux.xml files (GDAL auxilary metadata files),
  // *.shp.xml files (ESRI metadata) and *.tif.xml files (TIFF metadata)
  // unless that extension is in the list (*.xml might be though)
  if ( thePath.endsWith( ".aux.xml", Qt::CaseInsensitive ) &&
       !extensions.contains( "aux.xml" ) )
    return 0;
  if ( thePath.endsWith( ".shp.xml", Qt::CaseInsensitive ) &&
       !extensions.contains( "shp.xml" ) )
    return 0;
  if ( thePath.endsWith( ".tif.xml", Qt::CaseInsensitive ) &&
       !extensions.contains( "tif.xml" ) )
    return 0;

  // Filter files by extension
  if ( !extensions.contains( suffix ) )
  {
    bool matches = false;
    foreach ( QString wildcard, wildcards )
    {
      QRegExp rx( wildcard, Qt::CaseInsensitive, QRegExp::Wildcard );
      if ( rx.exactMatch( info.fileName() ) )
      {
        matches = true;
        break;
      }
    }
Ejemplo n.º 30
0
void tst_treeviewfind::columns()
{
    // set up tree
    //   search for FOO in
    //   * HEADER1 | HEADER1
    //     * FOO1  | A
    //   * HEADER2 | FOOHEADER2
    //     * FOO2  | FOO3
    //   * HEADER3 | HEADER2
    //     * A     | FOO4
    QTreeWidget *tree = new QTreeWidget;
    tree->setColumnCount(2);
    QList<QTreeWidgetItem *> toplevelitems;
    QTreeWidgetItem *item;
    item = new QTreeWidgetItem((QTreeWidget *)0, QStringList() << QLatin1String("HEADER1") << QLatin1String("HEADER1"));
    item->addChild(new QTreeWidgetItem((QTreeWidget *)0, QStringList() << QLatin1String("FOO1") << QLatin1String("A")));
    toplevelitems << item;
    item = new QTreeWidgetItem((QTreeWidget *)0, QStringList() << QLatin1String("HEADER2") << QLatin1String("FOOHEADER2"));
    item->addChild(new QTreeWidgetItem((QTreeWidget *)0, QStringList() << QLatin1String("FOO2") << QLatin1String("FOO3")));
    toplevelitems << item;
    item = new QTreeWidgetItem((QTreeWidget *)0, QStringList() << QLatin1String("HEADER3") << QLatin1String("HEADER3"));
    item->addChild(new QTreeWidgetItem((QTreeWidget *)0, QStringList() << QLatin1String("A") << QLatin1String("FOO4")));
    toplevelitems << item;
    tree->addTopLevelItems(toplevelitems);

    // set up
    Core::ItemViewFind *findSupport = new Core::ItemViewFind(tree);
    tree->setCurrentItem(toplevelitems.at(0));
    QCOMPARE(tree->currentItem()->text(0), QString::fromLatin1("HEADER1"));

    // find in first column
    findSupport->findStep(QLatin1String("FOO"), 0);
    QCOMPARE(tree->currentItem(), toplevelitems.at(0)->child(0));
    // find in second column of node with children
    findSupport->findStep(QLatin1String("FOO"), 0);
    QCOMPARE(tree->currentItem(), toplevelitems.at(1));
    // again find in first column
    findSupport->findStep(QLatin1String("FOO"), 0);
    QCOMPARE(tree->currentItem(), toplevelitems.at(1)->child(0));
    // don't stay in item if multiple columns match, and find in second column
    findSupport->findStep(QLatin1String("FOO"), 0);
    QCOMPARE(tree->currentItem(), toplevelitems.at(2)->child(0));
    // wrap
    findSupport->findStep(QLatin1String("FOO"), 0);
    QCOMPARE(tree->currentItem(), toplevelitems.at(0)->child(0));

    // backwards
    tree->setCurrentItem(toplevelitems.at(2)->child(0));
    QCOMPARE(tree->currentItem()->text(0), QString::fromLatin1("A"));
    findSupport->findStep(QLatin1String("FOO"), Core::FindBackward);
    QCOMPARE(tree->currentItem(), toplevelitems.at(1)->child(0));
    findSupport->findStep(QLatin1String("FOO"), Core::FindBackward);
    QCOMPARE(tree->currentItem(), toplevelitems.at(1));
    findSupport->findStep(QLatin1String("FOO"), Core::FindBackward);
    QCOMPARE(tree->currentItem(), toplevelitems.at(0)->child(0));
    findSupport->findStep(QLatin1String("FOO"), Core::FindBackward);
    QCOMPARE(tree->currentItem(), toplevelitems.at(2)->child(0));

    // clean up
    delete findSupport;
    delete tree;
}