コード例 #1
0
ファイル: ViewletView.cpp プロジェクト: CAARNICL/gnucash
void
ViewletView::loadAccountsTreeComboBox(AccountListModel * const m_accountsListModel)
{
    accountsList = m_accountsListModel;
    comboAccountsList->setModel(accountsList);
    Q_EMIT fileLoaded();
}
コード例 #2
0
bool XlinkPreview::connect()
{
    if((_connected = xlink_ping())) {
        fileLoaded();
        emit previewConnected();
    }
    return _connected;
}
コード例 #3
0
ファイル: qmlselectgroup.cpp プロジェクト: iStelmuhov/table
void QmlSelectGroup::loadList()
{
    downloader = new QDownloader;
    connect(downloader,SIGNAL(fileCreated()),this,SLOT(fileLoaded()));
    downloader->setFileName("get_schem.json");
    downloader->setUrl(rootUrl+"/get_faculties");
    downloader->startDownload();
}
コード例 #4
0
ファイル: calcscreen.cpp プロジェクト: labsin/TilEm-Qml
void CalcScreen::setCalc(Calc *arg)
{
    if (m_calc != arg) {
        delete m_calc;
        m_calc = arg;
        connect(m_calc, SIGNAL(loaded()), this, SLOT( fileLoaded() ));
        connect(m_calc, SIGNAL(beginLoad()), this, SLOT( beforeFileLoaded() ));
        emit calcChanged(arg);
    }
}
コード例 #5
0
ファイル: toerstein.cpp プロジェクト: Toerstein/Toerstein
Toerstein::Toerstein(QWidget *parent) : QMainWindow(parent)
{
    toersteBase = new ToersteBase(this);
    toerstelliSense = new ToerstelliSense(this,toersteBase);

    connect(this,SIGNAL(fileLoaded(QString)),toerstelliSense->worker(),SLOT(indexFile(QString)));

    createMenuBar();
    createShortcuts();

    /* Create tab view */
    tabView = new TabView(this);
    tabView->setTabsClosable(true);
    setCentralWidget(tabView);

    connect(tabView,SIGNAL(tabCloseRequested(int)),this,SLOT(closeTab(int)));

    QCommandLineOption diffMode(QStringList() << "d" << "diff");
    QCommandLineParser parser;

    parser.addOption(diffMode);
    parser.process(QCoreApplication::arguments());

    const QStringList args = parser.positionalArguments();

    if ( args.length() > 0 )
    {
        if ( parser.isSet(diffMode) )
        {
            createNewFile();

            if ( args.length() > 1 )
            {
                open(args.at(0), args.at(1));
            }
            else
            {
                open(args.at(0));
            }
        }
        else
        {
            for(int i=0; i < args.length(); i++)
            {
                createNewFile();
                open(args.at(i));
            }
        }
    }
    else
    {
        createNewFile();
    }
}
コード例 #6
0
void PatternManager::fileLoadFinished()
{
    qDebug("file loaded signal");
    //QProgressBar* watcher2 = qobject_cast<QProgressBar*>(QObject::sender());
    QFutureWatcher<cv::Mat*>* watcher = static_cast<QFutureWatcher<cv::Mat*>*>(QObject::sender());
    this->m_originalPatterns.push_back(watcher->result());
    //Do I need to delete the watcher now???
    delete watcher;
    emit fileLoaded(this->m_originalPatterns.size());
    if(this->m_originalPatterns.size() == patternSetSize) {
        emit originalPatternsLoaded();
    }
}
コード例 #7
0
ファイル: filewatcher.cpp プロジェクト: ForNeVeR/leechcraft
	FileWatcher::FileWatcher (DocumentTab *tab)
	: QObject (tab)
	, Tab_ (tab)
	, IsScheduled_ (false)
	{
		connect (tab,
				SIGNAL (fileLoaded (QString)),
				this,
				SLOT (setWatched (QString)));

		connect (&Watcher_,
				SIGNAL (fileChanged (QString)),
				this,
				SLOT (handleFileChanged (QString)));
	}
コード例 #8
0
void FileLoader::loadFiles(QStringList fileNames)
{
    qDebug() << "FileLoader::loadFiles start";

    Q_ASSERT(!fileNames.isEmpty());

    for (int i = 0; i < fileNames.size(); i++){
        qDebug () << fileNames[i];


        // read the CSV data
        QFile file(fileNames[i]);

        // open the file
        if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){
            qDebug() << "failed to open input file";
        } else {

            qDebug() << "reading file... " << fileNames[i];

            QStringList lstEntries;

            while (!file.atEnd()){
                QString line = QString::fromUtf8(file.readLine().constData());
                lstEntries.append(line);
            }

            qDebug() << lstEntries.size() << " entries";

            QString collectionName = fileNames[i];
            collectionName = collectionName.mid(collectionName.lastIndexOf("/") + 1);
            collectionName = collectionName.left(collectionName.size() - 4);
            FlashCards* flashCards = new FlashCards(lstEntries, fileNames[i], collectionName, this);

            // add the entries
            m_lstFlashCards.append(flashCards);

            // close the file
            file.close();
        }
    }

    emit fileLoaded(this);

    qDebug() << "FileLoader::loadFiles end";
}
コード例 #9
0
ファイル: ViewletView.cpp プロジェクト: CAARNICL/gnucash
void
ViewletView::leftVSet(QWidget *parent, QHBoxLayout *FPOLayout)
{
    connect(this, SIGNAL(fileLoaded()),
            this, SLOT(leftVLoad()));

    //connect(comboAccountsList, SIGNAL(currentIndexChanged(int)),
          //  this, SLOT(leftVUpdate()));

    //not required. remove after cleaning loadAccountsTreeComboBox()
    comboAccountsList = new QComboBox();
    comboAccountsList->addItem(tr("-NA-"));


    QWidget *viewletContainer = new QWidget;
    FPOLayout->addWidget(viewletContainer);

    QVBoxLayout *vLay = new QVBoxLayout;
    viewletContainer->setLayout(vLay);

    QLabel *title = new QLabel(tr("Expense"));
    vLay->addWidget(title);

    /* The actual viewlet display of account(s) chosen*/
    QWidget *defaultViewletWidget = new QWidget();
    defaultVLayout = new QVBoxLayout();
    QScrollArea *viewletScrollArea = new QScrollArea();

    viewletScrollArea->setWidget(defaultViewletWidget);
    viewletScrollArea->setAlignment(Qt::AlignLeft);
    viewletScrollArea->setWidgetResizable(true);
    defaultViewletWidget->setLayout(defaultVLayout);
    vLay->addWidget(viewletScrollArea);

    /*//create viewlet
    if(comboAccountsList->currentIndex())
    {
        selectedAccountIndex = comboAccountsList->currentIndex();
        selectedAccount = accountsList->at(selectedAccountIndex);

        defaultVDraw();
    }*/

}
コード例 #10
0
ファイル: state.cpp プロジェクト: gitter-badger/vchar64
void State::importCharset(const QString& filename, const quint8 *charset, int charsetSize)
{
    Q_ASSERT(charset);
    Q_ASSERT(charsetSize <= CHAR_BUFFER_SIZE);

    resetCharsetBuffer();
    memcpy(_charset, charset, qMin(CHAR_BUFFER_SIZE, charsetSize));

    _undoStack->clear();

    // if a new file is loaded, then reset the exported and saved values
    _savedFilename = "";
    _exportedFilename = "";
    _exportedAddress = -1;
    _loadedFilename = filename;

    emit fileLoaded();
    emit contentsChanged();
}
コード例 #11
0
void HdrCreationManager::newResult(int index, float expotime, QString newfname) {
	runningThreads--;
	processedFiles++;

	//update filesToRemove
	if ( fileList.at(index) != newfname )
		filesToRemove.append(newfname);

	//update expotimes[i]
	expotimes[index]=expotime;

	QFileInfo qfi(fileList[index]);
	//check for invalid exif: update list that will be sent once all is over.
	if (expotimes[index]==-1) {
		filesLackingExif << "<li>"+qfi.fileName()+"</li>";
		//qDebug("HCM: new invalid exif. elements: %d", filesLackingExif.size());
	}

	emit fileLoaded(index,fileList[index],expotimes[index]);
}
コード例 #12
0
ファイル: toerstein.cpp プロジェクト: Toerstein/Toerstein
void Toerstein::setRightFilePath(const QString &path)
{
    ToolArea* toolArea = qobject_cast<ToolArea *>(sender());

    qDebug() << "Toerstein: Right filepath set to" << path;

    int tabIndex = tabView->indexOf(toolArea);

    if ( tabIndex >= 0 )
    {
        if ( path.isEmpty() )
        {
            tabView->setTabText(tabIndex,"New tab");
        }
        else
        {
            tabView->setTabText(tabIndex,QFileInfo(path).fileName());
            emit fileLoaded(path);
        }
    }
}
コード例 #13
0
ファイル: state.cpp プロジェクト: gitter-badger/vchar64
void State::reset()
{
    _totalChars = 0;
    _multicolorMode = false;
    _selectedPen = 3;
    _penColors[0] = 1;
    _penColors[1] = 12;
    _penColors[2] = 15;
    _penColors[3] = 0;
    _tileProperties.size = {1,1};
    _tileProperties.interleaved = 1;
    _loadedFilename = "";
    _savedFilename = "";
    _exportedFilename = "";
    _exportedAddress = -1;

    memset(_charset, 0, sizeof(_charset));

    _undoStack->clear();

    emit fileLoaded();
    emit contentsChanged();
}
コード例 #14
0
ファイル: TableMainWindow.cpp プロジェクト: assutech/isis3
  /** 
   * This method loads a text file into the table.
   * 
   */
  void TableMainWindow::loadTable () {
    QString fn = QFileDialog::getOpenFileName((QWidget*)parent(),
                                            "Select file to load",
                                            ".",
                                            "Text Files (*.txt)");

    //If the user cancelled or the filename is empty return
    if (fn.isEmpty()) return;

    p_currentFile.setFileName( fn );
    p_save->setEnabled(true);

    bool success = p_currentFile.open(QIODevice::ReadOnly);
    if(!success) {
      QMessageBox::critical((QWidget *)parent(),
                   "Error", "Cannot open file, please check permissions");
      p_currentFile.setFileName("");
      p_save->setDisabled(true);
      return;
    }

    clearTable();

    QList<int> column = QList<int>();

    //Set all headers to be hidden
    for (int i=0; i < p_listWidget->count() ; i++) {
      p_listWidget->item(i)->setCheckState(Qt::Unchecked);
    }

    // Strip headers off the table into the temp string
    QString temp = p_currentFile.readLine();
    temp.remove("Positive ");
    temp.remove("\"");
    temp.remove("\n");
    QStringList list = temp.split(",");

    // Loop through checking header names and setting relevant columns visible
    for (int i = 0; i < list.count(); i++) { 
      for(int j = 0; j < p_itemList.size(); j++){

        //Special cases
        if(p_itemList[j]->text() == "Ground Range" && (list[i] == "Start Latitude" || list[i] == "Start Longitude" ||
                                                       list[i] == "End Latitude" || list[i] == "End Longitude")) {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "Pixel Range" && (list[i] == "Start Sample" || list[i] == "Start Line" ||
                                                       list[i] == "End Sample" || list[i] == "End Line")) {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "Pixel Range" && (list[i] == "Sample" || list[i] == "Line")) {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "Sample:Line" && (list[i] == "Sample" || list[i] == "Line")) {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "Planetocentric Lat" && list[i] == "Planetocentric Latitude") {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "Planetographic Lat" && list[i] == "Planetographic Latitude") {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "Projected X:Projected Y" && (list[i] == "Projected X" || list[i] == "Projected Y")) {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "Radius" && list[i] == "Local Radius") {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "XYZ" && (list[i] == "Point X" || list[i] == "Point Y" || list[i] == "Point Z")) {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "Ra:Dec" && (list[i] == "Right Ascension" || list[i] == "Declination")) {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "Spacecraft Position" && (list[i] == "Spacecraft X" || list[i] == "Spacecraft Y" || list[i] == "Spacecraft Z")) {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }   
        if(p_itemList[j]->text() == "Ephemeris iTime" && list[i] == "Ephemeris Time") {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "Local Solar iTime" && list[i] == "Local Solar Time") {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        if(p_itemList[j]->text() == "Segments Sum" && list[i] == "Segments Sum km") {
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
        //End special cases


        if(p_itemList[j]->text() == list[i]) { 
          p_itemList[j]->setCheckState(Qt::Checked);
          break;
        }
      }  
    
      // Loop through column headers to try to find a match
      bool match = false;
      for (int cols=0; cols < p_table->columnCount(); cols++) {
        QString header = p_table->horizontalHeaderItem(cols)->text();

        header.remove("Positive");
        header.remove("\n");
        header.remove(" ");

        list[i].remove(" ");

        if(header == list[i]) {
          column.push_back(cols);
          match = true;
          break;

        }
      }
      if (!match) column.push_back(-1);
    }

    // Read data into table
    QString str = p_currentFile.readLine();
    
    while (str.count() != 0) {
      // Do we need more rows?
      if (p_currentRow+1 > p_table->rowCount()) {
        p_table->insertRow(p_currentRow);
        for (int c=0; c<p_table->columnCount(); c++) {
          QTableWidgetItem *item = new QTableWidgetItem("");
          p_table->setItem(p_currentRow,c,item);
          if (c == 0) p_table->scrollToItem(item);
        }
      }

      str.remove("\n");

      QStringList list = str.split(",");
 
      for (int i=0; i < column.size(); i++) {
        QTableWidgetItem *newItem = new QTableWidgetItem(list[i]);
        if (column[i] != -1) {
          p_table->setItem(p_currentRow, column[i], newItem);
        }
      }
      p_currentRow++;
      p_currentIndex++;


      str = p_currentFile.readLine();
    }

    p_currentFile.close();
    this->setWindowTitle(p_title + " : " + fn);
    emit fileLoaded();
  }
コード例 #15
0
ファイル: state.cpp プロジェクト: Lobotomius/vchar64
void State::emitNewState()
{
    emit fileLoaded();
    emit contentsChanged();
}
コード例 #16
0
void CWizFileReader::run()
{
    int nTotal = m_files.count();
    for (int i = 0; i < nTotal; i++)
    {
        QString strFile = m_files.at(i);
        QFileInfo fi(strFile);
        QString strHtml;
        QStringList textExtList, imageExtList, rtfExtList, docExtList, htmlExtList;
        textExtList << "txt" << "md" << "markdown" << "mht" << "cpp" << "h";
        imageExtList << "jpg" << "png" << "gif" << "tiff" << "jpeg" << "bmp" << "svg";
        rtfExtList << "rtf";
        docExtList << "doc" << "docx" << "pages";
        htmlExtList << "html" << "htm";

#ifdef Q_OS_MAC
        QStringList webExtList;
        webExtList << "webarchive";
#endif
        bool addAttach = false;
        QString docType = fi.suffix();
        if (textExtList.contains(docType,Qt::CaseInsensitive))
        {
            strHtml = loadTextFileToHtml(strFile);
        }
        else if (imageExtList.contains(docType,Qt::CaseInsensitive))
        {
            strHtml = loadImageFileToHtml(strFile);
        }
        else if (htmlExtList.contains(docType, Qt::CaseInsensitive))
        {
            strHtml = loadHtmlFileToHtml(strFile);
            QString strTitle = WizExtractFileName(strFile);
            emit htmlFileloaded(strFile, strHtml, strTitle);

            continue;
        }
#ifdef Q_OS_MAC
        else if (rtfExtList.contains(docType, Qt::CaseInsensitive))
        {
            if (!documentToHtml(strFile, RTFTextDocumentType, strHtml))
                continue;
            WizGetBodyContentFromHtml(strHtml, true);
            addAttach = true;
        }
        else if (docExtList.contains(docType))
        {
            if (!documentToHtml(strFile, DocFormatTextDocumentType, strHtml))
                continue;
            WizGetBodyContentFromHtml(strHtml, true);
            addAttach = true;
        }
        else if (webExtList.contains(docType))
        {
            if (!documentToHtml(strFile, WebArchiveTextDocumentType, strHtml))
                continue;
            WizGetBodyContentFromHtml(strHtml, true);
        }
        else
        {
            emit fileLoadFailed(strFile);
        }
#endif
        QString strTitle = WizExtractFileName(strFile);

        if (addAttach)
        {
            emit richTextFileLoaded(strHtml, strTitle, strFile);
        }
        else if (!strHtml.isEmpty())
        {
            emit fileLoaded(strHtml, strTitle);
        }

        emit loadProgress(nTotal, i + 1);
    }
    emit loadFinished();
    m_files.clear();
}
コード例 #17
0
ファイル: state.cpp プロジェクト: gitter-badger/vchar64
bool State::openFile(const QString& filename)
{
    QFile file(filename);

    if (!file.open(QIODevice::ReadOnly))
        return false;

    qint64 length=0;
    quint16 loadedAddress;

    enum {
        FILETYPE_VCHAR64,
        FILETYPE_PRG,
        FILETYPE_RAW,
        FILETYPE_CTM
    };
    int filetype = FILETYPE_RAW;


    QFileInfo info(file);
    if (info.suffix() == "vchar64proj")
    {
        length = StateImport::loadVChar64(this, file);
        filetype = FILETYPE_VCHAR64;
    }
    else if ((info.suffix() == "64c") || (info.suffix() == "prg"))
    {
        length = StateImport::loadPRG(this, file, &loadedAddress);
        filetype = FILETYPE_PRG;
    }
    else if(info.suffix() == "ctm")
    {
        length = StateImport::loadCTM(this, file);
        filetype = FILETYPE_CTM;
    }
    else
    {
        length = StateImport::loadRaw(this, file);
        filetype = FILETYPE_RAW;
    }

    file.close();

    if(length<=0)
        return false;

    // if a new file is loaded, then reset the exported and saved values
    _savedFilename = "";
    _exportedFilename = "";
    _exportedAddress = -1;

    // built-in resources are not saved
    if (filename[0] != ':')
    {
        _loadedFilename = filename;

        if (filetype == FILETYPE_VCHAR64)
        {
            _savedFilename = filename;
        }
        else if (filetype == FILETYPE_RAW || filetype == FILETYPE_PRG)
        {
            _exportedFilename = filename;
            if (filetype == FILETYPE_PRG) {
                _exportedAddress = loadedAddress;
            }
        }
    }

    _undoStack->clear();

    emit fileLoaded();
    emit contentsChanged();

    return true;
}
コード例 #18
0
ファイル: gpxlab.cpp プロジェクト: BourgeoisLab/GPXLab
GPXLab::GPXLab(const QString &fileName, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::GPXLab),
    closing(false)
{
    // setup UI
    ui->setupUi(this);

    // create GPX_model wrapper
    gpxmw = new GPX_wrapper(appName);
    connect(gpxmw, SIGNAL(fileLoaded()), this, SLOT(fileLoaded()));
    connect(gpxmw, SIGNAL(fileSaved()), this, SLOT(fileSaved()));
    connect(gpxmw, SIGNAL(modelCleared()), this, SLOT(modelCleared()));
    connect(gpxmw, SIGNAL(modelPropertiesChanged()), this, SLOT(modelPropertiesChanged()));
    connect(gpxmw, SIGNAL(modelMetadataChanged()), this, SLOT(modelMetadataChanged()));
    connect(gpxmw, SIGNAL(trackMetadataChanged(int)), this, SLOT(trackMetadataChanged(int)));
    connect(gpxmw, SIGNAL(trackInserted(int, const GPX_trkType&)), this, SLOT(trackInserted(int, const GPX_trkType&)));
    connect(gpxmw, SIGNAL(trackDeleted(int)), this, SLOT(trackDeleted(int)));
    connect(gpxmw, SIGNAL(trackMovedUp(int)), this, SLOT(trackMovedUp(int)));
    connect(gpxmw, SIGNAL(trackMovedDown(int)), this, SLOT(trackMovedDown(int)));
    connect(gpxmw, SIGNAL(trackSplited(int)), this, SLOT(trackSplited(int)));
    connect(gpxmw, SIGNAL(trackCombined(int)), this, SLOT(trackCombined(int)));
    connect(gpxmw, SIGNAL(trackTimeShifted(int, long)), this, SLOT(trackTimeShifted(int, long)));
    connect(gpxmw, SIGNAL(trackSelectionChanged(int, int, int, const GPX_wptType*)), this, SLOT(trackSelectionChanged(int, int, int, const GPX_wptType*)));
    connect(gpxmw, SIGNAL(pointEdited(int, int, int, GPX_wrapper::TrackPointProperty)), this, SLOT(pointEdited(int, int, int, GPX_wrapper::TrackPointProperty)));
    connect(gpxmw, SIGNAL(pointInserted(int, int, int, const GPX_wptType&)), this, SLOT(pointInserted(int, int, int, const GPX_wptType&)));
    connect(gpxmw, SIGNAL(pointDeleted(int, int, int)), this, SLOT(pointDeleted(int, int, int)));
    connect(gpxmw, SIGNAL(pointSelectionChanged(int, const GPX_wptType*)), this, SLOT(pointSelectionChanged(int, const GPX_wptType*)));

    // set window title
    setMainWindowTitle();

    // load settings
    settings = new Settings(this);
    settings->load();
    ui->actionFollow_Item->setChecked(settings->getValue("FollowItem").toBool());
    ui->actionShow_Only_Selected_Track->setChecked(settings->getValue("ShowOnlySelectedItem").toBool());

    // undo stack
    undoStack = new QUndoStack(this);
    undoStack->setUndoLimit(settings->undoLimit);
    QAction *undoAction = undoStack->createUndoAction(this, tr("&Undo"));
    undoAction->setShortcuts(QKeySequence::Undo);
    undoAction->setIcon(QIcon(":/images/undo.png"));
    QAction *redoAction = undoStack->createRedoAction(this, tr("&Redo"));
    redoAction->setShortcuts(QKeySequence::Redo);
    redoAction->setIcon(QIcon(":/images/redo.png"));
    connect(undoStack, SIGNAL(indexChanged(int)), this, SLOT(setMainWindowTitle()));

    // tree widget
    connect(ui->treeTracks, SIGNAL(itemDoubleClicked(QTreeWidgetItem* , int)), this, SLOT(tree_doubleClicked(QTreeWidgetItem*, int)));

    // map widget
    ui->mapWidget->init(gpxmw, undoStack, settings->doPersistentCaching, settings->cachePath);
    ui->mapWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->mapWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(map_showContextMenu(const QPoint&)));
    connect(ui->mapWidget, SIGNAL(viewChanged(const QPointF&, int)), this, SLOT(map_viewChanged(const QPointF&, int)));

    // calendar widget
    ui->calendarWidget->init(gpxmw);

    // table widget
    ui->tableWidgetPoints->init(gpxmw, undoStack);
    connect(settings, SIGNAL(settingsChanged(bool)), ui->tableWidgetPoints, SLOT(settingsChanged(bool)));

    // diagram widget
    ui->diagramWidget->addAction(ui->dockWidgetDiagrams->toggleViewAction());
    ui->diagramWidget->init(gpxmw);

    // status bar widgets
    lblCoordinates = new QLabel();
    statusBar()->addWidget(lblCoordinates);
    lblStatus = new QLabel();
    statusBar()->addWidget(lblStatus);

    // zoom slider widget
    zoomSlider = new QSlider(Qt::Horizontal, this);
    zoomSlider->setMinimumWidth(10);
    zoomSlider->setMaximumWidth(100);
    zoomSlider->setMinimum(0);
    zoomSlider->setMaximum(0);
    ui->mainToolBar->insertWidget(ui->actionMapZoom, zoomSlider);
    connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(zoom_valueChanged(int)));

    // build recent files action
    actionOpenRecentFile = new QAction*[settings->maxRecentFiles];
    for (int i = 0; i < settings->maxRecentFiles; ++i)
    {
        actionOpenRecentFile[i] = new QAction(this);
        actionOpenRecentFile[i]->setVisible(false);
        connect(actionOpenRecentFile[i], SIGNAL(triggered()), this, SLOT(openRecentFile()));
        ui->menuFile->insertAction(ui->actionExit, actionOpenRecentFile[i]);
    }
    ui->menuFile->insertSeparator(ui->actionExit);
    updateRecentFiles();

    // menu edit
    ui->menuEdit->addAction(undoAction);
    ui->menuEdit->addAction(redoAction);

    // menu view
    ui->menuView->addAction(ui->dockWidgetFile->toggleViewAction());
    ui->menuView->addAction(ui->dockWidgetTracks->toggleViewAction());
    ui->menuView->addAction(ui->dockWidgetDiagrams->toggleViewAction());
    ui->menuView->addAction(ui->dockWidgetPoints->toggleViewAction());
    ui->menuView->addAction(ui->mainToolBar->toggleViewAction());
    ui->menuView->addSeparator();
    ui->menuView->addAction(ui->actionRestore_Default_View);

    // install event filters for dock widgets to catch resize events
    ui->dockWidgetFile->installEventFilter(this);
    ui->dockWidgetTracks->installEventFilter(this);
    ui->dockWidgetDiagrams->installEventFilter(this);
    ui->dockWidgetPoints->installEventFilter(this);

    // dock file
    ui->dockWidgetFile->addAction(ui->dockWidgetFile->toggleViewAction());
    ui->dockWidgetFile->addAction(ui->actionEdit_File_Properties);

    // dock tracks
    ui->dockWidgetTracks->addAction(ui->dockWidgetTracks->toggleViewAction());
    ui->dockWidgetTracks->addAction(ui->actionEdit_Track_Properties);
    ui->dockWidgetTracks->addAction(ui->actionGetAltitudeFromSRTM);
    ui->dockWidgetTracks->addAction(ui->actionSetStartTime);

    // dock diagram
    ui->dockWidgetDiagrams->addActions(ui->diagramWidget->actions());

    // dock points
    ui->dockWidgetPoints->addAction(ui->dockWidgetPoints->toggleViewAction());
    ui->dockWidgetPoints->addAction(ui->actionInsert_Point);
    ui->dockWidgetPoints->addAction(ui->actionDelete_Point);

    // default context menu
    addActions(ui->menuView->actions());

    // connect signals for track and point selection
    connect(ui->diagramWidget, SIGNAL(selectionChanged(time_t)), this, SLOT(diagram_selectionChanged(time_t)));
    connect(ui->mapWidget, SIGNAL(selectionChanged(int, int, double, double)), this, SLOT(map_selectionChanged(int, int, double, double)));
    connect(ui->mapWidget, SIGNAL(selectionChanged(int)), this, SLOT(map_selectionChanged(int)));
    connect(ui->tableWidgetPoints, SIGNAL(selectionChanged(int)), this, SLOT(table_selectionChanged(int)));
    connect(ui->treeTracks, SIGNAL(itemSelectionChanged()), this, SLOT(tree_selectionChanged()));
    connect(ui->calendarWidget, SIGNAL(selectionChanged(int)), this, SLOT(cal_selectionChanged(int)));

    // disable actions
    updateActions(false);

    // open file if any passed as argument
    if (!fileName.isEmpty())
    {
        openFile(fileName);
    }
}
コード例 #19
0
    , m_langUsesSpaces(true)
    , m_catalog(catalog)
    , m_part(part)
    , m_highlighter(new SyntaxHighlighter(this))
    , m_completionBox(0)
{
    setReadOnly(part==DocPosition::Source);
    setUndoRedoEnabled(false);
    setAcceptRichText(false);

    if (part==DocPosition::Target)
    {
        connect (document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(contentsChanged(int,int,int)));
        connect (this,SIGNAL(cursorPositionChanged()), this, SLOT(emitCursorPositionChanged()));
    }
    connect (catalog,SIGNAL(signalFileLoaded()), this, SLOT(fileLoaded()));
    //connect (Project::instance(),SIGNAL(configChanged()), this, SLOT(projectConfigChanged()));

    setSpellInterface(new XliffTextEditSpellInterface(m_highlighter));
    setHighlighter(m_highlighter);
}

void TranslationUnitTextEdit::fileLoaded()
{
    QString langCode=m_part==DocPosition::Source? m_catalog->sourceLangCode():m_catalog->targetLangCode();
    m_highlighter->setCurrentLanguage(langCode);

    //"i use an english locale while translating kde pot files from english to hebrew" Bug #181989
    QLocale langLocale(langCode);
    Qt::LayoutDirection targetLanguageDirection=Qt::LeftToRight;
    static QLocale::Language rtlLanguages[]={QLocale::Arabic, QLocale::Hebrew, QLocale::Urdu, QLocale::Persian, QLocale::Pashto};