当前位置: 首页>>代码示例>>C++>>正文


C++ QStringList::indexOf方法代码示例

本文整理汇总了C++中QStringList::indexOf方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::indexOf方法的具体用法?C++ QStringList::indexOf怎么用?C++ QStringList::indexOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QStringList的用法示例。


在下文中一共展示了QStringList::indexOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{

    QApplication a(argc, argv);
    qDebug()<<"argc="<<argc;
    QStringList aList = a.arguments();
    GenVid w;
    bool ok;

    if(argc==1){
        w.show();
    }else{
        for(int i=0; i<argc;i++){
            qDebug()<<"Argument i:"<<argv[i];
        }

        w.videopath = argv[1];

        w.btfpath = argv[2];

        w.savepath =argv[3];

        // decode arguments
        if(aList.contains("-box")){
            w.boxOn = true;
            if ((aList.at(aList.indexOf(QString("-box"))+1) != "-tr") ||
                    (aList.at(aList.indexOf(QString("-box"))+1) != "-id") ||
                    (aList.at(aList.indexOf(QString("-box"))+1) != "-cir") ||
                    (aList.at(aList.indexOf(QString("-box"))+1) != "-ar")){

                qDebug()<<aList.at(aList.indexOf(QString("-box"))+1).toInt(&ok)<<"width is an integer:"<<ok;

                if(ok){
                    w.rparam.x = aList.at(aList.indexOf(QString("-box"))+1).toInt();
                    ok=false;
                }
            }

            if ((aList.at(aList.indexOf(QString("-box"))+2) != "-tr") ||
                    (aList.at(aList.indexOf(QString("-box"))+2) != "-id") ||
                    (aList.at(aList.indexOf(QString("-box"))+2) != "-cir") ||
                    (aList.at(aList.indexOf(QString("-box"))+2) != "-ar")){

                qDebug()<<aList.at(aList.indexOf(QString("-box"))+2).toInt(&ok)<<"height is an integer:"<<ok;

                if(ok){
                    w.rparam.y = aList.at(aList.indexOf(QString("-box"))+2).toInt();
                    ok=false;
                }
            }

        }

        if(aList.contains("-s")){
            w.fontSize = 1;
        }

        if(aList.contains("-l")){
            w.fontSize =2;
        }
        if(aList.contains("-id")){
            w.idOn = true;
        }
        if(aList.contains("-xy")){
            w.xyOn = true;
        }
        if(aList.contains("-ang")){
            w.angleOn = true;
        }


//Circle Features
        if(aList.contains("-cir")){
            w.cirOn = true;
        }

        if(aList.contains("-rad")){
            w.cirOn = true;
            if (
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-id") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-xy") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-ang") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-s") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-l") ||

                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-cir") ||
//                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-rad") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-cs") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-ccol") ||

                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-tr") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-tsize") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-cs") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-tcol") ||

                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-ar") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-asize") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-ars") ||
                    (aList.at(aList.indexOf(QString("-rad"))+1) != "-acol") ||

//.........这里部分代码省略.........
开发者ID:biotracking,项目名称:biotrack,代码行数:101,代码来源:main.cpp

示例2: GenericForm

GeneralForm::GeneralForm(SettingsWidget *myParent) :
    GenericForm(QPixmap(":/img/settings/general.png"))
{
    parent = myParent;

    bodyUI = new Ui::GeneralSettings;
    bodyUI->setupUi(this);

    bodyUI->checkUpdates->setVisible(AUTOUPDATE_ENABLED);
    bodyUI->checkUpdates->setChecked(Settings::getInstance().getCheckUpdates());

    bodyUI->cbEnableIPv6->setChecked(Settings::getInstance().getEnableIPv6());
    for (int i = 0; i < langs.size(); i++)
        bodyUI->transComboBox->insertItem(i, langs[i]);

    bodyUI->transComboBox->setCurrentIndex(locales.indexOf(Settings::getInstance().getTranslation()));
    bodyUI->cbAutorun->setChecked(Settings::getInstance().getAutorun());
#if defined(__APPLE__) && defined(__MACH__)
    bodyUI->cbAutorun->setEnabled(false);
#endif

    bool showSystemTray = Settings::getInstance().getShowSystemTray();

    bodyUI->showSystemTray->setChecked(showSystemTray);
    bodyUI->startInTray->setChecked(Settings::getInstance().getAutostartInTray());
    bodyUI->startInTray->setEnabled(showSystemTray);
    bodyUI->closeToTray->setChecked(Settings::getInstance().getCloseToTray());
    bodyUI->closeToTray->setEnabled(showSystemTray);
    bodyUI->minimizeToTray->setChecked(Settings::getInstance().getMinimizeToTray());
    bodyUI->minimizeToTray->setEnabled(showSystemTray);
    bodyUI->lightTrayIcon->setChecked(Settings::getInstance().getLightTrayIcon());
    bodyUI->lightTrayIcon->setEnabled(showSystemTray);

    bodyUI->statusChanges->setChecked(Settings::getInstance().getStatusChangeNotificationEnabled());
    bodyUI->useEmoticons->setChecked(Settings::getInstance().getUseEmoticons());
    bodyUI->autoacceptFiles->setChecked(Settings::getInstance().getAutoSaveEnabled());
    bodyUI->autoSaveFilesDir->setText(Settings::getInstance().getGlobalAutoAcceptDir());
    bodyUI->showWindow->setChecked(Settings::getInstance().getShowWindow());
    bodyUI->showInFront->setChecked(Settings::getInstance().getShowInFront());
    bodyUI->notifySound->setChecked(Settings::getInstance().getNotifySound());
    bodyUI->groupAlwaysNotify->setChecked(Settings::getInstance().getGroupAlwaysNotify());
    bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
    bodyUI->cbCompactLayout->setChecked(Settings::getInstance().getCompactLayout());
    bodyUI->cbGroupchatPosition->setChecked(Settings::getInstance().getGroupchatPosition());

    for (auto entry : SmileyPack::listSmileyPacks())
        bodyUI->smileyPackBrowser->addItem(entry.first, entry.second);

    bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack()));
    reloadSmiles();
    bodyUI->smileyPackBrowser->setEnabled(bodyUI->useEmoticons->isChecked());

    bodyUI->styleBrowser->addItem(tr("None"));
    bodyUI->styleBrowser->addItems(QStyleFactory::keys());
    if (QStyleFactory::keys().contains(Settings::getInstance().getStyle()))
        bodyUI->styleBrowser->setCurrentText(Settings::getInstance().getStyle());
    else
        bodyUI->styleBrowser->setCurrentText(tr("None"));

    for (QString color : Style::themeColorNames)
        bodyUI->themeColorCBox->addItem(color);

    bodyUI->themeColorCBox->setCurrentIndex(Settings::getInstance().getThemeColor());

    bodyUI->emoticonSize->setValue(Settings::getInstance().getEmojiFontPointSize());

    QStringList timestamps;
    for (QString timestamp : timeFormats)
        timestamps << QString("%1 - %2").arg(timestamp, QTime::currentTime().toString(timestamp));

    bodyUI->timestamp->addItems(timestamps);

    QLocale ql;
    QStringList datestamps;
    dateFormats.append(ql.dateFormat());
    dateFormats.append(ql.dateFormat(QLocale::LongFormat));
    dateFormats.removeDuplicates();
    timeFormats.append(ql.timeFormat());
    timeFormats.append(ql.timeFormat(QLocale::LongFormat));
    timeFormats.removeDuplicates();

    for (QString datestamp : dateFormats)
        datestamps << QString("%1 - %2").arg(datestamp, QDate::currentDate().toString(datestamp));

    bodyUI->dateFormats->addItems(datestamps);

    bodyUI->timestamp->setCurrentText(QString("%1 - %2").arg(Settings::getInstance().getTimestampFormat(), QTime::currentTime().toString(Settings::getInstance().getTimestampFormat())));

    bodyUI->dateFormats->setCurrentText(QString("%1 - %2").arg(Settings::getInstance().getDateFormat(), QDate::currentDate().toString(Settings::getInstance().getDateFormat())));

    bodyUI->autoAwaySpinBox->setValue(Settings::getInstance().getAutoAwayTime());

    bodyUI->cbEnableUDP->setChecked(!Settings::getInstance().getForceTCP());
    bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr());
    int port = Settings::getInstance().getProxyPort();
    if (port != -1)
        bodyUI->proxyPort->setValue(port);

    bodyUI->proxyType->setCurrentIndex(static_cast<int>(Settings::getInstance().getProxyType()));
    onUseProxyUpdated();
//.........这里部分代码省略.........
开发者ID:akaWolf,项目名称:qTox,代码行数:101,代码来源:generalform.cpp

示例3: main

int main(int argc, char *argv[])
{
	QCoreApplication app(argc, argv);
	app.setOrganizationName("Cockatrice");
	app.setApplicationName("Servatrice");
	
	QStringList args = app.arguments();
	bool testRandom = args.contains("--test-random");
	bool testHashFunction = args.contains("--test-hash");
	bool logToConsole = args.contains("--log-to-console");
	QString configPath;
	int hasConfigPath=args.indexOf("--config");
	if(hasConfigPath > -1 && args.count() > hasConfigPath + 1)
		configPath = args.at(hasConfigPath + 1);
	
	qRegisterMetaType<QList<int> >("QList<int>");

#if QT_VERSION < 0x050000
	// gone in Qt5, all source files _MUST_ be utf8-encoded
	QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
#endif

	configPath = SettingsCache::guessConfigurationPath(configPath);
	qWarning() << "Using configuration file: " << configPath;
	settingsCache = new SettingsCache(configPath);
	
	loggerThread = new QThread;
	loggerThread->setObjectName("logger");
	logger = new ServerLogger(logToConsole);
	logger->moveToThread(loggerThread);
	
	loggerThread->start();
	QMetaObject::invokeMethod(logger, "startLog", Qt::BlockingQueuedConnection, Q_ARG(QString, settingsCache->value("server/logfile", QString("server.log")).toString()));

#if QT_VERSION < 0x050000
	if (logToConsole)
		qInstallMsgHandler(myMessageOutput);
	else
		qInstallMsgHandler(myMessageOutput2);
#else
	if (logToConsole)
		qInstallMessageHandler(myMessageOutput);
	else
		qInstallMessageHandler(myMessageOutput2);
#endif

#ifdef Q_OS_UNIX	
	struct sigaction hup;
	hup.sa_handler = ServerLogger::hupSignalHandler;
	sigemptyset(&hup.sa_mask);
	hup.sa_flags = 0;
	hup.sa_flags |= SA_RESTART;
	sigaction(SIGHUP, &hup, 0);
	
	struct sigaction segv;
	segv.sa_handler = sigSegvHandler;
	segv.sa_flags = SA_RESETHAND;
	sigemptyset(&segv.sa_mask);
	sigaction(SIGSEGV, &segv, 0);
	sigaction(SIGABRT, &segv, 0);
	
	signal(SIGPIPE, SIG_IGN);
#endif
	rng = new RNG_SFMT;
	
	std::cerr << "Servatrice " << VERSION_STRING << " starting." << std::endl;
	std::cerr << "-------------------------" << std::endl;
	
	PasswordHasher::initialize();
	
	if (testRandom)
		testRNG();
	if (testHashFunction)
		testHash();
	
	Servatrice *server = new Servatrice();
	QObject::connect(server, SIGNAL(destroyed()), &app, SLOT(quit()), Qt::QueuedConnection);
	int retval = 0;
	if (server->initServer()) {
		std::cerr << "-------------------------" << std::endl;
		std::cerr << "Server initialized." << std::endl;

#if QT_VERSION < 0x050000		
		qInstallMsgHandler(myMessageOutput);
#else
		qInstallMessageHandler(myMessageOutput);
#endif
		retval = app.exec();
		
		std::cerr << "Server quit." << std::endl;
		std::cerr << "-------------------------" << std::endl;
	}
	
	delete rng;
	delete settingsCache;
	
	logger->deleteLater();
	loggerThread->wait();
	delete loggerThread;

//.........这里部分代码省略.........
开发者ID:Grim-the-Reaper,项目名称:Cockatrice,代码行数:101,代码来源:main.cpp

示例4: wifiQuickConnect

void NetworkInterface::wifiQuickConnect(QString SSID, QString netKey, QString DeviceName, bool WEPHex){
  /* 
     This function uses a set of defaults to connect to a wifi access point with a minimum
     of information from the user. It does *NOT* (currently) support the WPA-Enterprise encryption
  */
  
    //do nothing if no SSID given
    if( SSID.isEmpty() ){
      return;
    }
  
    QString tmp;
    QString ifConfigLine;
    
    //Set defaults for quick-connect
    ifConfigLine="SYNCDHCP"; //Use DHCP

    //setup for not using the lagg interface
      Utils::setConfFileValue( "/etc/rc.conf", "ifconfig_lagg0", "", -1);
      Utils::setConfFileValue( "/etc/rc.conf", "ifconfig_" + DeviceName, \
		 "ifconfig_" + DeviceName + "=\"WPA " + ifConfigLine + "\"", -1);

	
    //Determine if the wpa_supplicant file exists already or is empty
    bool newWPASup = true;
    bool existingSSID = false;
    QStringList tmpFileList;
    QString tmpEntry;
    QFile fileout( "/etc/wpa_supplicant.conf" );
    if( fileout.open( QIODevice::ReadOnly ) ){
      QTextStream streamtmp(&fileout);
      streamtmp.setCodec("UTF-8");
        QString line;
        bool inEntry = false;
        bool eStart, eEnd;
        while ( !streamtmp.atEnd() ) {
            eStart = false; 
            eEnd = false;	
            line = streamtmp.readLine();
	    if ( line.contains("ctrl_interface=/var/run/wpa_supplicant") ) {
   		newWPASup = false;
	    }else if(line.contains("ssid=") && line.contains(SSID)){
	    	existingSSID=true;
	    }else if(line.contains("network={")){eStart = true;}
	    else if(line.contains("}")){eEnd = true; }
	    
	    //Save the file by entry temporarily
	    if(eStart){ tmpEntry = line; inEntry = true; }
	    else if(eEnd){ tmpEntry.append(" ::: "+line); tmpFileList << tmpEntry; inEntry=false; }	    
	    else if(inEntry){ tmpEntry.append(" ::: "+line); }
	    else{ tmpFileList << line; }
	}
	fileout.close();
    }
    //If the desired SSID already has an entry, remove it from wpa_supplicant.conf
    if(existingSSID){
      QFile tmpFile( "/etc/wpa_supplicant.conf.tmp" );
      if(tmpFile.open(QIODevice::WriteOnly | QIODevice::Text )){
        QTextStream oStr(&tmpFile);
        for(int i=0; i<tmpFileList.length(); i++){
          if(tmpFileList[i].contains("network={")){
            QStringList tmp = tmpFileList[i].split(" ::: ");
            //skip it if the new SSID
	    int idx = tmp.indexOf("ssid=");
            if( (idx!= -1) && !tmp[idx].contains(SSID) ){
              for(int j=0; j<tmp.length(); j++){
            	oStr << tmp[j] + "\n";    	    
              }
            }
          }else{
            oStr << tmpFileList[i] + "\n";	  
          }			
        }
      }
      tmpFile.close();
      Utils::runShellCommand("mv /etc/wpa_supplicant.conf.tmp /etc/wpa_supplicant.conf");
    }
    
    // Create the wpa_supplicant file based on saved configuration    
    if ( fileout.open( QIODevice::Append ) ) {
       QTextStream streamout( &fileout );

       // Fix to prevent kernel panic
       if(newWPASup)
	   streamout << "ctrl_interface=/var/run/wpa_supplicant\n\n";
       //Use SSID for network connection
       streamout << "\nnetwork={\n ssid=\"" + SSID + "\"\n";
       streamout << " priority=" << 146 << "\n";
       streamout << " scan_ssid=1\n";

       //Determine the security type for the given SSID
       QString SecType = getWifiSecurity(SSID,DeviceName);
       
       //Configure the wifi Security Settings for the proper type
       if ( SecType.contains("None") ){
          streamout << " key_mgmt=NONE\n";
	  
       } else if ( SecType.contains("WEP") ) {
	  //Set WEP Defaults
	  int WEPIndex = 0;
//.........这里部分代码省略.........
开发者ID:KhuramAli,项目名称:pcbsd,代码行数:101,代码来源:netif.cpp

示例5: connect

/*! \reimp
  Connects to QNX's io-display based device based on the \a displaySpec parameters
  from the \c{QWS_DISPLAY} environment variable. See the QQnxScreen class documentation
  for possible parameters.

  \sa QQnxScreen
 */
bool QQnxScreen::connect(const QString &displaySpec)
{
    const QStringList params = displaySpec.split(QLatin1Char(':'), QString::SkipEmptyParts);

    bool isOk = false;
    QRegExp deviceRegExp(QLatin1String("^device=(.+)$"));
    if (params.indexOf(deviceRegExp) != -1) {
        isOk = attachDevice(d, deviceRegExp.cap(1).toLocal8Bit().constData());
    } else {
        // no device specified - attach to device 0 (the default)
        isOk = attachDevice(d, GF_DEVICE_INDEX(0));
    }

    if (!isOk)
        return false;

    qDebug("QQnxScreen: Attached to Device, number of displays: %d", d->deviceInfo.ndisplays);

    // default to display 0
    int displayIndex = 0;
    QRegExp displayRegexp(QLatin1String("^display=(\\d+)$"));
    if (params.indexOf(displayRegexp) != -1) {
        displayIndex = displayRegexp.cap(1).toInt();
    }

    if (!attachDisplay(d, displayIndex))
        return false;

    qDebug("QQnxScreen: Attached to Display %d, resolution %dx%d, refresh %d Hz",
            displayIndex, d->displayInfo.xres, d->displayInfo.yres,
            d->displayInfo.refresh);


    // default to main_layer_index from the displayInfo struct
    int layerIndex = 0;
    QRegExp layerRegexp(QLatin1String("^layer=(\\d+)$"));
    if (params.indexOf(layerRegexp) != -1) {
        layerIndex = layerRegexp.cap(1).toInt();
    } else {
        layerIndex = d->displayInfo.main_layer_index;
    }

    if (!attachLayer(d, layerIndex))
        return false;

    // tell QWSDisplay the width and height of the display
    w = dw = d->displayInfo.xres;
    h = dh = d->displayInfo.yres;

    // we only support 32 bit displays for now.
    QScreen::d = 32;

    // assume 72 dpi as default, to calculate the physical dimensions if not specified
    const int defaultDpi = 72;

    // Handle display physical size spec.
    QRegExp mmWidthRegexp(QLatin1String("^mmWidth=(\\d+)$"));
    if (params.indexOf(mmWidthRegexp) == -1) {
        physWidth = qRound(dw * 25.4 / defaultDpi);
    } else {
        physWidth = mmWidthRegexp.cap(1).toInt();
    }

    QRegExp mmHeightRegexp(QLatin1String("^mmHeight=(\\d+)$"));
    if (params.indexOf(mmHeightRegexp) == -1) {
        physHeight = qRound(dh * 25.4 / defaultDpi);
    } else {
        physHeight = mmHeightRegexp.cap(1).toInt();
    }

    // create a hardware surface with our dimensions. In the old days, it was possible
    // to get a pointer directly to the hw surface, so we could blit directly. Now, we
    // have to use one indirection more, because it's not guaranteed that the hw surface
    // is mappable into our process.
    if (!createHwSurface(d, w, h))
        return false;

    // create an in-memory linear surface that is used by QWS. QWS will blit directly in here.
    if (!createMemSurface(d, w, h))
        return false;

    // set the address of the in-memory buffer that QWS is blitting to
    data = d->memSurfaceInfo.vaddr;
    // set the line stepping
    lstep = d->memSurfaceInfo.stride;

    // the overall size of the in-memory buffer is linestep * height
    size = mapsize = lstep * h;

    // create a QNX drawing context
    if (!createContext(d))
        return false;

//.........这里部分代码省略.........
开发者ID:jbartolozzi,项目名称:CIS462_HW1,代码行数:101,代码来源:qscreenqnx_qws.cpp

示例6: doOpen

void NBFolderView::doOpen( QModelIndex idx ) {
	/* This slot is triggered when the user double clicks or presses enter */

	Q_UNUSED( idx );
	QList<QModelIndex> selectedList = getSelection();

	foreach( QModelIndex index, selectedList ) {
		QString fileToBeOpened = fsModel->nodePath( index );

		if ( not isReadable( fileToBeOpened ) ) {
			QString title = tr( "Access Error" );
			QString text = tr( "You do not have enough permissions to open <b>%1</b>. " ).arg( baseName( fileToBeOpened ) );
			if ( isDir( fileToBeOpened ) )
				text += tr( "Please change the permissions of the directory to enter it." );

			else
				text += tr( "Please change the permissions of the file to edit/view it." );

			NBMessageDialog::error( this, title, text );
			return;
		}

		if ( isDir( fileToBeOpened ) ) {
			qDebug() << "Opening dir:" << fileToBeOpened.toLocal8Bit().data();
			if ( index == idx ) {
				setCursor( QCursor( Qt::WaitCursor ) );
				fsModel->setRootPath( fileToBeOpened );
				setCursor( QCursor( Qt::ArrowCursor ) );
			}

			else {

				emit newTab( fileToBeOpened );
			}
		}

		else if ( isFile( fileToBeOpened ) ) {
			if ( isExec( fileToBeOpened ) and not isText( fileToBeOpened ) ) {
				/*
					*
					* We make sure that @v fileToBeOpened is really an executable file,
					* i.e it is one of shellscript, install file, or x-exec or x-sharedlib
					* or something of the sort and not a jpg file with exec perms
					*
				*/
				qDebug( "Executing %s... [%s]", fileToBeOpened.toLocal8Bit().data(), ( QProcess::startDetached( fileToBeOpened ) ? "DONE" : " FAILED" ) );

			}

			else {
				NBAppFile app = NBAppEngine::instance()->xdgDefaultApp( mimeDb.mimeTypeForFile( fileToBeOpened ) );
				if ( not app.isValid() )
					doOpenWithCmd();

				QStringList exec = app.execArgs();

				// Prepare @v exec
				if ( app.takesArgs() ) {
					if ( app.multipleArgs() ) {
						int idx = exec.indexOf( "<#NEWBREEZE-ARG-FILES#>" );
						exec.removeAt( idx );
						exec.insert( idx, fileToBeOpened );
					}

					else {
						int idx = exec.indexOf( "<#NEWBREEZE-ARG-FILE#>" );
						exec.removeAt( idx );
						exec.insert( idx, fileToBeOpened );
					}
				}
				else {
					exec << fileToBeOpened;
				}

				qDebug( "Opening file: %s [%s]", fileToBeOpened.toLocal8Bit().data(), ( QProcess::startDetached( exec.takeFirst(), exec ) ? "DONE" : " FAILED" ) );
			}
		}

		else {
			QString title = QString( "Error" );
			QString text = QString( "I really do not have any idea how to open <b>%1</b>." ).arg( index.data().toString() );

			NBMessageDialog::error( this, title, text );

			qDebug() << "Cannot open file:" << fileToBeOpened.toLocal8Bit().data();
			return;
		}
	}
开发者ID:marcusbritanicus,项目名称:NewBreeze,代码行数:88,代码来源:NBFolderView.cpp

示例7: QDialog

SourcesSettingsWindow::SourcesSettingsWindow(Profile *profile, Site *site, QWidget *parent)
	: QDialog(parent), ui(new Ui::SourcesSettingsWindow), m_site(site), m_globalSettings(profile->getSettings())
{
	setAttribute(Qt::WA_DeleteOnClose);
	ui->setupUi(this);

	// Refferers
	ui->lineSiteName->setText(site->setting("name", m_site->url()).toString());
	QStringList referers = QStringList() << "none" << "host" << "page" << "image";
	QStringList referers_preview = QStringList() << "" << "none" << "host" << "page" << "image";
	QStringList referers_image = QStringList() << "" << "none" << "host" << "page" << "details" << "image";
	ui->comboReferer->setCurrentIndex(referers.indexOf(site->setting("referer", "none").toString()));
	ui->comboRefererPreview->setCurrentIndex(referers_preview.indexOf(site->setting("referer_preview", "").toString()));
	ui->comboRefererImage->setCurrentIndex(referers_image.indexOf(site->setting("referer_image", "").toString()));
	ui->spinIgnoreAlways->setValue(site->setting("ignore/always", 0).toInt());
	ui->spinIgnore1->setValue(site->setting("ignore/1", 0).toInt());
	ui->checkSsl->setChecked(site->setting("ssl", false).toBool());

	// Download settings
	ui->spinImagesPerPage->setValue(site->setting("download/imagesperpage", 200).toInt());
	ui->spinSimultaneousDownloads->setValue(site->setting("download/simultaneous", 10).toInt());
	ui->spinThrottleDetails->setValue(site->setting("download/throttle_details", 0).toInt());
	ui->spinThrottleImage->setValue(site->setting("download/throttle_image", 0).toInt());
	ui->spinThrottlePage->setValue(site->setting("download/throttle_page", 0).toInt());
	ui->spinThrottleRetry->setValue(site->setting("download/throttle_retry", 0).toInt());
	ui->spinThrottleThumbnail->setValue(site->setting("download/throttle_thumbnail", 0).toInt());

	// Source order
	ui->checkSourcesDefault->setChecked(site->setting("sources/usedefault", true).toBool());
	QStringList sources = QStringList() << "" << "xml" << "json" << "regex" << "rss";
	ui->comboSources1->setCurrentIndex(sources.indexOf(site->setting("sources/source_1", m_globalSettings->value("source_1", sources[0]).toString()).toString()));
	ui->comboSources2->setCurrentIndex(sources.indexOf(site->setting("sources/source_2", m_globalSettings->value("source_2", sources[1]).toString()).toString()));
	ui->comboSources3->setCurrentIndex(sources.indexOf(site->setting("sources/source_3", m_globalSettings->value("source_3", sources[2]).toString()).toString()));
	ui->comboSources4->setCurrentIndex(sources.indexOf(site->setting("sources/source_4", m_globalSettings->value("source_4", sources[3]).toString()).toString()));

	// Credentials
	ui->lineAuthPseudo->setText(site->setting("auth/pseudo", "").toString());
	ui->lineAuthPassword->setText(site->setting("auth/password", "").toString());

	// Login
	QStringList types = QStringList() << "url" << "get" << "post" << "oauth1" << "oauth2";
	QString defaultType = site->setting("login/parameter", true).toBool() ? "url" : site->setting("login/method", "post").toString();
	QString type = site->setting("login/type", defaultType).toString();
	ui->comboLoginType->setCurrentIndex(types.indexOf(type));
	ui->lineLoginGetUrl->setText(site->setting("login/get/url", type != "get" ? "" : site->setting("login/url", "").toString()).toString());
	ui->lineLoginGetPseudo->setText(site->setting("login/get/pseudo", type != "get" ? "" : site->setting("login/pseudo", "").toString()).toString());
	ui->lineLoginGetPassword->setText(site->setting("login/get/password", type != "get" ? "" : site->setting("login/password", "").toString()).toString());
	ui->lineLoginGetCookie->setText(site->setting("login/get/cookie", type != "get" ? "" : site->setting("login/cookie", "").toString()).toString());
	ui->lineLoginPostUrl->setText(site->setting("login/post/url", type != "post" ? "" : site->setting("login/url", "").toString()).toString());
	ui->lineLoginPostPseudo->setText(site->setting("login/post/pseudo", type != "post" ? "" : site->setting("login/pseudo", "").toString()).toString());
	ui->lineLoginPostPassword->setText(site->setting("login/post/password", type != "post" ? "" : site->setting("login/password", "").toString()).toString());
	ui->lineLoginPostCookie->setText(site->setting("login/post/cookie", type != "post" ? "" : site->setting("login/cookie", "").toString()).toString());
	ui->lineLoginOAuth1RequestTokenUrl->setText(site->setting("login/oauth1/requestTokenUrl", "").toString());
	ui->lineLoginOAuth1AuthorizeUrl->setText(site->setting("login/oauth1/authorizeUrl", "").toString());
	ui->lineLoginOAuth1AccessTokenUrl->setText(site->setting("login/oauth1/accessTokenUrl", "").toString());
	ui->lineLoginOAuth2RequestUrl->setText(site->setting("login/oauth2/requestUrl", "").toString());
	ui->lineLoginOAuth2TokenUrl->setText(site->setting("login/oauth2/tokenUrl", "").toString());
	ui->lineLoginOAuth2RefreshTokenUrl->setText(site->setting("login/oauth2/refreshTokenUrl", "").toString());
	ui->lineLoginOAuth2Scope->setText(site->setting("login/oauth2/scope", "").toString());
	ui->spinLoginMaxPage->setValue(site->setting("login/maxPage", 0).toInt());

	// Hide hash if unncessary
	if (site->getApis().first()->value("PasswordSalt").isEmpty())
	{ ui->buttonAuthHash->hide(); }
	else
	{ ui->lineAuthPassword->setEchoMode(QLineEdit::Normal); }

	// Cookies
	QList<QNetworkCookie> cookies = site->cookies();
	ui->tableCookies->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
	ui->tableCookies->setRowCount(cookies.count());
	int row = 0;
	for (const QNetworkCookie &cookie : site->cookies())
	{
		ui->tableCookies->setItem(row, 0, new QTableWidgetItem(QString(cookie.name())));
		ui->tableCookies->setItem(row, 1, new QTableWidgetItem(QString(cookie.value())));
		row++;
	}

	// Headers
	QMap<QString, QVariant> headers = site->setting("headers").toMap();
	ui->tableHeaders->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
	ui->tableHeaders->setRowCount(headers.count());
	int headerRow = 0;
	QMapIterator<QString, QVariant> i(headers);
	while (i.hasNext())
	{
		i.next();
		ui->tableHeaders->setItem(headerRow, 0, new QTableWidgetItem(i.key()));
		ui->tableHeaders->setItem(headerRow, 1, new QTableWidgetItem(i.value().toString()));
		headerRow++;
	}

	// Hide login testing buttons if we can't tests this site's login
	if (!m_site->canTestLogin())
	{
		ui->widgetTestCredentials->hide();
		ui->widgetTestLogin->hide();
	}

//.........这里部分代码省略.........
开发者ID:cubbu,项目名称:imgbrd-grabber,代码行数:101,代码来源:sourcessettingswindow.cpp

示例8: main

int main(int argc, char *argv[])
{
	QApplication app(argc, argv);
	QStringList args = app.arguments();

	if (args.count() < 2) {
		printUsage();
		return 1;
	}

	QString configPath = "./";
	if (app.arguments().contains("-c")) {
		int const index = app.arguments().indexOf("-c");
		if (app.arguments().count() <= index + 1) {
			printUsage();
			return 1;
		}

		configPath = app.arguments()[index + 1];
		if (configPath.right(1) != "/") {
			configPath += "/";
		}
	}

	QString startDirPath = QDir::currentPath();
	if (app.arguments().contains("-d")) {
		int const index = app.arguments().indexOf("-d");
		if (app.arguments().count() <= index + 1) {
			printUsage();
			return 1;
		}

		startDirPath = app.arguments()[index + 1];
	}

	if (startDirPath.right(1) != "/") {
		startDirPath += "/";
	}

#ifdef Q_WS_QWS
	QWSServer * const server = QWSServer::instance();
	if (server) {
		server->setCursorVisible(false);
	}
#endif

	trikControl::Brick brick(*app.thread(), configPath, startDirPath);

	trikScriptRunner::TrikScriptRunner runner(brick, startDirPath);
	QObject::connect(&runner, SIGNAL(completed(QString)), &app, SLOT(quit()));

	if (app.arguments().contains("-s")) {
		runner.run(args[app.arguments().indexOf("-s") + 1]);
	} else {
		args.removeAll("-qws");
		if (args.contains("-c")) {
			args.removeAt(args.indexOf("-c") + 1);
			args.removeAll("-c");
		}

		if (args.contains("-d")) {
			args.removeAt(args.indexOf("-d") + 1);
			args.removeAll("-d");
		}

		if (args.count() != 2) {
			printUsage();
			return 1;
		}

		runner.run(trikKernel::FileUtils::readFromFile(args[1]));
	}

	return app.exec();
}
开发者ID:Anna-,项目名称:trikRuntime,代码行数:75,代码来源:main.cpp

示例9: main

int main(int argc, char *argv[])
{
    // Qt initialisation
    QApplication a(argc, argv);

#ifdef Q_OS_LINUX
    setup_unix_signal_handlers();
#endif

    QStringList pathlist = QCoreApplication::libraryPaths();
    qDebug() << pathlist;
#if QT_VERSION >= 0x050000
    // Fixing the qt5 plugin mess
    pathlist << ".";
    QCoreApplication::setLibraryPaths(pathlist);
#endif

    // Creating the QT log file

    QDir homeDir = QDir::home();
    if (!homeDir.cd(Pip3lineConst::USER_DIRECTORY)) {
        if (!homeDir.mkpath(Pip3lineConst::USER_DIRECTORY)) {
            qWarning("Cannot create user directory for log file");
        }
    }

    homeDir = QDir::home();
    if (homeDir.cd(Pip3lineConst::USER_DIRECTORY)) {
        QByteArray logdir = homeDir.absolutePath().append(QDir::separator()).append("pip3line_gui.log").toLocal8Bit();
#ifdef Q_CC_MSVC
#define BUFFERSIZE 200

        char buffer[BUFFERSIZE];
        memset((void *)buffer, 0, BUFFERSIZE);

        errno_t err = fopen_s (&_logFile, logdir.constData(),"w");
        if ( err != 0) {
            strerror_s(buffer, BUFFERSIZE, err);
            qWarning( buffer );
#else
        _logFile = fopen (logdir.constData(),"w");

        if (_logFile == NULL) {
            qWarning("Cannot open log file for writing");
#endif
        } else {
#if QT_VERSION >= 0x050000
            qInstallMessageHandler(myMessageOutput);
#else
            qInstallMsgHandler(myMessageOutput);
#endif
        }
    }


#if QT_VERSION >= 0x050000
    // forcing style for Qt5. can be overwritten at runtime
    // with the option -style [style name]
    // An indicative list of available themes is given in the Help->info dialog
    QStringList stylelist = QStyleFactory::keys();
    if (stylelist.contains("Fusion"))
        QApplication::setStyle("Fusion");
#ifdef Q_OS_WIN
    else if (stylelist.contains("WindowsVista"))
        QApplication::setStyle("WindowsVista");
    else if (stylelist.contains("WindowsXP"))
        QApplication::setStyle("WindowsXP");
#endif

#endif

    a.setStyleSheet("QWidget{ selection-background-color: blue}");
    qDebug() << "App started";
    QStyle *currentStyle = QApplication::style();
    qDebug() << "Style" << currentStyle << currentStyle->objectName();

    // Cleaning the PATH on Windows to avoid library corruption whenever loading plugins
    qputenv("PATH", QByteArray());

#ifdef Q_OS_UNIX
    qputenv("LD_PRELOAD", QByteArray());

#endif

    QStringList list = QApplication::arguments();

    bool debugging =  false;
    if (list.contains(DEBUG_CMD)) {
        debugging = true;
        list.removeAll(DEBUG_CMD);
    }

    QString fileName;
    if (list.contains(FILE_CMD)) {
        int index = list.indexOf(FILE_CMD);
        if (list.size() > index + 1) {
            fileName = list.at(index + 1);
            list.removeAt(index);
            list.removeAt(index);
        } else {
//.........这里部分代码省略.........
开发者ID:nccgroup,项目名称:pip3line,代码行数:101,代码来源:main.cpp

示例10: parseFromFountain

void Script::parseFromFountain(const QString& script)
{
    QStringList lines = script.split("\n");
    QString text;
    QRegExp regAlphaNumeric("[A-Z]|[a-z]|[0-9]*");
    QStringList validStartHeaders;
    validStartHeaders << "INT" << "EXT" << "EST" << "INT./EXT" << "INT/EXT" << "I/E";

    quint32 blockcount = lines.size();
    quint32 i = 0;

    qDeleteAll(m_content);
    m_content.clear();

    m_titlepage.clear();

    quint8 currentBlockType = BLOCK_MAIN;
    QList<Block *> *blocklist = &m_content;

    while (i < blockcount) {
        text = lines.at(i).trimmed();

        if (text.left(2) == "/*") { //Boneyard
            Boneyard *block = new Boneyard();

            while (++i < blockcount && lines.at(i).trimmed() != "*/") {
                block->addLine(lines.at(i));
            }

            blocklist->append(block);
        } else if (text.left(1) == "!") { //Forced action
            text = lines.at(i);
            text.remove(text.indexOf("!"), 1);
            text.replace("\t", "    ");

            blocklist->append(new Action(text));
        } else if (text.left(3) == "===") { //Page breaks
            blocklist->append(new PageBreak());
        } else if (text.left(2) == "= ") { //Synopses
            blocklist->append(new Synopsis(text.mid(2)));
        } else if (text.left(1) == "~") { //Lyrics
            blocklist->append(new Lyrics(text.mid(1)));
        } else if (text.left(6) == "Title:") { //Title
            TitlePageElement *title = new Title(text.mid(6).trimmed());
            parseTitlePageData(i, lines, title);
            m_titlepage.addElement(title);
        } else if (text.left(7) == "Credit:") { //Credit
            TitlePageElement *credit = new Credit(text.mid(7).trimmed());
            parseTitlePageData(i, lines, credit);
            m_titlepage.addElement(credit);
        } else if (text.left(7) == "Author:") { //Author
            TitlePageElement *author = new Author(text.mid(7).trimmed());
            parseTitlePageData(i, lines, author);
            m_titlepage.addElement(author);
        } else if (text.left(7) == "Source:") { //Source
            TitlePageElement *source = new Source(text.mid(7).trimmed());
            parseTitlePageData(i, lines, source);
            m_titlepage.addElement(source);
        } else if (text.left(11) == "Draft date:") { //Draft date
            TitlePageElement *draftDate = new DraftDate(text.mid(11).trimmed());
            parseTitlePageData(i, lines, draftDate);
            m_titlepage.addElement(draftDate);
        } else if (text.left(8) == "Contact:") { //Contact
            TitlePageElement *contact = new Contact(text.mid(8).trimmed());
            parseTitlePageData(i, lines, contact);
            m_titlepage.addElement(contact);
        } else if (text.left(4) == "### ") { //Scene Section
            SceneSection *scenesection = new SceneSection(text.mid(4));

            if (currentBlockType & (BLOCK_SCENE | BLOCK_SCENESECTION)) {
                Act *act = dynamic_cast<Act*>(m_content.last());

                if (act != nullptr) {
                    if (act->getList()->size() > 0) {
                        Sequence *sequence = dynamic_cast<Sequence*>(act->getList()->last());

                        if (sequence != nullptr) {
                            sequence->addBlock(scenesection);
                        } else {
                            act->addBlock(scenesection);
                        }
                    } else {
                        act->addBlock(scenesection);
                    }
                } else {
                    Sequence *sequence = dynamic_cast<Sequence*>(m_content.last());

                    if (sequence != nullptr) {
                        sequence->addBlock(scenesection);
                    } else {
                        m_content.append(scenesection);
                    }
                }
            } else {
                blocklist->append(scenesection);
            }

            blocklist = scenesection->getList();
            currentBlockType = BLOCK_SCENESECTION;
        } else if (text.left(3) == "## ") { //Sequence
//.........这里部分代码省略.........
开发者ID:Aztorius,项目名称:magicfountain,代码行数:101,代码来源:script.cpp

示例11: main

int main(int argc, char *argv[])
{
#ifdef Q_OS_MAC
	// QTBUG-32789 - GUI widgets use the wrong font on OS X Mavericks
	QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
#endif

	SingleApplication theApp( argc, argv );

	if(!theApp.shouldContinue())return 0;

	QStringList args = theApp.arguments();

	QUrl proxy;
	int index = args.indexOf("-proxy");
	if ( index != -1 )
		proxy = QUrl( args.value(index + 1) );
	else
		proxy = QUrl( qgetenv( "http_proxy" ) );
	if ( !proxy.isEmpty() )
		setApplicationProxy( proxy );

	QByteArray encoding;
	index = args.indexOf( "-encoding" );
	if ( index != -1 )
		encoding = args.value( index + 1 ).toLocal8Bit();
	else if ( !qgetenv( "COMMUNI_ENCODING" ).isEmpty())
		encoding = qgetenv( "COMMUNI_ENCODING" );
	if ( !encoding.isEmpty() )
		SingleApplication::setEncoding( encoding );


// To enable this, run qmake with "DEFINES+=_SNAPSHOT_BUILD"
#ifdef _SNAPSHOT_BUILD
	QDate oExpire = QDate::fromString( Version::BUILD_DATE, Qt::ISODate ).addDays( 60 );

	if( QDate::currentDate() > oExpire )
	{
		QMessageBox::information( NULL,
								  QObject::tr( "Cool Software, but..." ),
								  QObject::tr( "This build is expired. If you wish to continue using this "
											   "Cool Software you must download either latest stable releas"
											   "e or latest snapshot build from http://quazaa.sf.net/.\n\n"
											   "The program will now terminate." ) );
		return 0;
	}

	if( !args.contains("--no-alpha-warning") )
	{
		int ret = QMessageBox::warning( NULL,
										QObject::tr("Snapshot/Debug Build Warning"),
										QObject::tr("WARNING: This is a SNAPSHOT BUILD of Quazaa. \n"
													"It is NOT meant for GENERAL USE, and is only for testi"
													"ng specific features in a controlled environment.\n"
													"It will frequently stop running, or will display debug"
													"information to assist testing.\n"
													"This build will expire on %1.\n\n"
													"Do you wish to continue?"
													).arg( oExpire.toString( Qt::SystemLocaleLongDate ) ),
									   QMessageBox::Yes | QMessageBox::No );
		if( ret == QMessageBox::No )
			return 0;
	}
#endif

	qsrand( time( 0 ) );

#ifdef Q_OS_LINUX

	rlimit sLimit;
	memset( &sLimit, 0, sizeof( rlimit ) );
	getrlimit( RLIMIT_NOFILE, &sLimit );

	sLimit.rlim_cur = sLimit.rlim_max;

	if( setrlimit( RLIMIT_NOFILE, &sLimit ) == 0 )
	{
		qDebug() << "Successfully raised resource limits";
	}
	else
	{
		qDebug() << "Cannot set resource limits";
	}

#endif // Q_OS_LINUX

	theApp.setApplicationName(    CQuazaaGlobals::APPLICATION_NAME() );
	theApp.setApplicationVersion( CQuazaaGlobals::APPLICATION_VERSION_STRING() );
	theApp.setOrganizationDomain( CQuazaaGlobals::APPLICATION_ORGANIZATION_DOMAIN() );
	theApp.setOrganizationName(   CQuazaaGlobals::APPLICATION_ORGANIZATION_NAME() );
	theApp.setApplicationSlogan( QObject::tr("World class file sharing.") );

	QIcon icon;
	icon.addFile( ":/Resource/Quazaa16.png" );
	icon.addFile( ":/Resource/Quazaa24.png" );
	icon.addFile( ":/Resource/Quazaa32.png" );
	icon.addFile( ":/Resource/Quazaa48.png" );
	icon.addFile( ":/Resource/Quazaa64.png" );
	icon.addFile( ":/Resource/Quazaa128.png" );
	qApp->setWindowIcon( icon );
//.........这里部分代码省略.........
开发者ID:c3c,项目名称:quazaa,代码行数:101,代码来源:main.cpp

示例12: main

int main(int argc, char *argv[])
{

    static const QString APP_DESCRIPTION = QString("Application to help plan,")
            + QString(" organize, and write a novel."),
        ARG_NOVEL = "novel",
        DESC_NOVEL = "Path to a Plotline novel project.",

            T_NOVEL="novel",
            T_CHARACTER="character",
            T_PLOTLINE="plotline",
            T_SCENE="scene",
            T_CHAPTER="chapter";

    static const QStringList TABS({T_NOVEL, T_CHARACTER, T_PLOTLINE, T_SCENE,
                                  T_CHAPTER});

    static int POS_NOVEL = 0;

    QApplication a(argc, argv);

    // Set the parser.
    QCommandLineParser parser;
    parser.setApplicationDescription(APP_DESCRIPTION);
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addPositionalArgument(ARG_NOVEL, DESC_NOVEL, "[novel]");

    QCommandLineOption tab = QCommandLineOption(
        {"t", "tab"},
        "Open selected tab (novel, character, plotline, scene, chapter)",
        T_NOVEL
    );
    parser.addOption(tab);

    parser.process(a);

    // Set app information for settings.
    QCoreApplication::setOrganizationName("Renegade Engineer");
    QCoreApplication::setOrganizationDomain("rngr.me");
    QCoreApplication::setApplicationName("Plotline");

    // Get the positional arguments

    QStringList posArgs = parser.positionalArguments();
    QString novelPath;
    if (POS_NOVEL < posArgs.length())
        novelPath = posArgs[POS_NOVEL];

    QString tabName = parser.value("tab");
    if (tabName.isEmpty()) tabName = parser.value("t");
    if (tabName.isEmpty()) tabName = T_NOVEL;

    // Get the correct tab.
    if (0 > TABS.indexOf(tabName)){
        qCritical() << "Invalid tab name:" << tabName;
        return 1;
    }

    MainWindow w;
    w.show();

    if (!novelPath.isNull()){
        w.openNovel(novelPath);
    }

    w.openTab(TABS.indexOf(tabName));
    return a.exec();
}
开发者ID:freckles-the-pirate,项目名称:plotline,代码行数:69,代码来源:main.cpp

示例13: QDialog

/*
 *  Constructs a SectionEditor as a child of 'parent'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal dialog.
 */
KReportSectionEditor::KReportSectionEditor(KReportDesigner* designer)
  : QDialog(designer)
{
    Q_ASSERT(designer);
    m_reportDesigner = designer;
    m_reportSectionDetail = m_reportDesigner->detailSection();

    //! @todo check section editor
    //setButtons(Close);
    //setCaption(tr("Section Editor"));

    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
    QVBoxLayout* mainLayout = new QVBoxLayout(this);
    QPushButton* closeButton = buttonBox->button(QDialogButtonBox::Close);

    closeButton->setDefault(true);
    closeButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(accept()));

    QWidget *widget = new QWidget(this);
    m_ui.setupUi(widget);
    m_btnAdd = new QPushButton(QIcon::fromTheme(QLatin1String("list-add")), tr("Add..."), this);
    m_ui.lGroupSectionsButtons->addWidget(m_btnAdd);
    m_btnEdit = new QPushButton(QIcon::fromTheme(QLatin1String("document-edit")), tr("Edit..."), this);
    m_ui.lGroupSectionsButtons->addWidget(m_btnEdit);
    m_btnRemove = new QPushButton(QIcon::fromTheme(QLatin1String("list-remove")), tr("Delete"), this);
    m_ui.lGroupSectionsButtons->addWidget(m_btnRemove);
    m_btnMoveUp = new QPushButton(QIcon::fromTheme(QLatin1String("arrow-up")), tr("Move Up"), this);
    m_ui.lGroupSectionsButtons->addWidget(m_btnMoveUp);
    m_btnMoveDown = new QPushButton(QIcon::fromTheme(QLatin1String("arrow-down")), tr("Move Down"), this);
    m_ui.lGroupSectionsButtons->addWidget(m_btnMoveDown);
    m_ui.lGroupSectionsButtons->addStretch();

    mainLayout->addWidget(widget);
    mainLayout->addWidget(buttonBox);

    //setMainWidget(widget);

    // signals and slots connections
    connect(m_ui.cbReportHeader, SIGNAL(toggled(bool)), this, SLOT(cbReportHeader_toggled(bool)));
    connect(m_ui.cbReportFooter, SIGNAL(toggled(bool)), this, SLOT(cbReportFooter_toggled(bool)));
    connect(m_ui.cbHeadFirst, SIGNAL(toggled(bool)), this, SLOT(cbHeadFirst_toggled(bool)));
    connect(m_ui.cbHeadLast, SIGNAL(toggled(bool)), this, SLOT(cbHeadLast_toggled(bool)));
    connect(m_ui.cbHeadEven, SIGNAL(toggled(bool)), this, SLOT(cbHeadEven_toggled(bool)));
    connect(m_ui.cbHeadOdd, SIGNAL(toggled(bool)), this, SLOT(cbHeadOdd_toggled(bool)));
    connect(m_ui.cbFootFirst, SIGNAL(toggled(bool)), this, SLOT(cbFootFirst_toggled(bool)));
    connect(m_ui.cbFootLast, SIGNAL(toggled(bool)), this, SLOT(cbFootLast_toggled(bool)));
    connect(m_ui.cbFootEven, SIGNAL(toggled(bool)), this, SLOT(cbFootEven_toggled(bool)));
    connect(m_ui.cbFootOdd, SIGNAL(toggled(bool)), this, SLOT(cbFootOdd_toggled(bool)));
    connect(m_ui.cbHeadAny, SIGNAL(toggled(bool)), this, SLOT(cbHeadAny_toggled(bool)));
    connect(m_ui.cbFootAny, SIGNAL(toggled(bool)), this, SLOT(cbFootAny_toggled(bool)));
    connect(m_ui.lbGroups, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
            this, SLOT(updateButtonsForItem(QListWidgetItem*)));
    connect(m_ui.lbGroups, SIGNAL(currentRowChanged(int)),
            this, SLOT(updateButtonsForRow(int)));

    connect(m_btnAdd, SIGNAL(clicked(bool)), this, SLOT(btnAdd_clicked()));
    connect(m_btnEdit, SIGNAL(clicked(bool)), this, SLOT(btnEdit_clicked()));
    connect(m_btnRemove, SIGNAL(clicked(bool)), this, SLOT(btnRemove_clicked()));
    connect(m_btnMoveUp, SIGNAL(clicked(bool)), this, SLOT(btnMoveUp_clicked()));
    connect(m_btnMoveDown, SIGNAL(clicked(bool)), this, SLOT(brnMoveDown_clicked()));

    // set all the properties

    m_ui.cbReportHeader->setChecked(m_reportDesigner->section(KReportSectionData::ReportHeader));
    m_ui.cbReportFooter->setChecked(m_reportDesigner->section(KReportSectionData::ReportFooter));

    m_ui.cbHeadFirst->setChecked(m_reportDesigner->section(KReportSectionData::PageHeaderFirst));
    m_ui.cbHeadOdd->setChecked(m_reportDesigner->section(KReportSectionData::PageHeaderOdd));
    m_ui.cbHeadEven->setChecked(m_reportDesigner->section(KReportSectionData::PageHeaderEven));
    m_ui.cbHeadLast->setChecked(m_reportDesigner->section(KReportSectionData::PageHeaderLast));
    m_ui.cbHeadAny->setChecked(m_reportDesigner->section(KReportSectionData::PageHeaderAny));

    m_ui.cbFootFirst->setChecked(m_reportDesigner->section(KReportSectionData::PageFooterFirst));
    m_ui.cbFootOdd->setChecked(m_reportDesigner->section(KReportSectionData::PageFooterOdd));
    m_ui.cbFootEven->setChecked(m_reportDesigner->section(KReportSectionData::PageFooterEven));
    m_ui.cbFootLast->setChecked(m_reportDesigner->section(KReportSectionData::PageFooterLast));
    m_ui.cbFootAny->setChecked(m_reportDesigner->section(KReportSectionData::PageFooterAny));

    // now set the rw value
    if (m_reportSectionDetail) {
        const QStringList columnNames = m_reportDesigner->fieldNames();
        const QStringList keys = m_reportDesigner->fieldKeys();
        for (int i = 0; i < m_reportSectionDetail->groupSectionCount(); ++i) {
            const QString key = m_reportSectionDetail->groupSection(i)->column();
            const int idx = keys.indexOf(key);
            const QString columnName = columnNames.value(idx);
            QListWidgetItem *item = new QListWidgetItem(columnName);
            item->setData(KeyRole, key);
            m_ui.lbGroups->addItem(item);
        }
    }
    if (m_ui.lbGroups->count() == 0) {
    } else {
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:kreport,代码行数:101,代码来源:KReportSectionEditor.cpp

示例14: columnName

QString KReportSectionEditor::columnName(const QString &column) const
{
    const QStringList keys = m_reportDesigner->fieldKeys();
    const QStringList columnNames = m_reportDesigner->fieldNames();
    return columnNames.at(keys.indexOf(column));
}
开发者ID:KDE,项目名称:kreport,代码行数:6,代码来源:KReportSectionEditor.cpp

示例15: generateTLTypeDefinition

QString GeneratorNG::generateTLTypeDefinition(const TLType &type)
{
    QString code;

    code.append(QString("struct %1 {\n").arg(type.name));

//    QString anotherName = removePrefix(type.name);
//    anotherName[0] = anotherName.at(0).toUpper();
//    anotherName.prepend(QLatin1String("another"));

    QString constructor = spacing + QString("%1() :\n").arg(type.name);
//    QString copyConstructor = spacing + QString("%1(const %1 &%2) :\n").arg(type.name).arg(anotherName);
//    QString copyOperator = spacing + QString("%1 &operator=(const %1 &%2) {\n").arg(type.name).arg(anotherName);
    QString membersCode;

    QStringList addedMembers;
    foreach (const TLSubType &subType, type.subTypes) {
        foreach (const TLParam &member, subType.members) {
            if (addedMembers.contains(member.name)) {
                continue;
            }

            addedMembers.append(member.name);

//            copyConstructor += QString("%1%2(%3.%2),\n").arg(doubleSpacing).arg(member.name).arg(anotherName);
//            copyOperator += QString("%1%2 = %3.%2;\n").arg(doubleSpacing).arg(member.name).arg(anotherName);

            membersCode.append(QString("%1%2 %3;\n").arg(spacing).arg(member.type).arg(member.name));

            if (!podTypes.contains(member.type)) {
                continue;
            }

            const QString initialValue = initTypesValues.at(podTypes.indexOf(member.type));
            constructor += QString("%1%2(%3),\n").arg(doubleSpacing).arg(member.name).arg(initialValue);
        }
    }

    constructor += QString("%1%2(%3::%4),\n").arg(doubleSpacing).arg(tlTypeMember).arg(tlValueName).arg(type.subTypes.first().name);
//    copyConstructor += QString("%1%2(%3.%2),\n").arg(doubleSpacing).arg(tlTypeMember).arg(anotherName);
//    copyOperator += QString("%1%2 = %3.%2;\n").arg(doubleSpacing).arg(tlTypeMember).arg(anotherName);
    membersCode.append(QString("%1%2 %3;\n").arg(spacing).arg(tlValueName).arg(tlTypeMember));

    constructor.chop(2);
    constructor.append(QLatin1String(" { }\n\n"));

//    copyConstructor.chop(2);
//    copyConstructor.append(QLatin1String(" { }\n\n"));

//    copyOperator.append(QString("\n%1%1return *this;\n%1}\n").arg(spacing));

    code.append(constructor);
//    code.append(copyConstructor);
//    code.append(copyOperator);

//    code.append(QLatin1Char('\n'));
    code.append(membersCode);

    code.append(QString("};\n\n"));

    return code;
}
开发者ID:jsfdez,项目名称:telegram-qt,代码行数:62,代码来源:GeneratorNG.cpp


注:本文中的QStringList::indexOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。