Changeset 14150


Ignore:
Timestamp:
Jul 27, 2013, 9:58:14 PM (9 years ago)
Author:
jordan
Message:

support qt5 in transmission-qt

Location:
trunk/qt
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/README.txt

    r11138 r14150  
    3737BUILDING ON UNIX
    3838
    39    1. Prerequisites: Qt >= 4.6 and its development packages
     39   1. Prerequisites: Qt >= 5 and its development packages
    4040   2. Build Transmission as normal
    41    3. In the qt/ directory, type "qmake qtr.pro" or "qmake-qt4 qtr.pro"
     41   3. In the qt/ directory, type "qmake qtr.pro" or "qmake-qt5 qtr.pro"
    4242   4. In the qt/ directory, type "make"
    4343   5. In the qt/ directory, as root, type "INSTALL_ROOT=/usr make install"
  • trunk/qt/about.cc

    r13869 r14150  
    3838
    3939  l = new QLabel;
    40   l->setPixmap (QPixmap (QString::fromAscii (":/icons/transmission-48.png")));
     40  l->setPixmap (QPixmap (QString::fromUtf8 (":/icons/transmission-48.png")));
    4141  l->setAlignment (Qt::AlignCenter);
    4242  v->addWidget (l);
     
    4545  f.setWeight (QFont::Bold);
    4646  f.setPointSize (int (f.pointSize () * 1.2));
    47   l = new QLabel (tr ("<big>Transmission %1</big>").arg (QString::fromAscii (LONG_VERSION_STRING)));
     47  l = new QLabel (tr ("<big>Transmission %1</big>").arg (QString::fromUtf8 (LONG_VERSION_STRING)));
    4848  l->setAlignment (Qt::AlignCenter);
    4949  l->setFont (f);
     
    5252
    5353  l = new QLabel (tr ("A fast and easy BitTorrent client"));
    54   l->setStyleSheet (QString::fromAscii ("text-align: center"));
     54  l->setStyleSheet (QString::fromUtf8 ("text-align: center"));
    5555  l->setAlignment (Qt::AlignCenter);
    5656  v->addWidget (l);
     
    6060  v->addWidget (l);
    6161
    62   l = new QLabel (QString::fromAscii ("<a href=\"http://www.transmissionbt.com/\">http://www.transmissionbt.com/</a>"));
     62  l = new QLabel (QString::fromUtf8 ("<a href=\"http://www.transmissionbt.com/\">http://www.transmissionbt.com/</a>"));
    6363  l->setOpenExternalLinks (true);
    6464  l->setAlignment (Qt::AlignCenter);
     
    9090    this,
    9191    tr ("Credits"),
    92     QString::fromAscii ("Jordan Lee (Backend; Daemon; GTK+; Qt)\n"
     92    QString::fromUtf8 ("Jordan Lee (Backend; Daemon; GTK+; Qt)\n"
    9393                        "Michell Livingston (OS X)\n"));
    9494}
  • trunk/qt/add-data.cc

    r13667 r14150  
    4444    else if( Utils::isHexHashcode( key ) )
    4545    {
    46         magnet = QString::fromAscii("magnet:?xt=urn:btih:") + key;
     46        magnet = QString::fromUtf8("magnet:?xt=urn:btih:") + key;
    4747        type = MAGNET;
    4848    }
  • trunk/qt/app.cc

    r14002 r14150  
    4646namespace
    4747{
    48   const QString DBUS_SERVICE     = QString::fromAscii ("com.transmissionbt.Transmission" );
    49   const QString DBUS_OBJECT_PATH = QString::fromAscii ("/com/transmissionbt/Transmission");
    50   const QString DBUS_INTERFACE   = QString::fromAscii ("com.transmissionbt.Transmission" );
     48  const QString DBUS_SERVICE     = QString::fromUtf8 ("com.transmissionbt.Transmission" );
     49  const QString DBUS_OBJECT_PATH = QString::fromUtf8 ("/com/transmissionbt/Transmission");
     50  const QString DBUS_INTERFACE   = QString::fromUtf8 ("com.transmissionbt.Transmission" );
    5151
    5252  const char * MY_READABLE_NAME ("transmission-qt");
     
    9090  myLastFullUpdateTime (0)
    9191{
    92   const QString MY_CONFIG_NAME = QString::fromAscii ("transmission");
     92  const QString MY_CONFIG_NAME = QString::fromUtf8 ("transmission");
    9393
    9494  setApplicationName (MY_CONFIG_NAME);
     
    109109  sizes << 16 << 22 << 24 << 32 << 48 << 64 << 72 << 96 << 128 << 192 << 256;
    110110  foreach (int size, sizes)
    111     icon.addPixmap (QPixmap (QString::fromAscii (":/icons/transmission-%1.png").arg (size)));
     111    icon.addPixmap (QPixmap (QString::fromUtf8 (":/icons/transmission-%1.png").arg (size)));
    112112  setWindowIcon (icon);
    113113
     
    465465MyApp :: notify (const QString& title, const QString& body) const
    466466{
    467   const QString dbusServiceName   = QString::fromAscii ("org.freedesktop.Notifications");
    468   const QString dbusInterfaceName = QString::fromAscii ("org.freedesktop.Notifications");
    469   const QString dbusPath          = QString::fromAscii ("/org/freedesktop/Notifications");
    470 
    471   QDBusMessage m = QDBusMessage::createMethodCall (dbusServiceName, dbusPath, dbusInterfaceName, QString::fromAscii ("Notify"));
     467  const QString dbusServiceName   = QString::fromUtf8 ("org.freedesktop.Notifications");
     468  const QString dbusInterfaceName = QString::fromUtf8 ("org.freedesktop.Notifications");
     469  const QString dbusPath          = QString::fromUtf8 ("/org/freedesktop/Notifications");
     470
     471  QDBusMessage m = QDBusMessage::createMethodCall (dbusServiceName, dbusPath, dbusInterfaceName, QString::fromUtf8 ("Notify"));
    472472  QList<QVariant> args;
    473   args.append (QString::fromAscii ("Transmission")); // app_name
     473  args.append (QString::fromUtf8 ("Transmission")); // app_name
    474474  args.append (0U);                                   // replaces_id
    475   args.append (QString::fromAscii ("transmission")); // icon
     475  args.append (QString::fromUtf8 ("transmission")); // icon
    476476  args.append (title);                                // summary
    477477  args.append (body);                                 // body
     
    511511                                                             DBUS_OBJECT_PATH,
    512512                                                             DBUS_INTERFACE,
    513                                                              QString::fromAscii ("AddMetainfo"));
     513                                                             QString::fromUtf8 ("AddMetainfo"));
    514514      QList<QVariant> arguments;
    515515      AddData a (addme[i]);
  • trunk/qt/details.cc

    r13943 r14150  
    868868            {
    869869              QString txt;
    870               switch (ch.toAscii ())
     870              switch (ch.unicode ())
    871871                {
    872872                  case 'O': txt = tr ("Optimistic unchoke"); break;
  • trunk/qt/favicon.cc

    r11522 r14150  
    1111 */
    1212
    13 #include <QDesktopServices>
    1413#include <QDir>
    1514#include <QNetworkAccessManager>
    1615#include <QNetworkReply>
    1716#include <QNetworkRequest>
     17#include <QStandardPaths>
    1818
    1919#include "favicon.h"
     
    4141Favicons :: getCacheDir( )
    4242{
    43     const QString base = QDesktopServices::storageLocation( QDesktopServices::CacheLocation );
     43    const QString base = QStandardPaths::writableLocation (QStandardPaths::CacheLocation);
    4444    return QDir( base ).absoluteFilePath( "favicons" );
    4545}
  • trunk/qt/file-tree.cc

    r14073 r14150  
    437437    {
    438438      QString oldpath;
    439       QModelIndex walk = index;
    440439      FileTreeItem * item = itemFromIndex (index);
    441440
     
    576575FileTreeModel :: clear ()
    577576{
     577  beginResetModel ();
    578578  clearSubtree (QModelIndex());
    579 
    580   reset ();
     579  endResetModel ();
    581580}
    582581
     
    614613  bool added = false;
    615614  FileTreeItem * item;
    616   QStringList tokens = filename.split (QChar::fromAscii('/'));
     615  QStringList tokens = filename.split (QChar::fromLatin1('/'));
    617616
    618617  item = findItemForFileIndex (fileIndex);
     
    887886    {
    888887      setColumnHidden (i, (i<FIRST_VISIBLE_COLUMN) || (LAST_VISIBLE_COLUMN<i));
    889       header()->setResizeMode(i, QHeaderView::Interactive);
     888      header()->setSectionResizeMode(i, QHeaderView::Interactive);
    890889    }
    891890
  • trunk/qt/filterbar.cc

    r13939 r14150  
    1111 */
    1212
     13#include <QAbstractItemView>
     14#include <QPushButton>
     15#include <QLabel>
     16#include <QHBoxLayout>
     17#include <QLineEdit>
     18#include <QStylePainter>
    1319#include <QString>
    1420#include <QtGui>
  • trunk/qt/freespace-label.cc

    r14064 r14150  
    7474FreespaceLabel :: onSessionExecuted (int64_t tag, const QString& result, struct tr_variant * arguments)
    7575{
     76  Q_UNUSED (result);
     77
    7678  if (tag != myTag)
    7779    return;
  • trunk/qt/freespace-label.h

    r13992 r14150  
    1717#include <QTimer>
    1818
    19 #include <QtGui/QLabel>
     19#include <QLabel>
    2020
    2121class Session;
  • trunk/qt/mainwin.cc

    r14098 r14150  
    1515
    1616#include <QtGui>
     17#include <QProxyStyle>
     18#include <QLabel>
     19#include <QFileDialog>
     20#include <QMessageBox>
    1721
    1822#include <libtransmission/transmission.h>
  • trunk/qt/make-dialog.cc

    r13859 r14150  
    2222#include <QLineEdit>
    2323#include <QList>
     24#include <QMimeData>
    2425#include <QPlainTextEdit>
    2526#include <QProgressBar>
     
    343344        QPushButton * b = new QPushButton;
    344345        b->setIcon( folderPixmap );
    345         b->setStyleSheet( QString::fromAscii( "text-align: left; padding-left: 5; padding-right: 5" ) );
     346        b->setStyleSheet( QString::fromUtf8( "text-align: left; padding-left: 5; padding-right: 5" ) );
    346347        myDestination = QDir::homePath();
    347348        b->setText( myDestination );
     
    357358        myFolderButton->setIcon( folderPixmap );
    358359        myFolderButton->setText( tr( "(None)" ) );
    359         myFolderButton->setStyleSheet( QString::fromAscii( "text-align: left; padding-left: 5; padding-right: 5" ) );
     360        myFolderButton->setStyleSheet( QString::fromUtf8( "text-align: left; padding-left: 5; padding-right: 5" ) );
    360361        connect( myFolderButton, SIGNAL(clicked(bool)),
    361362                 this, SLOT(onFolderClicked(void)) );
     
    372373        myFileButton->setText( tr( "(None)" ) );
    373374        myFileButton->setIcon( filePixmap );
    374         myFileButton->setStyleSheet( QString::fromAscii( "text-align: left; padding-left: 5; padding-right: 5" ) );
     375        myFileButton->setStyleSheet( QString::fromUtf8( "text-align: left; padding-left: 5; padding-right: 5" ) );
    375376        connect( myFileButton, SIGNAL(clicked(bool)),
    376377                 this, SLOT(onFileClicked(void)) );
     
    385386
    386387        hig->addWideControl( myTrackerEdit = new ShortPlainTextEdit );
    387         const int height = fontMetrics().size( 0, QString::fromAscii("\n\n\n\n") ).height( );
     388        const int height = fontMetrics().size( 0, QString::fromUtf8("\n\n\n\n") ).height( );
    388389        myTrackerEdit->setMinimumHeight( height );
    389390        hig->addTallRow( tr( "&Trackers:" ), myTrackerEdit );
  • trunk/qt/options.cc

    r14010 r14150  
    125125      p = mySourceButton =  new QPushButton;
    126126      p->setIcon (filePixmap);
    127       p->setStyleSheet (QString::fromAscii ("text-align: left; padding-left: 5; padding-right: 5"));
     127      p->setStyleSheet (QString::fromUtf8 ("text-align: left; padding-left: 5; padding-right: 5"));
    128128      p->installEventFilter (this);
    129129      w = p;
     
    140140    }
    141141
    142   const int width = fontMetrics.size (0, QString::fromAscii ("This is a pretty long torrent filename indeed.torrent")).width ();
     142  const int width = fontMetrics.size (0, QString::fromUtf8 ("This is a pretty long torrent filename indeed.torrent")).width ();
    143143  w->setMinimumWidth (width);
    144144  layout->addWidget (w, row, 1);
  • trunk/qt/prefs-dialog.cc

    r13991 r14150  
    2222#include <QFileInfo>
    2323#include <QHBoxLayout>
    24 #include <QHttp>
    2524#include <QIcon>
    2625#include <QLabel>
     
    136135    const int minutes( myPrefs.getInt( key ) );
    137136    QTimeEdit * e = new QTimeEdit( );
    138     e->setDisplayFormat( QString::fromAscii( "hh:mm" ) );
     137    e->setDisplayFormat( QString::fromUtf8( "hh:mm" ) );
    139138    e->setProperty( PREF_KEY, key );
    140139    e->setTime( QTime().addSecs( minutes * 60 ) );
     
    234233    h->setSpacing( HIG :: PAD );
    235234    QLabel * label = new QLabel;
    236     label->setPixmap( QPixmap( QString::fromAscii( ":/icons/alt-limit-off.png" ) ) );
     235    label->setPixmap( QPixmap( QString::fromUtf8( ":/icons/alt-limit-off.png" ) ) );
    237236    label->setAlignment( Qt::AlignLeft|Qt::AlignVCenter );
    238237    h->addWidget( label );
    239238    label = new QLabel( tr( "Alternative Speed Limits" ) );
    240     label->setStyleSheet( QString::fromAscii( "font: bold" ) );
     239    label->setStyleSheet( QString::fromUtf8( "font: bold" ) );
    241240    label->setAlignment( Qt::AlignLeft|Qt::AlignVCenter );
    242241    h->addWidget( label );
     
    573572        b = myWatchButton = new QPushButton;
    574573        b->setIcon( folderPixmap );
    575         b->setStyleSheet( QString::fromAscii( "text-align: left; padding-left: 5; padding-right: 5" ) );
     574        b->setStyleSheet( QString::fromUtf8( "text-align: left; padding-left: 5; padding-right: 5" ) );
    576575        connect( b, SIGNAL(clicked(bool)), this, SLOT(onWatchClicked(void)) );
    577576        hig->addRow( l, b );
     
    586585        b = myDestinationButton = new QPushButton;
    587586        b->setIcon( folderPixmap );
    588         b->setStyleSheet( QString::fromAscii( "text-align: left; padding-left: 5; padding-right: 5" ) );
     587        b->setStyleSheet( QString::fromUtf8( "text-align: left; padding-left: 5; padding-right: 5" ) );
    589588        connect( b, SIGNAL(clicked(bool)), this, SLOT(onDestinationClicked(void)) );
    590589        hig->addRow( tr( "Save to &Location:" ), b );
     
    611610        b = myIncompleteButton = new QPushButton;
    612611        b->setIcon( folderPixmap );
    613         b->setStyleSheet( QString::fromAscii( "text-align: left; padding-left: 5; padding-right: 5" ) );
     612        b->setStyleSheet( QString::fromUtf8( "text-align: left; padding-left: 5; padding-right: 5" ) );
    614613        connect( b, SIGNAL(clicked(bool)), this, SLOT(onIncompleteClicked(void)) );
    615614        hig->addRow( myIncompleteCheckbox, b );
     
    619618        b = myTorrentDoneScriptButton = new QPushButton;
    620619        b->setIcon( filePixmap );
    621         b->setStyleSheet( QString::fromAscii( "text-align: left; padding-left: 5; padding-right: 5" ) );
     620        b->setStyleSheet( QString::fromUtf8( "text-align: left; padding-left: 5; padding-right: 5" ) );
    622621        connect( b, SIGNAL(clicked(bool)), this, SLOT(onScriptClicked(void)) );
    623622        hig->addRow( myTorrentDoneScriptCheckbox, b );
  • trunk/qt/qtr.pro

    r13991 r14150  
    22NAME = "Transmission"
    33DESCRIPTION = "Transmission: a fast, easy, and free BitTorrent client"
    4 VERSION = 2.00
     4VERSION = 2.81
    55LICENSE = "GPL"
    66
     
    1212man.files = transmission-qt.1
    1313
    14 CONFIG += qt qdbus thread debug link_pkgconfig
    15 QT += network
     14CONFIG += qt thread debug link_pkgconfig
     15QT += network dbus widgets
    1616PKGCONFIG = fontconfig libcurl openssl libevent
    1717
  • trunk/qt/session.cc

    r13991 r14150  
    691691      QNetworkRequest request;
    692692      request.setUrl (myUrl);
    693       request.setRawHeader ("User-Agent", QString (QCoreApplication::instance ()->applicationName () + "/" + LONG_VERSION_STRING).toAscii ());
     693      request.setRawHeader ("User-Agent", QString (QCoreApplication::instance ()->applicationName () + "/" + LONG_VERSION_STRING).toUtf8 ());
    694694      request.setRawHeader ("Content-Type", "application/json; charset=UTF-8");
    695695
    696696      if (!mySessionId.isEmpty ())
    697         request.setRawHeader (TR_RPC_SESSION_ID_HEADER, mySessionId.toAscii ());
     697        request.setRawHeader (TR_RPC_SESSION_ID_HEADER, mySessionId.toUtf8 ());
    698698
    699699      const QByteArray requestData (json);
  • trunk/qt/squeezelabel.h

    r10943 r14150  
    4343#define SQUEEZELABEL_H
    4444
    45 #include <QtGui/QLabel>
     45#include <QLabel>
    4646
    4747class SqueezeLabel : public QLabel
  • trunk/qt/torrent-model.cc

    r13982 r14150  
    2323TorrentModel :: clear( )
    2424{
     25    beginResetModel ();
     26
    2527    myIdToRow.clear( );
    2628    myIdToTorrent.clear( );
    2729    foreach( Torrent * tor, myTorrents ) delete tor;
    2830    myTorrents.clear( );
    29     reset( );
     31
     32    endResetModel ();
    3033}
    3134
  • trunk/qt/utils.h

    r13448 r14150  
    4343        ///
    4444
    45         static bool isMagnetLink( const QString& s ) { return s.startsWith( QString::fromAscii( "magnet:?" ) ); }
     45        static bool isMagnetLink( const QString& s ) { return s.startsWith( QString::fromUtf8( "magnet:?" ) ); }
    4646
    4747        static bool isHexHashcode( const QString& s )
    4848        {
    4949            if( s.length() != 40 ) return false;
    50             foreach( QChar ch, s ) if( !isxdigit( ch.toAscii() ) ) return false;
     50            foreach( QChar ch, s ) if( !isxdigit( ch.unicode() ) ) return false;
    5151            return true;
    5252        }
     
    5454        static bool isUriWithSupportedScheme( const QString& s )
    5555        {
    56             static const QString ftp = QString::fromAscii( "ftp://" );
    57             static const QString http = QString::fromAscii( "http://" );
    58             static const QString https = QString::fromAscii( "https://" );
     56            static const QString ftp = QString::fromUtf8( "ftp://" );
     57            static const QString http = QString::fromUtf8( "http://" );
     58            static const QString https = QString::fromUtf8( "https://" );
    5959            return s.startsWith(http) || s.startsWith(https) || s.startsWith(ftp);
    6060        }
  • trunk/qt/watchdir.cc

    r12697 r14150  
    5353    if( err )
    5454        ret = ERROR;
    55     else if( myModel.hasTorrent( QString::fromAscii( inf.hashString ) ) )
     55    else if( myModel.hasTorrent( QString::fromUtf8( inf.hashString ) ) )
    5656        ret = DUPLICATE;
    5757    else
     
    107107    // try to add any new files which end in .torrent
    108108    const QSet<QString> newFiles( files - myWatchDirFiles );
    109     const QString torrentSuffix = QString::fromAscii( ".torrent" );
     109    const QString torrentSuffix = QString::fromUtf8( ".torrent" );
    110110    foreach( QString name, newFiles ) {
    111111        if( name.endsWith( torrentSuffix, Qt::CaseInsensitive ) ) {
Note: See TracChangeset for help on using the changeset viewer.