Changeset 8671:d2f1a579613f in orange


Ignore:
Timestamp:
08/12/11 13:23:30 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
627bb978a66be995b4bb1594cc82af5923cd588f
Message:

Fix compilation on Windows

Location:
source/orangeqt
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • source/orangeqt/networkcurve.cpp

    r8669 r8671  
    2626#include <QStyleOptionGraphicsItem> 
    2727#include <QCoreApplication> 
     28 
     29#include <QtCore/QTime> 
    2830 
    2931/************/ 
     
    392394    double step = 2 * PI / m_nodes.size(); 
    393395 
    394     srand(time(NULL)); 
     396    qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); 
    395397    std::vector<int> vertices; 
    396398    Nodes::ConstIterator it; 
     
    648650    //clock_t refresh_time = clock() + 0.05 * CLOCKS_PER_SEC; 
    649651 
    650     struct timeval time; 
    651     gettimeofday(&time, NULL); 
    652     double refresh_time = time.tv_sec * 1000000 + time.tv_usec + 10000; 
    653  
     652    QTime refresh_time = QTime::currentTime(); 
    654653    for (i = 0; i < steps; ++i) 
    655654    { 
     
    740739        } 
    741740 
    742         gettimeofday(&time, NULL); 
    743         if (time.tv_sec * 1000000 + time.tv_usec > refresh_time && i % 2 == 0) 
     741        QTime before_refresh_time = QTime::currentTime(); 
     742        if (before_refresh_time > refresh_time && i % 2 == 0) 
    744743        { 
    745744            update_properties(); 
    746  
    747             gettimeofday(&time, NULL); 
    748             double start_time = time.tv_sec * 1000000 + time.tv_usec; 
    749745            QCoreApplication::processEvents(); 
    750             gettimeofday(&time, NULL); 
    751             double refresh_duration = time.tv_sec * 1000000 + time.tv_usec - start_time; 
    752             double next_refresh = qMax(refresh_duration * 2, 10000.0); 
    753             gettimeofday(&time, NULL); 
    754             //qDebug() << "next refresh: " << next_refresh; 
    755             refresh_time = time.tv_sec * 1000000 + time.tv_usec + next_refresh; 
     746            int refresh_duration = before_refresh_time.msecsTo(QTime::currentTime()); 
     747 
     748            refresh_time = before_refresh_time.addMSecs(qMax(refresh_duration * 3, 10)); 
    756749        } 
    757750        if (m_stop_optimization) 
  • source/orangeqt/networkcurve.h

    r8669 r8671  
    2525#include <deque> 
    2626#include <algorithm> 
    27 #include <sys/time.h> 
    2827 
    2928class QueueVertex 
     
    134133}; 
    135134 
    136 struct EdgeItem : public QGraphicsLineItem 
     135class EdgeItem : public QGraphicsLineItem 
    137136{ 
    138137public: 
  • source/orangeqt/plot.cpp

    r8669 r8671  
    3434    // For speed, we use the slightly wrong method, also known as Manhattan distance 
    3535    return (one - other).manhattanLength(); 
    36 } 
    37  
    38 inline bool operator==(const DataPoint& one, const DataPoint& other) 
    39 { 
    40     return one.x == other.x && one.y == other.y; 
    4136} 
    4237 
  • source/orangeqt/point.cpp

    r8669 r8671  
    4848QDebug& operator<<(QDebug& stream, const DataPoint& point) 
    4949{ 
    50     stream.maybeSpace() << "DataPoint(" << point.x << ','<< point.y << ')'; 
     50    return stream.maybeSpace() << "DataPoint(" << point.x << ','<< point.y << ')'; 
    5151} 
    5252 
     
    267267QPainterPath Point::trianglePath(double d, double rot) { 
    268268    QPainterPath path; 
    269     path.moveTo(-d, d*sqrt(3)/3); 
    270     path.lineTo(d, d*sqrt(3)/3); 
    271     path.lineTo(0, -2*d*sqrt(3)/3); 
     269    path.moveTo(-d, d*sqrt(3.0)/3); 
     270    path.lineTo(d, d*sqrt(3.0)/3); 
     271    path.lineTo(0, -2*d*sqrt(3.0)/3); 
    272272    path.closeSubpath(); 
    273273    return QTransform().rotate(rot).map(path); 
Note: See TracChangeset for help on using the changeset viewer.