예제 #1
0
CharacterModule::CharacterModule() : characterPortrait(NULL)
{
   characterStats = new gcn::contrib::AdjustingContainer();
   characterNameLabel = new edwt::Label();
   characterHPLabel = new edwt::Label();
   characterSPLabel = new edwt::Label();

   characterNameLabel->setForegroundColor(0xFFFFFF);
   characterHPLabel->setForegroundColor(0xFFFFFF);
   characterSPLabel->setForegroundColor(0xFFFFFF);

   characterPortrait = new edwt::Icon();

   characterStats->setNumberOfColumns(1);
   characterStats->setColumnAlignment(0, gcn::contrib::AdjustingContainer::LEFT);
   characterStats->add(characterNameLabel);
   characterStats->add(characterHPLabel);
   characterStats->add(characterSPLabel);
   characterStats->setOpaque(false);

   setNumberOfColumns(2);
   setColumnAlignment(0, gcn::contrib::AdjustingContainer::LEFT);
   setColumnAlignment(1, gcn::contrib::AdjustingContainer::RIGHT);
   setHorizontalSpacing(10);
   setPadding(5, 5, 5, 5);

   add(characterPortrait);
   add(characterStats);
   addMouseListener(this);
   setOpaque(false);
}
SourceDirTree::SourceDirTree( QWidget* parent, KPhotoBook* photobook, const char* name )
    : KListView( parent, name )
    , m_photobook(photobook)
    , m_sourceDirNodeDict(new QIntDict<TagTreeNodeSourceDir>) {
    // create columns
    addColumn(i18n("Source directories"));
    addColumn(i18n("Selected"));
    addColumn(i18n("Included"));

    // we set the alignment to center to force redrawing the wohle cell always
    setColumnAlignment (COLUMN_TEXT, Qt::AlignLeft);
    setColumnAlignment (COLUMN_SELECTED, Qt::AlignCenter);
    setColumnAlignment (COLUMN_INCLUDED, Qt::AlignCenter);

    // we want that the first column gets as big as possible
    header()->setStretchEnabled( true, 0);

    setSelectionMode(QListView::NoSelection);

    // the root node must be closeable
    setRootIsDecorated(true);

    // append a listener for mouseclicks... ;-)
    QObject::connect(this, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int)),
                     this, SLOT(slotListViewClicked(int, QListViewItem*, const QPoint&, int)));
    QObject::connect(this, SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int)),
                     this, SLOT(slotListViewDoubleClicked(QListViewItem*, const QPoint&, int)));
}
예제 #3
0
KfindWindow::KfindWindow(QWidget *parent, const char *name) : KListView(parent, name), m_baseDir(""), m_menu(0)
{
    setSelectionMode(QListView::Extended);
    setShowSortIndicator(TRUE);

    addColumn(i18n("Name"));
    addColumn(i18n("In Subfolder"));
    addColumn(i18n("Size"));
    setColumnAlignment(2, AlignRight);
    addColumn(i18n("Modified"));
    setColumnAlignment(3, AlignRight);
    addColumn(i18n("Permissions"));
    setColumnAlignment(4, AlignRight);

    addColumn(i18n("First Matching Line"));
    setColumnAlignment(5, AlignLeft);

    // Disable autoresize for all columns
    // Resizing is done by resetColumns() function
    for(int i = 0; i < 6; i++)
        setColumnWidthMode(i, Manual);

    resetColumns(true);

    connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionHasChanged()));

    connect(this, SIGNAL(contextMenu(KListView *, QListViewItem *, const QPoint &)), this,
            SLOT(slotContextMenu(KListView *, QListViewItem *, const QPoint &)));

    connect(this, SIGNAL(executed(QListViewItem *)), this, SLOT(slotExecute(QListViewItem *)));
    setDragEnabled(true);
}
 toProfilerSource(QWidget *parent)
         : toResultLong(true, false, toQuery::Normal, parent)
 {
     setColumnAlignment(1, Qt::AlignRight);
     setColumnAlignment(2, Qt::AlignRight);
     setColumnAlignment(3, Qt::AlignRight);
     setColumnAlignment(4, Qt::AlignRight);
     clearTotals();
 }
예제 #5
0
int
ListView::addCheckColumn(const QString& label)
{
    int column = addColumn(label, qApp->fontMetrics().width(label + "_"));
    setColumnAlignment(column, AlignCenter);
    return column;
}
예제 #6
0
KMMimePartTree::KMMimePartTree( KMReaderWin* readerWin,
                                QWidget* parent,
                                const char* name )
    : KListView(  parent, name ),
      mReaderWin( readerWin ), mSizeColumn(0)
{
    setStyleDependantFrameWidth();
    addColumn( i18n("Description") );
    addColumn( i18n("Type") );
    addColumn( i18n("Encoding") );
    mSizeColumn = addColumn( i18n("Size") );
    setColumnAlignment( 3, Qt::AlignRight );

    restoreLayoutIfPresent();
    connect( this, SIGNAL( clicked( QListViewItem* ) ),
             this, SLOT( itemClicked( QListViewItem* ) ) );
    connect( this, SIGNAL( contextMenuRequested( QListViewItem*,
                                                 const QPoint&, int ) ),
             this, SLOT( itemRightClicked( QListViewItem*, const QPoint& ) ) );
    setSelectionMode( QListView::Extended );
    setRootIsDecorated( false );
    setAllColumnsShowFocus( true );
    setShowToolTips( true );
    setSorting(-1);
    setDragEnabled( true );
}
예제 #7
0
void toResultLong::query(const QString &sql, const toQueryParams &param)
{
    setSqlAndParams(sql, param);
    slotStop();
    Query = NULL;
    LastItem = NULL;
    RowNumber = 0;
    First = true;

    clear();

    setSorting( -1);

    if (NumberColumn)
    {
        addColumn(QString::fromLatin1("#"));
        setColumnAlignment(0, Qt::AlignRight);
    }

    if (Filter)
        Filter->startingQuery();

    try
    {
        Query = new toEventQuery(this
                                 , connection()
                                 , sql
                                 , param
                                 //, Statistics
                                 , toEventQuery::READ_ALL
                                );
        connect(Query, SIGNAL(dataAvailable(toEventQuery*)), this, SLOT(slotAddItem()));
        connect(Query, SIGNAL(done(toEventQuery*)), this, SLOT(slotQueryDone()));
        if (ReadAll)
        {
            MaxNumber = -1;
            //// Query->slotReadAll(); // indicate that all records should be fetched
        }
        else
            MaxNumber = toConfigurationNewSingle::Instance().option(ToConfiguration::Database::InitialFetchInt).toInt();
        Query->start();
    }
    catch (const toConnection::exception &str)
    {
        First = false;
        emit firstResult(toResult::sql(), str, true);
        emit done();
        //// if (Mode != toQuery::Long)
        Utils::toStatusMessage(str);
    }
    catch (const QString &str)
    {
        First = false;
        emit firstResult(toResult::sql(), str, true);
        emit done();
        //// if (Mode != toQuery::Long)
        Utils::toStatusMessage(str);
    }
    updateContents();
}
예제 #8
0
CoverageView::CoverageView(bool showCallers, TraceItemView* parentView,
			   QWidget* parent, const char* name)
  : QListView(parent, name), TraceItemView(parentView)
{
    _showCallers = showCallers;


    addColumn( i18n( "Incl." ) );
    if (_showCallers) {
	addColumn( i18n( "Distance" ) );
	addColumn( i18n( "Called" ) );
	addColumn( i18n( "Caller" ) );
    }
    else {
	addColumn( i18n( "Self" ) );
	addColumn( i18n( "Distance" ) );
	addColumn( i18n( "Calling" ) );
	addColumn( i18n( "Callee" ) );
	setColumnAlignment(3, Qt::AlignRight);
    }

    setSorting(0,false);
    setColumnAlignment(0, Qt::AlignRight);
    setColumnAlignment(1, Qt::AlignRight);
    setColumnAlignment(2, Qt::AlignRight);
    setAllColumnsShowFocus(true);
    setResizeMode(QListView::LastColumn);
    setMinimumHeight(50);

    connect( this,
	     SIGNAL( selectionChanged(QListViewItem*) ),
	     SLOT( selectedSlot(QListViewItem*) ) );

    connect( this,
	     SIGNAL(contextMenuRequested(QListViewItem*, const QPoint &, int)),
	     SLOT(context(QListViewItem*, const QPoint &, int)));

    connect(this,
	    SIGNAL(doubleClicked(QListViewItem*)),
	    SLOT(activatedSlot(QListViewItem*)));

    connect(this,
	    SIGNAL(returnPressed(QListViewItem*)),
	    SLOT(activatedSlot(QListViewItem*)));

    QWhatsThis::add( this, whatsThis() );
}
예제 #9
0
int
ListView::addTextColumn(const QString& label, int length, int align)
{
    char ch = (align == AlignRight) ? '9' : 'x';
    int column = addColumn(label, qApp->fontMetrics().width(ch) * length + 5);
    setColumnAlignment(column, align);
    return column;
}
예제 #10
0
int
ListView::addPriceColumn(const QString& label)
{
    QString widest = MoneyValcon().format(fixed(99999999.99)) + "__";
    int column = addColumn(label, qApp->fontMetrics().width(widest),
			   new PriceValcon());
    setColumnAlignment(column, AlignRight);
    return column;
}
예제 #11
0
BrowserView::BrowserView(QWidget * parent)
    : Q3ListView(parent), lbl(0), need_update(FALSE), cant_update(FALSE) {
  nodes.resize(DICT_SIZE);
  
  setSorting(-1);		// manual sorting
  addColumn("browser          ");	// will be changed
  addColumn("Rev.");
  addColumn("Modified by");
  setColumnWidthMode(0, Maximum);
  setColumnWidthMode(1, Maximum);
  setColumnWidthMode(2, Maximum);
  setColumnAlignment(1, ::Qt::AlignHCenter);
  setColumnAlignment(2, ::Qt::AlignHCenter);
  setTreeStepSize(18);
  
  connect(this, SIGNAL(selectionChanged(Q3ListViewItem *)),
	  this, SLOT(select(Q3ListViewItem *)));
}
예제 #12
0
int
ListView::addPercentColumn(const QString& label, int digits)
{
    fixed value = pow(10.0, digits) - .01;
    QString widest = PercentValcon().format(value) + "__";
    int column = addColumn(label, qApp->fontMetrics().width(widest),
			   new PercentValcon());
    setColumnAlignment(column, AlignRight);
    return column;
}
예제 #13
0
int
ListView::addNumberColumn(const QString& label, int digits)
{
    fixed value = pow(10.0, digits) - 1;
    QString text = NumberValcon().format(value);
    int column = addColumn(label, qApp->fontMetrics().width(text),
			   new NumberValcon());
    setColumnAlignment(column, AlignRight);
    return column;
}
예제 #14
0
 CommentsView(CommentsModel* model, Wt::WContainerWidget* p=0):
     Wt::WTableView(p) {
     setModel(model);
     setSortingEnabled(false);
     resize(770, 450);
     if (model->deleted_column != -1) {
         setColumnWidth(model->deleted_column, 20);
     }
     setColumnWidth(model->index_column, 40);
     setColumnWidth(model->text_column, model->deleted_column != -1 ? 660 : 700);
     setHeaderHeight(0);
     setRowHeight(ROW_HEIGHT);
     if (model->deleted_column != -1) {
         setColumnAlignment(model->deleted_column, Wt::AlignRight | Wt::AlignTop);
     }
     setColumnAlignment(model->index_column, Wt::AlignRight | Wt::AlignTop);
     setColumnAlignment(model->text_column, Wt::AlignLeft | Wt::AlignTop);
     addStyleClass("facts-commentsview");
 }
DBGProfileListView::DBGProfileListView(QWidget *parent, const char *name)
    : KListView(parent, name), m_view(ModuleView)
{
  setSorting(-1);
  setAllColumnsShowFocus(true);
  setRootIsDecorated(true);

  addColumn("Location");
  addColumn("Line");
  addColumn("Hits");
  addColumn("Avarage time (ms)");
  addColumn("Total time (ms)");
  addColumn("Min time (ms)");
  addColumn("Max time (ms)");
  //   addColumn("Chart");

  setColumnAlignment(LineCol, Qt::AlignHCenter);
  setColumnAlignment(HitsCol, Qt::AlignHCenter);
  setColumnAlignment(AvgCol, Qt::AlignHCenter);
  setColumnAlignment(TotalCol, Qt::AlignHCenter);
  setColumnAlignment(MinCol, Qt::AlignHCenter);
  setColumnAlignment(MaxCol, Qt::AlignHCenter);

  connect(this, SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int )),
          this, SLOT(slotDoubleClick(QListViewItem *, const QPoint &, int )));
  
}
예제 #16
0
CostTypeView::CostTypeView(TraceItemView* parentView,
			   QWidget* parent, const char* name)
  : QListView(parent, name), TraceItemView(parentView)
{
    addColumn( i18n( "Event Type" ) );
    addColumn( i18n( "Incl." ) );
    addColumn( i18n( "Self" ) );
    addColumn( i18n( "Short" ) );
    addColumn( QString::null );
    addColumn( i18n( "Formula" ) );

    setSorting(-1);
    setAllColumnsShowFocus(true);
    setColumnAlignment(1, Qt::AlignRight);
    setColumnAlignment(2, Qt::AlignRight);
    setColumnAlignment(3, Qt::AlignRight);
    setMinimumHeight(50);

    connect( this,
	     SIGNAL( selectionChanged(QListViewItem*) ),
	     SLOT( selectedSlot(QListViewItem*) ) );

    connect( this,
	     SIGNAL(contextMenuRequested(QListViewItem*, const QPoint &, int)),
	     SLOT(context(QListViewItem*, const QPoint &, int)));

    connect(this,
	    SIGNAL(doubleClicked(QListViewItem*)),
	    SLOT(activatedSlot(QListViewItem*)));

    connect(this,
	    SIGNAL(returnPressed(QListViewItem*)),
	    SLOT(activatedSlot(QListViewItem*)));

    connect(this,
	    SIGNAL(itemRenamed(QListViewItem*,int,const QString&)),
	    SLOT(renamedSlot(QListViewItem*,int,const QString&)));

    QWhatsThis::add( this, whatsThis() );
}
예제 #17
0
SourceView::SourceView(TraceItemView* parentView,
                       QWidget* parent, const char* name)
  : QListView(parent, name), TraceItemView(parentView)
{
  _inSelectionUpdate = false;

  _arrowLevels = 0;
  _lowList.setSortLow(true);
  _highList.setSortLow(false);

  addColumn( i18n( "#" ) );
  addColumn( i18n( "Cost" ) );
  addColumn( i18n( "Cost 2" ) );
  addColumn( "" );
  addColumn( i18n( "Source (unknown)" ) );

  setAllColumnsShowFocus(true);
  setColumnAlignment(0, Qt::AlignRight);
  setColumnAlignment(1, Qt::AlignRight);
  setColumnAlignment(2, Qt::AlignRight);
  setResizeMode(QListView::LastColumn);

  connect(this,
          SIGNAL(contextMenuRequested(QListViewItem*, const QPoint &, int)),
          SLOT(context(QListViewItem*, const QPoint &, int)));

  connect(this,
          SIGNAL(selectionChanged(QListViewItem*)),
          SLOT(selectedSlot(QListViewItem*)));

  connect(this,
          SIGNAL(doubleClicked(QListViewItem*)),
          SLOT(activatedSlot(QListViewItem*)));

  connect(this,
          SIGNAL(returnPressed(QListViewItem*)),
          SLOT(activatedSlot(QListViewItem*)));

  QWhatsThis::add( this, whatsThis());
}
예제 #18
0
////////////////////////////////////////
///  view
KMPopHeadersView::KMPopHeadersView(QWidget *aParent, KMPopFilterCnfrmDlg *aDialog)
    : KListView(aParent)
{
    mDialog = aDialog;
    int mDownIndex = addColumn(QIconSet(QPixmap(mDown)), QString::null, 24);
    assert(mDownIndex == Down);   //This code relies on the fact that radiobuttons are the first three columns for easier Column-Action mapping
    //it does not necessarily be true - you could redefine mapToColumn and mapToAction to eg. shift those numbers by 1
    addColumn(QIconSet(QPixmap(mLater)), QString::null, 24);
    addColumn(QIconSet(QPixmap(mDel)), QString::null, 24);

    /*int subjCol =*/ addColumn(i18n("Subject"), 180);
    /*int sendCol =*/ addColumn(i18n("Sender"), 150);
    /*int recvCol =*/ addColumn(i18n("Receiver"), 150);
    int dateCol = addColumn(i18n("Date"), 120);
    int sizeCol = addColumn(i18n("Size"), 80);

    setAllColumnsShowFocus(true);

    setColumnAlignment(Down, Qt::AlignHCenter);
    setColumnAlignment(Later, Qt::AlignHCenter);
    setColumnAlignment(Delete, Qt::AlignHCenter);
    setColumnAlignment(sizeCol, Qt::AlignRight);

    setSorting(dateCol, false);
    setShowSortIndicator(true);
    header()->setResizeEnabled(false, Down);
    header()->setResizeEnabled(false, Later);
    header()->setResizeEnabled(false, Delete);
    header()->setClickEnabled(false, Down);
    header()->setClickEnabled(false, Later);
    header()->setClickEnabled(false, Delete);

    //we rely on fixed column order, so we forbid this
    header()->setMovingEnabled(false);

    connect(this, SIGNAL(pressed(QListViewItem *, const QPoint &, int)),
            SLOT(slotPressed(QListViewItem *, const QPoint &, int)));
}
예제 #19
0
TemplateListView::TemplateListView(bool includeCmdAlarms, const QString& whatsThisText, QWidget* parent, const char* name)
	: EventListViewBase(parent, name),
	  mWhatsThisText(whatsThisText),
	  mIconColumn(0),
	  mNameColumn(1),
	  mExcludeCmdAlarms(!includeCmdAlarms)
{
	addColumn(QString::null);          // icon column
	addLastColumn(i18n("Name"));
	setSorting(mNameColumn);           // sort initially by name
	setColumnAlignment(mIconColumn, Qt::AlignHCenter);
	setColumnWidthMode(mIconColumn, QListView::Maximum);

	mInstanceList.append(this);
}
예제 #20
0
void ScoresList::addLineItem(const ItemArray &items,
                             uint index, QListViewItem *line)
{
    uint k = 0;
    for (uint i=0; i<items.size(); i++) {
        const ItemContainer &container = *items[i];
        if ( !container.item()->isVisible() ) continue;
        if (line) line->setText(k, itemText(container, index));
        else {
            addColumn( container.item()->label() );
            setColumnAlignment(k, container.item()->alignment());
        }
        k++;
    }
}
예제 #21
0
FtpView::FtpView( QWidget *parent )
    : QListView( parent )
{
    addColumn( tr( "Name" ) );
    addColumn( tr( "Size" ) );
    addColumn( tr( "Last Modified" ) );
    setColumnAlignment( 1, Qt::AlignRight );
    setShowSortIndicator( TRUE );
    setAllColumnsShowFocus( TRUE );
    setSelectionMode( Extended );

    connect( this, SIGNAL( doubleClicked( QListViewItem * ) ),
	     this, SLOT( slotSelected( QListViewItem * ) ) );
    connect( this, SIGNAL( returnPressed( QListViewItem * ) ),
	     this, SLOT( slotSelected( QListViewItem * ) ) );
}
toResultStorage::toResultStorage(bool available, QWidget *parent, const char *name)
        : toResultView(false, false, parent, name), AvailableGraph(available)
{
    Unit = toConfigurationSingle::Instance().sizeUnit();
    setAllColumnsShowFocus(true);
    setSortingEnabled(false); // enable it after data fetch
    setRootIsDecorated(true);
    addColumn(tr("Name"));
    addColumn(tr("Status"));
    addColumn(tr("Information"));
    addColumn(tr("Contents"));
    addColumn(tr("Logging"));
    addColumn(tr("Size (%1)").arg(Unit));
    addColumn(tr("Free (%1)").arg(Unit));
    addColumn(tr("Free (%)"));
    addColumn(tr("Autoextend (%1)").arg(Unit));
    if (available)
        addColumn(tr("Used/Free/Autoextend"));
    else
        addColumn(tr("Available"));
    addColumn(tr("Coalesced"));
    addColumn(tr("Max free (%1)").arg(Unit));
    addColumn(tr("Free fragments"));
    setSQLName(tr("toResultStorage"));

    setColumnAlignment(COL_SIZE, Qt::AlignRight);
    setColumnAlignment(COL_FREE_UNIT, Qt::AlignRight);
    setColumnAlignment(COL_FREE_PERCENT, Qt::AlignRight);
    setColumnAlignment(COL_AUTOEXT, Qt::AlignCenter);
    setColumnAlignment(COL_USED_FREE_AUTO, Qt::AlignCenter);
    setColumnAlignment(COL_COALESCED, Qt::AlignRight);
    setColumnAlignment(COL_MAX_FREE, Qt::AlignRight);
    setColumnAlignment(COL_FREE_FRAGMENTS, Qt::AlignRight);

    ShowCoalesced = false;
    OnlyFiles = false;

    Tablespaces = Files = NULL;

    connect(&Poll, SIGNAL(timeout()), this, SLOT(poll()));
    setItemDelegate(new toResultStorageItemDelegate());
}
예제 #23
0
//-----MsgView::constructor------------------------------------------------------------------------
MsgView::MsgView (QWidget *parent)
  : QListView(parent, "MessageView"), QToolTip(viewport())
{
  addColumn(tr("D"), 20);
  addColumn(tr("Event Type"), 100);
  addColumn(tr("Options"), 50);
  addColumn(tr("Time"), 130);
  setAllColumnsShowFocus (true);
  setColumnAlignment(0, AlignHCenter);
  setVScrollBarMode(AlwaysOn);
  setHScrollBarMode(AlwaysOff);
  setSorting(-1);
  connect(this, SIGNAL(sizeChange( int, int, int )), this, SLOT(handleSizeChange( int, int, int )) );
  header()->hide();

  QPalette pal(QListView::palette());
  QColor c = pal.color(QPalette::Active, QColorGroup::Background);
  pal.setColor(QPalette::Active, QColorGroup::Base, c);
  pal.setColor(QPalette::Inactive, QColorGroup::Base, c);
  QListView::setPalette(pal);

  setFrameStyle(QFrame::Panel | QFrame::Sunken);
  setMinimumHeight(40);
}
예제 #24
0
CFileList::CFileList( QWidget* parent, const char* name )
	: Q3ListView( parent, name )
#else
CFileList::CFileList( QWidget* parent, const char* name )
	: QListView( parent, name )
#endif
{
	resize( 310,230 );
	setMinimumSize( 0, 0 );
	setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	setFocusPolicy( Qt::TabFocus );
	setBackgroundMode( Qt::PaletteBackground );
#else
	setFocusPolicy( QWidget::TabFocus );
	setBackgroundMode( QWidget::PaletteBackground );
#endif
	setFrameStyle( QFrame::Box | QFrame::Raised );
#ifdef QT_V4LAYOUT
	setResizePolicy( Q3ScrollView::Manual );
	setVScrollBarMode( Q3ScrollView::Auto );
	setHScrollBarMode( Q3ScrollView::Auto );
#else
	setResizePolicy( QScrollView::Manual );
	setVScrollBarMode( QScrollView::Auto );
	setHScrollBarMode( QScrollView::Auto );
#endif
	setTreeStepSize( 20 );
	setMultiSelection( FALSE );
	setAllColumnsShowFocus( TRUE );
	setItemMargin( 1 );
	setRootIsDecorated( FALSE );
	addColumn( "File Name", -1 );
#ifdef QT_V4LAYOUT
	setColumnWidthMode( 0, Q3ListView::Maximum );
#else
	setColumnWidthMode( 0, QListView::Maximum );
#endif
	setColumnAlignment( 0, 1 );
	addColumn( "Permissions", -1 );
#ifdef QT_V4LAYOUT
	setColumnWidthMode( 1, Q3ListView::Maximum );
#else
	setColumnWidthMode( 1, QListView::Maximum );
#endif
	setColumnAlignment( 1, 1 );
	addColumn( "Owner", -1 );
#ifdef QT_V4LAYOUT
	setColumnWidthMode( 2, Q3ListView::Maximum );
#else
	setColumnWidthMode( 2, QListView::Maximum );
#endif
	setColumnAlignment( 2, 1 );
	addColumn( "Group", -1 );
#ifdef QT_V4LAYOUT
	setColumnWidthMode( 3, Q3ListView::Maximum );
#else
	setColumnWidthMode( 3, QListView::Maximum );
#endif
	setColumnAlignment( 3, 1 );
	addColumn( "Size", -1 );
#ifdef QT_V4LAYOUT
	setColumnWidthMode( 4, Q3ListView::Maximum );
#else
	setColumnWidthMode( 4, QListView::Maximum );
#endif
	setColumnAlignment( 4, 1 );
}
예제 #25
0
AlarmListView::AlarmListView(const QValueList<int> &order, QWidget *parent, const char *name)
    : EventListViewBase(parent, name),
      mMousePressed(false),
      mDrawMessageInColour(false),
      mShowExpired(false)
{
    static QString titles[COLUMN_COUNT] =
    {
        i18n("Time"),
        i18n("Time To"),
        i18n("Repeat"),
        QString::null,
        QString::null,
        i18n("Message, File or Command")
    };

    setSelectionMode(QListView::Extended);

    // Set the column order
    int i;
    bool ok = false;
    if(order.count() >= COLUMN_COUNT)
    {
        // The column order is specified
        bool posns[COLUMN_COUNT];
        for(i = 0;  i < COLUMN_COUNT;  ++i)
            posns[i] = false;
        for(i = 0;  i < COLUMN_COUNT;  ++i)
        {
            int ord = order[i];
            if(ord < COLUMN_COUNT  &&  ord >= 0)
            {
                mColumn[i] = ord;
                posns[ord] = true;
            }
        }
        ok = true;
        for(i = 0;  i < COLUMN_COUNT;  ++i)
            if(!posns[i])
                ok = false;
        if(ok  &&  mColumn[MESSAGE_COLUMN] != MESSAGE_COLUMN)
        {
            // Shift the message column to be last, since otherwise
            // column widths get screwed up.
            int messageCol = mColumn[MESSAGE_COLUMN];
            for(i = 0;  i < COLUMN_COUNT;  ++i)
                if(mColumn[i] > messageCol)
                    --mColumn[i];
            mColumn[MESSAGE_COLUMN] = MESSAGE_COLUMN;
        }
    }
    if(!ok)
    {
        // Either no column order was specified, or it was invalid,
        // so use the default order
        for(i = 0;  i < COLUMN_COUNT;  ++i)
            mColumn[i] = i;
    }

    // Initialise the columns
    for(i = 0;  i < COLUMN_COUNT;  ++i)
    {
        for(int j = 0;  j < COLUMN_COUNT;  ++j)
            if(mColumn[j] == i)
            {
                if(j != MESSAGE_COLUMN)
                    addColumn(titles[j]);
                break;
            }
    }
    addLastColumn(titles[MESSAGE_COLUMN]);

    setSorting(mColumn[TIME_COLUMN]);           // sort initially by date/time
    mTimeColumnHeaderWidth   = columnWidth(mColumn[TIME_COLUMN]);
    mTimeToColumnHeaderWidth = columnWidth(mColumn[TIME_TO_COLUMN]);
    setColumnAlignment(mColumn[REPEAT_COLUMN], Qt::AlignHCenter);
    setColumnWidthMode(mColumn[REPEAT_COLUMN], QListView::Maximum);

    // Set the width of the colour column in proportion to height
    setColumnWidth(mColumn[COLOUR_COLUMN], itemHeight() * 3 / 4);
    setColumnWidthMode(mColumn[COLOUR_COLUMN], QListView::Manual);

    // Set the width of the alarm type column to exactly accommodate the icons.
    // Don't allow the user to resize it (to avoid refresh problems, and bearing
    // in mind that resizing doesn't seem very useful anyway).
    setColumnWidth(mColumn[TYPE_COLUMN], AlarmListViewItem::typeIconWidth(this));
    setColumnWidthMode(mColumn[TYPE_COLUMN], QListView::Manual);
    header()->setResizeEnabled(false, mColumn[TYPE_COLUMN]);

    mInstanceList.append(this);

    mTooltip = new AlarmListTooltip(viewport());
}
 toProfilerUnits(QWidget *parent)
         : toResultLong(true, false, toQuery::Normal, parent)
 {
     setColumnAlignment(3, Qt::AlignRight);
     setSQL(SQLListUnits);
 }
예제 #27
0
void toResultLong::slotAddItem(void)
{
    if (!Utils::toCheckModal(this))
        return;

    try
    {
        while (Query->hasMore())
        {
            bool em = false; // should we emit signal about first row fetched?
            QString buffer;
            if (First)
            {
                QString tmp = sql().simplified().mid(0, 10).toLower();
                if (tmp.startsWith(QString::fromLatin1("update")) ||
                        tmp.startsWith(QString::fromLatin1("delete")) ||
                        tmp.startsWith(QString::fromLatin1("insert")))
                    buffer = tr("%1 rows processed").arg(Query->rowsProcessed());
                else if (tmp.startsWith(QString::fromLatin1("select")))
                    buffer = tr("Query executed");
                else
                    buffer = tr("Statement executed");
                em = true;
            }
            if (!HasHeaders)
            {
                Description = Query->describe();
                bool hidden = false;

                for (toQColumnDescriptionList::iterator i = Description.begin(); i != Description.end(); i++)
                {
                    QString name = (*i).Name;
                    if (ReadableColumns)
                        Utils::toReadableColumn(name);
                    if (name.length() > 0 && name[0].toLatin1() != ' ')
                    {
                        if (hidden)
                            throw tr("Can only hide last column in query");
                        if (name[0].toLatin1() == '-')
                        {
                            addColumn(Utils::toTranslateMayby(sqlName(), name.right(name.length() - 1)));
                            setColumnAlignment(columns() - 1, Qt::AlignRight);
                        }
                        else
                        {
                            addColumn(Utils::toTranslateMayby(sqlName(), name));
                            if ((*i).AlignRight)
                                setColumnAlignment(columns() - 1, Qt::AlignRight);
                        }
                    }
                    else
                        hidden = true;
                }
                HasHeaders = true;

                setResizeMode(toTreeWidget::AllColumns);

                if (sortColumn() < 0)
                {
                    if (NumberColumn)
                        setSorting(0);
                    else
                        setSorting(Description.size());
                }
            }

            if (Query->hasMore())
            {
                int disp = 0;
                unsigned int cols = Description.size();
                if (NumberColumn)
                {
                    disp = 1;
                }
                do
                {
                    toTreeWidgetItem *last = LastItem;
                    LastItem = createItem(LastItem, QString::null);
                    if (NumberColumn)
                        LastItem->setText(0, QString::number(RowNumber + 1));
                    else
                        LastItem->setText(cols, QString::number(RowNumber + 1));
                    toResultViewItem *ri = dynamic_cast<toResultViewItem *>(LastItem);
                    toResultViewCheck *ci = dynamic_cast<toResultViewCheck *>(LastItem);
                    for (unsigned int j = 0; (j < cols || j == 0) && !Query->eof(); j++)
                    {
                        if (ri)
                            ri->setText(j + disp, (QString)Query->readValue());
                        else if (ci)
                            ci->setText(j + disp, (QString)Query->readValue());
                        else
                            LastItem->setText(j + disp, (QString)Query->readValue());
                    }
                    if (Filter && !Filter->check(LastItem))
                    {
                        delete LastItem;
                        LastItem = last;
                    }
                    else
                        RowNumber++;
                }
                while (Query->hasMore() && (MaxNumber < 0 || MaxNumber > RowNumber));
            }
            if (em)
            {
                First = false;
                emit firstResult(sql(), toConnection::exception(buffer), false);
            }
            if (!(MaxNumber < 0 || MaxNumber > RowNumber))
                Query->stop();
        }
    }
    catch (const toConnection::exception &str)
    {
        if (First)
        {
            First = false;
            emit firstResult(sql(), str, true);
            //// if (Mode != toQuery::Long)
            Utils::toStatusMessage(str);
        }
        else
            Utils::toStatusMessage(str);
        cleanup();
    }
    catch (const QString &str)
    {
        if (First)
        {
            First = false;
            emit firstResult(sql(), str, true);
            //// if (Mode != toQuery::Long)
            Utils::toStatusMessage(str);
        }
        else
            Utils::toStatusMessage(str);
        cleanup();
    }
}