Exemple #1
0
QString ConnectionDelegate::displayText(const QVariant &value, const QLocale& locale) const
{
    if (value.type() == QVariant::DateTime) {
        QDateTime lastConnected = QDateTime(value.toDateTime());
        QDateTime currentTime = QDateTime::currentDateTimeUtc();

        int daysAgo = lastConnected.daysTo(currentTime);
        if (daysAgo <= 1 && lastConnected.secsTo(currentTime) < 86400) {
            int minutesAgo = lastConnected.secsTo(currentTime) / 60;
            int hoursAgo = minutesAgo / 60;
            if (hoursAgo < 1) {
                if (minutesAgo < 1)
                    return i18n("Less than a minute ago");
                return i18np("A minute ago", "%1 minutes ago", minutesAgo);
            } else {
                return i18np("An hour ago", "%1 hours ago", hoursAgo);
            }
        } else { // 1 day or more
            if (daysAgo < 30)
                return i18np("Yesterday", "%1 days ago", daysAgo);
            if (daysAgo < 365)
                return i18np("Over a month ago", "%1 months ago", daysAgo / 30);
            return i18np("A year ago", "%1 years ago", daysAgo / 365);
        }

    }
    // These aren't the strings you're looking for, move along.
    return QStyledItemDelegate::displayText(value, locale);
}
QString DurationWizardPage::updateTermWidgets(const double val)
{
  long vl = qFloor(val);

  QString valString;
  MyMoneySchedule::occurrenceE unit;
  unit = MyMoneySchedule::occurrenceE(field("paymentFrequencyUnitEdit").toInt());

  if ((unit == MyMoneySchedule::OCCUR_MONTHLY)
      && ((vl % 12) == 0)) {
    vl /= 12;
    unit = MyMoneySchedule::OCCUR_YEARLY;
  }

  switch (unit) {
    case MyMoneySchedule::OCCUR_MONTHLY:
      valString = i18np("one month", "%1 months", vl);
      m_durationUnitEdit->setCurrentItem(static_cast<int>(MyMoneySchedule::OCCUR_MONTHLY));
      break;
    case MyMoneySchedule::OCCUR_YEARLY:
      valString = i18np("one year", "%1 years", vl);
      m_durationUnitEdit->setCurrentItem(static_cast<int>(MyMoneySchedule::OCCUR_YEARLY));
      break;
    default:
      valString = i18np("one payment", "%1 payments", vl);
      m_durationUnitEdit->setCurrentItem(static_cast<int>(MyMoneySchedule::OCCUR_ONCE));
      break;
  }
  m_durationValueEdit->setValue(vl);
  return valString;
}
Exemple #3
0
void PkInstallCatalogs::modelChanged()
{
    QStringList files = m_model->files();
    enableButtonOk(!files.isEmpty());
    QString description;
    if (files.isEmpty()) {
        description = i18n("No supported catalog was found");
    } else {
        description = i18np("Do you want to install this catalog?",
                            "Do you want to install these catalogs?",
                            files.size());
    }
    m_introDialog->setDescription(description);

    QString title;
    // this will come from DBus interface
    if (parentTitle.isNull()) {
        title = i18np("An application wants to install a catalog",
                      "An application wants to install catalogs",
                        files.size());
    } else {
        title = i18np("The application <i>%2</i> wants to install a catalog",
                      "The application <i>%2</i> wants to install catalogs",
                        files.size(),
                        parentTitle);
    }
    setTitle(title);
}
Exemple #4
0
bool Executer::checkParameterQuantity(TreeNode* node, uint quantity, int errorCode)
{
// 	//qDebug() << "called";
	uint nodeSize = node->childCount();

	if (quantity == 0) {
		if (nodeSize == 0) return true;  // thats easy!
		addError(i18n("The %1 command accepts no parameters.", node->token()->look()), *node->token(), errorCode);
		return false;
	}
	
// 	// CHECK THIS OUT LATER
// 	if (nodeSize != 0) // when all parameters are forgotten the parser puts a Unknown/tokEOL param, catch this:
// 		if (node->firstChild()->getToken().type == tokEOL) nodeSize = 0;
	
	if (nodeSize != quantity) {
		if (nodeSize < quantity) {
			addError(i18np("The %2 command was called with %3 but needs 1 parameter.", "The %2 command was called with %3 but needs %1 parameters.", quantity, node->token()->look(), nodeSize), *node->token(), errorCode);
		} else {
			addError(i18np("The %2 command was called with %3 but only accepts 1 parameter.", "The %2 command was called with %3 but only accepts %1 parameters.", quantity, node->token()->look(), nodeSize), *node->token(), errorCode);
		}
		return false;
	}
	return true; // if all tests passed
}
Exemple #5
0
Element::List Datenums::createDayElements(const QDate &date)
{
    Element::List result;

    int dayOfYear = date.dayOfYear();
    int remainingDays = date.daysInYear() - dayOfYear;

    StoredElement *e;
    switch (mDisplayedInfo) {
    case DayOfYear: // only day of year
        e = new StoredElement(QStringLiteral("main element"), QString::number(dayOfYear));
        break;
    case DaysRemaining: // only days until end of year
        e = new StoredElement(QStringLiteral("main element"), QString::number(remainingDays),
                              i18np("1 day before the end of the year",
                                    "%1 days before the end of the year",
                                    remainingDays));
        break;
    case DayOfYear + DaysRemaining: // both day of year and days till end of year
    default:
        e = new StoredElement(QStringLiteral("main element"), QString::number(dayOfYear),
                              i18nc("dayOfYear / daysTillEndOfYear", "%1 / %2",
                                    dayOfYear, remainingDays),
                              i18np("1 day since the beginning of the year,\n",
                                    "%1 days since the beginning of the year,\n",
                                    dayOfYear) +
                              i18np("1 day until the end of the year",
                                    "%1 days until the end of the year",
                                    remainingDays));
        break;
    }
    result.append(e);

    return result;
}
Exemple #6
0
void RawCameraDlg::updateHeader(int results)
{
    QString librawVer = RawEngine::DRawDecoder::librawVersion();
    QStringList list  = RawEngine::DRawDecoder::supportedCamera();

    if (!results)
    {
        d->header->setText(i18np("Using LibRaw version %2<br/>"
                                 "1 model on the list</p>",
                                 "Using LibRaw version %2<br/>"
                                 "%1 models on the list</p>",
                                 list.count(),
                                 librawVer
                                 ));
    }
    else
    {
        d->header->setText(i18np("Using LibRaw version %2<br/>"
                                 "1 model on the list (found: %3)</p>",
                                 "Using LibRaw version %2<br/>"
                                 "%1 models on the list (found: %3)</p>",
                                 list.count(),
                                 librawVer,
                                 results));
    }
}
bool IngredientInput::checkBounds()
{
	if ( ingredientBox->currentText().length() > int(database->maxIngredientNameLength()) ) {
		KMessageBox::error( this, i18np( "Ingredient name cannot be longer than 1 character.", "Ingredient name cannot be longer than %1 characters." , database->maxIngredientNameLength() ) );
		ingredientBox->lineEdit() ->setFocus();
		ingredientBox->lineEdit() ->selectAll();
		return false;
	}

	if ( unitBox->currentText().length() > int(database->maxUnitNameLength()) ) {
		KMessageBox::error( this, i18np( "Unit name cannot be longer than 1 character.", "Unit name cannot be longer than %1 characters.", database->maxUnitNameLength() ) );
		unitBox->lineEdit() ->setFocus();
		unitBox->lineEdit() ->selectAll();
		return false;
	}

	QStringList prepMethodList;
	if (prepMethodBox->currentText().isEmpty())
		prepMethodList = QStringList();
	else
		prepMethodList = prepMethodBox->currentText().split( ',', QString::SkipEmptyParts);
   
	for ( QStringList::const_iterator it = prepMethodList.constBegin(); it != prepMethodList.constEnd(); ++it ) {
		if ( (*it).trimmed().length() > int(database->maxPrepMethodNameLength()) )
		{
			KMessageBox::error( this, i18np( "Preparation method cannot be longer than 1 character.", "Preparation method cannot be longer than %1 characters." , database->maxPrepMethodNameLength() ) );
			prepMethodBox->lineEdit() ->setFocus();
			prepMethodBox->lineEdit() ->selectAll();
			return false;
		}
	}

	return true;
}
//! @return "opened x minutes ago" string or similar
static QString openedString(const QDateTime& _opened)
{
    const KDateTime cur(KDateTime::currentUtcDateTime());
    const KDateTime opened = KDateTime(_opened);
    if (!opened.isValid() || opened >= cur)
        return QString();
    
    const int days = opened.daysTo(cur);
    if (days <= 1 && opened.secsTo(cur) < 24*60*60) {
        const int minutes = opened.secsTo(cur) / 60;
        const int hours = minutes / 60;
        if (hours < 1) {
            if (minutes == 0)
                return i18n("Opened less than minute ago");
            else
                return i18np("Opened 1 minute ago", "Opened %1 minutes ago", minutes);
        } else {
            return i18np("Opened 1 hour ago", "Opened %1 hours ago", hours);
        }
    } else {
        if (days < 30)
            return i18np("Opened yesterday", "Opened %1 days ago", days);
        if (days < 365)
            return i18np("Opened over a month ago", "Opened %1 months ago", days / 30);
        return i18np("Opened one year ago", "Opened %1 years ago", days / 365);
    }
    return QString();
}
Exemple #9
0
QString K3b::MovixJob::jobDetails() const
{
    return ( i18np("One file (%2) and about 8 MB eMovix data",
                   "%1 files (%2) and about 8 MB eMovix data",
                   m_doc->movixFileItems().count(), KIO::convertSize(m_doc->size()))
             + ( m_doc->copies() > 1
                 ? i18np(" – One copy", " – %1 copies", m_doc->copies())
                 : QString() ) );
}
Exemple #10
0
QString K3b::VcdJob::jobDetails() const
{
    return ( i18np( "1 MPEG (%2)",
                    "%1 MPEGs (%2)",
                    m_doc->tracks() ->count(), KIO::convertSize( m_doc->size() ) )
             + ( m_doc->copies() > 1
                 ? i18np( " - %1 copy", " - %1 copies", m_doc->copies() )
                 : QString() ) );
}
Exemple #11
0
void ConnectionManager::handleReconnect(Server* server)
{
    if (!Preferences::self()->autoReconnect() || m_overrideAutoReconnect) return;

    ConnectionSettings settings = server->getConnectionSettings();

    uint reconnectCount = Preferences::self()->reconnectCount();

    // For server groups, one iteration over their server list shall count as one
    // connection attempt.
    if (settings.serverGroup())
        reconnectCount = reconnectCount * settings.serverGroup()->serverList().size();

    if (reconnectCount == 0 || settings.reconnectCount() < reconnectCount)
    {
        if (settings.serverGroup() && settings.serverGroup()->serverList().size() > 1)
        {
            Konversation::ServerList serverList = settings.serverGroup()->serverList();

            int index = serverList.indexOf(settings.server());
            int size = serverList.size();

            if (index == size - 1 || index == -1)
                settings.setServer(serverList[0]);
            else if (index < size - 1)
                settings.setServer(serverList[index+1]);

            server->setConnectionSettings(settings);

            server->getStatusView()->appendServerMessage(i18n("Info"),
                i18np(
                 "Trying to connect to %2 (port <numid>%3</numid>) in 1 second.",
                 "Trying to connect to %2 (port <numid>%3</numid>) in %1 seconds.",
                 Preferences::self()->reconnectDelay(),
                 settings.server().host(),
                 QString::number(settings.server().port())));
        }
        else
        {
            server->getStatusView()->appendServerMessage(i18n("Info"),
                i18np(
                 "Trying to reconnect to %2 (port <numid>%3</numid>) in 1 second.",
                 "Trying to reconnect to %2 (port <numid>%3</numid>) in %1 seconds.",
                 Preferences::self()->reconnectDelay(),
                 settings.server().host(),
                 QString::number(settings.server().port())));
        }

        server->getConnectionSettings().incrementReconnectCount();
        server->connectToIRCServerIn(Preferences::self()->reconnectDelay());
    }
    else
    {
        server->getConnectionSettings().setReconnectCount(0);
        server->getStatusView()->appendServerMessage(i18n("Error"), i18n("Reconnection attempts exceeded."));
    }
}
Exemple #12
0
void K3b::FillStatusDisplay::showTime()
{
    d->actionShowMinutes->setChecked( true );

    d->action74Min->setText( i18np("unused", "%1 minutes", 74) );
    d->action80Min->setText( i18np("unused", "%1 minutes", 80) );
    d->action100Min->setText( i18np("unused", "%1 minutes", 100) );

    d->showTime = true;
    d->displayWidget->setShowTime(true);
}
Exemple #13
0
ChangeMasterEffectStateCommand::ChangeMasterEffectStateCommand(Bin *bin, const QString &clipId, const QList <int>& effectIndexes, bool disable, QUndoCommand *parent) :
        QUndoCommand(parent),
        m_bin(bin),
        m_clipId(clipId),
        m_effectIndexes(effectIndexes),
        m_disable(disable),
        m_refreshEffectStack(false)
{
    if (disable)
        setText(i18np("Disable effect", "Disable effects", effectIndexes.count()));
    else
        setText(i18np("Enable effect", "Enable effects", effectIndexes.count()));
}
Exemple #14
0
	void StatusBar::updateDHTStatus(bool on,const dht::Stats & s)
	{
		if (on == dht_on && dht_peers == s.num_peers && dht_tasks == s.num_tasks)
			return;

		dht_on = on;
		dht_peers = s.num_peers;
		dht_tasks = s.num_tasks;
		if (on)
			dht_status->setText(i18n("DHT: %1, %2",i18np("%1 node","%1 nodes",s.num_peers),i18np("%1 task","%1 tasks",s.num_tasks)));
	        else
			dht_status->setText(i18n("DHT: off"));
	}
Exemple #15
0
void KateBuildView::slotProcExited(int exitCode, QProcess::ExitStatus)
{
    QApplication::restoreOverrideCursor();
    m_buildUi.cancelBuildButton->setEnabled(false);
    m_buildUi.cancelBuildButton2->setEnabled(false);
    m_buildUi.buildAgainButton->setEnabled(true);
    m_buildUi.buildAgainButton2->setEnabled(true);

    QString buildStatus = i18n("Building <b>%1</b> completed.", m_currentlyBuildingTarget);

    // did we get any errors?
    if (m_numErrors || m_numWarnings || (exitCode != 0)) {
       m_buildUi.u_tabWidget->setCurrentIndex(1);
       if (m_buildUi.displayModeSlider->value() == 0) {
           m_buildUi.displayModeSlider->setValue(m_displayModeBeforeBuild > 0 ? m_displayModeBeforeBuild: 1);
       }
       m_buildUi.errTreeWidget->resizeColumnToContents(0);
       m_buildUi.errTreeWidget->resizeColumnToContents(1);
       m_buildUi.errTreeWidget->resizeColumnToContents(2);
       m_buildUi.errTreeWidget->horizontalScrollBar()->setValue(0);
        //m_buildUi.errTreeWidget->setSortingEnabled(true);
        m_win->showToolView(m_toolView);
    }

    if (m_numErrors || m_numWarnings) {
        QStringList msgs;
        if (m_numErrors) {
            msgs << i18np("Found one error.", "Found %1 errors.", m_numErrors);
            buildStatus = i18n("Building <b>%1</b> had errors.", m_currentlyBuildingTarget);
        }
        else if (m_numWarnings) {
            msgs << i18np("Found one warning.", "Found %1 warnings.", m_numWarnings);
            buildStatus = i18n("Building <b>%1</b> had warnings.", m_currentlyBuildingTarget);
        }
        displayBuildResult(msgs.join(QLatin1Char('\n')), m_numErrors ? KTextEditor::Message::Error : KTextEditor::Message::Warning);
    }
    else if (exitCode != 0) {
        displayBuildResult(i18n("Build failed."), KTextEditor::Message::Warning);
    }
    else {
        displayBuildResult(i18n("Build completed without problems."), KTextEditor::Message::Positive);
    }

    if (!m_buildCancelled) {
        m_buildUi.buildStatusLabel->setText(buildStatus);
        m_buildUi.buildStatusLabel2->setText(buildStatus);
        m_buildCancelled = false;
    }

}
ChangeEffectStateCommand::ChangeEffectStateCommand(CustomTrackView *view, const int track, const GenTime& pos, const QList <int>& effectIndexes, bool disable, bool refreshEffectStack, bool doIt, QUndoCommand *parent) :
    QUndoCommand(parent),
    m_view(view),
    m_track(track),
    m_effectIndexes(effectIndexes),
    m_pos(pos),
    m_disable(disable),
    m_doIt(doIt),
    m_refreshEffectStack(refreshEffectStack)
{
    if (disable)
        setText(i18np("Disable effect", "Disable effects", effectIndexes.count()));
    else
        setText(i18np("Enable effect", "Enable effects", effectIndexes.count()));
}
Exemple #17
0
// deprecated. KF6: remove
KIOWIDGETS_DEPRECATED_EXPORT QString KIO::pasteActionText()
{
    const QMimeData *mimeData = QApplication::clipboard()->mimeData();
    const QList<QUrl> urls = KUrlMimeData::urlsFromMimeData(mimeData);
    if (!urls.isEmpty()) {
        if (urls.first().isLocalFile()) {
            return i18np("&Paste File", "&Paste %1 Files", urls.count());
        } else {
            return i18np("&Paste URL", "&Paste %1 URLs", urls.count());
        }
    } else if (!mimeData->formats().isEmpty()) {
        return i18n("&Paste Clipboard Contents");
    } else {
        return QString();
    }
}
Exemple #18
0
QString K3b::VideoDvdJob::jobDetails() const
{
    return ( i18n("ISO 9660/Udf Filesystem (Size: %1)",KIO::convertSize( doc()->size() ))
             + ( m_doc->copies() > 1
                 ? i18np(" - %1 copy", " - %1 copies", m_doc->copies())
                 : QString() ) );
}
Exemple #19
0
void KReplaceDialogPrivate::_k_slotOk()
{
    // If regex and backrefs are enabled, do a sanity check.
    if ( q->KFindDialog::d->regExp->isChecked() && q->KFindDialog::d->backRef->isChecked() )
    {
        QRegExp r ( q->pattern() );
        int caps = r.numCaptures();
        QRegExp check(QString("((?:\\\\)+)(\\d+)"));
        int p = 0;
        QString rep = q->replacement();
        while ( (p = check.indexIn( rep, p ) ) > -1 )
        {
            if ( check.cap(1).length()%2 && check.cap(2).toInt() > caps )
            {
                KMessageBox::information( q, i18n(
                        "Your replacement string is referencing a capture greater than '\\%1', ",  caps ) +
                    ( caps ?
                        i18np("but your pattern only defines 1 capture.",
                             "but your pattern only defines %1 captures.", caps ) :
                        i18n("but your pattern defines no captures.") ) +
                    i18n("\nPlease correct.") );
                return; // abort OKing
            }
            p += check.matchedLength();
        }

    }

    q->KFindDialog::d->_k_slotOk();
    q->KFindDialog::d->replace->addToHistory(q->replacement());
}
void ImageCategoryDrawer::textForTAlbum(TAlbum* talbum, bool recursive, int count, QString* header,
                                        QString* subLine) const
{
    *header = talbum->title();

    if (recursive && talbum->firstChild())
    {
        int n=0;

        for (AlbumIterator it(talbum); it.current(); ++it)
        {
            n++;
        }

        QString firstPart = i18ncp("%2: a tag title; %3: number of subtags",
                                   "%2 including 1 subtag", "%2 including %1 subtags",
                                   n, talbum->tagPath(false));

        *subLine = i18ncp("%2: the previous string (e.g. 'Foo including 7 subtags'); %1: number of items in tag",
                          "%2 - 1 Item", "%2 - %1 Items",
                          count, firstPart);
    }
    else
    {
        *subLine = i18np("%2 - 1 Item", "%2 - %1 Items", count, talbum->tagPath(false));
    }
}
Exemple #21
0
void ExtractJob::doWork()
{
    QString desc;
    if (m_entries.count() == 0) {
        desc = i18n("Extracting all files");
    } else {
        desc = i18np("Extracting one file", "Extracting %1 files", m_entries.count());
    }
    emit description(this, desc, qMakePair(i18n("Archive"), archiveInterface()->filename()), qMakePair(i18nc("extraction folder", "Destination"), m_destinationDir));

    QFileInfo destDirInfo(m_destinationDir);
    if (destDirInfo.isDir() && (!destDirInfo.isWritable() || !destDirInfo.isExecutable())) {
        onError(xi18n("Could not write to destination <filename>%1</filename>.<nl/>Check whether you have sufficient permissions.", m_destinationDir), QString());
        onFinished(false);
        return;
    }

    connectToArchiveInterfaceSignals();

    qCDebug(ARK) << "Starting extraction with" << m_entries.count() << "selected files."
             << m_entries
             << "Destination dir:" << m_destinationDir
             << "Options:" << m_options;

    bool ret = archiveInterface()->extractFiles(m_entries, m_destinationDir, m_options);

    if (!archiveInterface()->waitForFinishedSignal()) {
        onFinished(ret);
    }
}
Exemple #22
0
void Kard::slotUpdateTimer(int id)
{
    //read timer from config, set default to 1 second
    switch (id)  {
        case 0:
            m_view->myTime = 2000; // 2 seconds
            break;
        case 1:
            m_view->myTime = 1000; // 1 second
            break;
        case 2:
            m_view->myTime = 500; // half a second
            break;
    }
    
    double m_time = double(m_view->myTime)/double(1000);
    
    if (m_time<1)  {
        changeStatusbar(i18nc("fraction of whole second","Timer: %1 second", m_time), IDS_TIME);
    } else  {
        changeStatusbar(i18np("Timer: 1 second","Timer: %1 seconds", (int)m_time), IDS_TIME);
    }
    KardSettings::setTime(id);
    KardSettings::self()->writeConfig(); 
}
void TimelineWidget::addNewPosts( QList< Choqok::Post* >& postList)
{
    kDebug()<<d->currentAccount->alias()<<' '<<d->timelineName<<' '<<postList.count();
    QList<Post*>::const_iterator it, endIt = postList.constEnd();
    int unread = 0;
    for(it = postList.constBegin(); it!= endIt; ++it){
        if(d->posts.keys().contains((*it)->postId))
            continue;
        PostWidget *pw = d->currentAccount->microblog()->createPostWidget(d->currentAccount, *it, this);
        if(pw) {
            addPostWidgetToUi(pw);
            if( !pw->isRead() )
                ++unread;
        }
    }
    removeOldPosts();
    if(unread){
        d->unreadCount += unread;
        Choqok::NotifyManager::newPostArrived( i18np( "1 new post in %2(%3)",
                                                      "%1 new posts in %2(%3)",
                                                      unread, currentAccount()->alias(), d->timelineName ) );

        emit updateUnreadCount(unread);
        showMarkAllAsReadButton();
    }
}
Exemple #24
0
void
AlbumItem::update()
{
    if( !m_album )
        return;

    Meta::TrackList tracks = m_album->tracks();
    if( !tracks.isEmpty() )
    {
        Meta::TrackPtr first = tracks.first();
        Meta::YearPtr year = first->year();
        if( year )
            setData( year->year(), AlbumYearRole );
    }

    QString albumName = m_album->name();
    albumName = albumName.isEmpty() ? i18n("Unknown") : albumName;
    QString name = ( m_showArtist && m_album->hasAlbumArtist() )
                 ? QString( "%1 - %2" ).arg( m_album->albumArtist()->name(), albumName )
                 : albumName;
    setData( name, NameRole );

    qint64 totalTime = 0;
    foreach( Meta::TrackPtr item, tracks )
        totalTime += item->length();

    QString trackCount = i18np( "%1 track", "%1 tracks", tracks.size() );
    QString lengthText = QString( "%1, %2" ).arg( trackCount, Meta::msToPrettyTime( totalTime ) );
    setData( lengthText, AlbumLengthRole );

    QPixmap cover = The::svgHandler()->imageWithBorder( m_album, m_iconSize, 3 );
    setIcon( QIcon( cover ) );
}
Exemple #25
0
K3b::AudioRippingDialog::AudioRippingDialog( const K3b::Medium& medium,
                                              const KCDDB::CDInfo& entry,
                                              const QList<int>& tracks,
                                              QWidget *parent )
    : K3b::InteractionDialog( parent,
                            QString(),
                            QString(),
                            START_BUTTON|CANCEL_BUTTON,
                            START_BUTTON,
                            "Audio Ripping" ), // config group
      m_medium( medium ),
      m_cddbEntry( entry ),
      m_trackNumbers( tracks )
{
    d = new Private();

    setupGui();
    setupContextHelp();

    K3b::Msf length;
    K3b::Device::Toc toc = medium.toc();
    for( QList<int>::const_iterator it = m_trackNumbers.constBegin();
         it != m_trackNumbers.constEnd(); ++it ) {
        length += toc[*it].length();
    }
    setTitle( i18n("CD Ripping"),
              i18np("1 track (%2)", "%1 tracks (%2)",
                    m_trackNumbers.count(),length.toString()) );
}
Exemple #26
0
void ByteTableTool::insert( unsigned char byte, int count )
{
    const QByteArray data( count, byte );

    Okteta::ChangesDescribable *changesDescribable =
        qobject_cast<Okteta::ChangesDescribable*>( mByteArrayModel );

    if( changesDescribable )
    {
        // TODO: how to note the byte? charcoding might change...
        const QString changeDescription =
            i18np( "Inserted 1 Byte","Inserted %1 Bytes", count );

        changesDescribable->openGroupedChange( changeDescription );
    }

    mByteArrayView->insert( data );

    if( changesDescribable )
        changesDescribable->closeGroupedChange();
// void ByteTableController::fill( const QByteArray &Data )
// {
//     if( HexEdit && ByteArray )
//         ByteArray->insert( HexEdit->cursorPosition(), Data );
// }
    mByteArrayView->setFocus();
}
Exemple #27
0
void SearchResultModelHelper::snapItemsTo(const QModelIndex& targetIndex, const QList<QModelIndex>& snappedIndices)
{
    GPSUndoCommand* const undoCommand = new GPSUndoCommand();

    SearchResultModel::SearchResultItem targetItem = d->model->resultItem(targetIndex);
    const KMap::GeoCoordinates& targetCoordinates = targetItem.result.coordinates;
    for (int i=0; i<snappedIndices.count(); ++i)
    {
        const QPersistentModelIndex itemIndex = snappedIndices.at(i);
        KipiImageItem* const item = d->imageModel->itemFromIndex(itemIndex);

        GPSUndoCommand::UndoInfo undoInfo(itemIndex);
        undoInfo.readOldDataFromItem(item);

        GPSDataContainer newData;
        newData.setCoordinates(targetCoordinates);
        item->setGPSData(newData);

        undoInfo.readNewDataFromItem(item);

        undoCommand->addUndoInfo(undoInfo);
    }
    undoCommand->setText(i18np("1 image snapped to '%2'",
                               "%1 images snapped to '%2'", snappedIndices.count(), targetItem.result.name));

    emit(signalUndoCommand(undoCommand));
}
Exemple #28
0
void GPSCorrelatorWidget::slotAllItemsCorrelated()
{
    if (d->correlationCorrelatedCount == 0)
    {
        QMessageBox::warning(this, i18n("Correlation failed"),
                             i18n("Could not correlate any image - please make sure the timezone and gap settings are correct."));
    }
    else if (d->correlationCorrelatedCount == d->correlationTotalCount)
    {
        QMessageBox::information(this, i18n("Correlation succeeded"),
                                 i18n("All images have been correlated. You can now check their position on the map."));
    }
    else
    {
        // note: no need for i18np here, because the case of correlationTotalCount==1 is covered in the other two cases.
        QMessageBox::warning(this, i18n("Correlation finished"),
                           i18n("%1 out of %2 images have been correlated. Please check the timezone and gap settings if you think that more images should have been correlated.",
                                d->correlationCorrelatedCount, d->correlationTotalCount));
    }

    if (d->correlationCorrelatedCount == 0)
    {
        delete d->correlationUndoCommand;
    }
    else
    {
        d->correlationUndoCommand->setText(i18np("1 image correlated",
                                                 "%1 images correlated",
                                                 d->correlationCorrelatedCount));
        emit(signalUndoCommand(d->correlationUndoCommand));
    }

    // enable the UI:
    emit(signalSetUIEnabled(true));
}
Exemple #29
0
void SearchWidget::slotMoveSelectedImagesToThisResult()
{
    const QModelIndex currentIndex = d->searchResultsSelectionModel->currentIndex();
    const SearchResultModel::SearchResultItem currentItem = d->searchResultsModel->resultItem(currentIndex);
    const KMap::GeoCoordinates& targetCoordinates = currentItem.result.coordinates;

    const QModelIndexList selectedImageIndices = d->kipiImageSelectionModel->selectedRows();
    if (selectedImageIndices.isEmpty())
        return;

    GPSUndoCommand* const undoCommand = new GPSUndoCommand();
    for (int i=0; i<selectedImageIndices.count(); ++i)
    {
        const QPersistentModelIndex itemIndex = selectedImageIndices.at(i);
        KipiImageItem* const item = d->kipiImageModel->itemFromIndex(itemIndex);

        GPSUndoCommand::UndoInfo undoInfo(itemIndex);
        undoInfo.readOldDataFromItem(item);        

        GPSDataContainer newData;
        newData.setCoordinates(targetCoordinates);
        item->setGPSData(newData);

        undoInfo.readNewDataFromItem(item);

        undoCommand->addUndoInfo(undoInfo);
    }
    undoCommand->setText(i18np("1 image moved to '%2'",
                               "%1 images moved to '%2'", selectedImageIndices.count(), currentItem.result.name));

    emit(signalUndoCommand(undoCommand));
}
Exemple #30
0
K3b::MixedBurnDialog::MixedBurnDialog( K3b::MixedDoc* doc, QWidget *parent )
    : K3b::ProjectBurnDialog( doc, parent ),
      m_doc(doc)
{
    prepareGui();

    setTitle( i18n("Mixed Project"), i18np("1 track (%2 minutes)",
                                           "%1 tracks (%2 minutes)",
                                           m_doc->numOfTracks(),m_doc->length().toString()) );

    m_checkOnlyCreateImage->hide();

    // create cd-text page
    m_cdtextWidget = new K3b::AudioCdTextWidget( this );
    addPage( m_cdtextWidget, i18n("CD-Text") );

    // create image settings tab
    m_imageSettingsWidget = new K3b::DataImageSettingsWidget( this );
    addPage( m_imageSettingsWidget, i18n("Filesystem") );

    setupSettingsPage();

    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
    m_optionGroupLayout->addItem( spacer );

    connect( m_checkNormalize, SIGNAL(toggled(bool)), this, SLOT(slotNormalizeToggled(bool)) );
    connect( m_checkCacheImage, SIGNAL(toggled(bool)), this, SLOT(slotCacheImageToggled(bool)) );
    connect( m_writerSelectionWidget, SIGNAL(writingAppChanged(K3b::WritingApp)), this, SLOT(slotToggleAll()) );
    connect( m_writingModeWidget, SIGNAL(writingModeChanged(WritingMode)), this, SLOT(slotToggleAll()) );
}