~ubuntu-branches/ubuntu/precise/fritzing/precise

« back to all changes in this revision

Viewing changes to src/partsbinpalette/binmanager/binmanager.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Georges Khaznadar
  • Date: 2011-08-26 10:11:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110826101105-w5hmn7zcf93ig5v6
Tags: 0.6.3b-1
* upgrapded to the newer upstream version
* parameters of the function GraphicsUtils::distanceFromLine in 
  src/svg/groundplanegenerator.cpp:767 are now declared as doubles,
  which Closes: #636441
* the new version fixes src/utils/folderutils.cpp, which
  Closes: #636061

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
********************************************************************
20
20
 
21
 
$Revision: 5143 $:
 
21
$Revision: 5391 $:
22
22
$Author: cohen@irascible.com $:
23
 
$Date: 2011-07-01 02:37:01 +0200 (Fri, 01 Jul 2011) $
 
23
$Date: 2011-08-12 14:13:30 +0200 (Fri, 12 Aug 2011) $
24
24
 
25
25
********************************************************************/
26
26
 
158
158
        bool retval = true;
159
159
 
160
160
        for(int i=0; i < m_stackWidget->count(); i++) {
161
 
                StackTabWidget *tw = dynamic_cast<StackTabWidget*>(m_stackWidget->widget(i));
 
161
                StackTabWidget *tw = qobject_cast<StackTabWidget*>(m_stackWidget->widget(i));
162
162
                if(tw) {
163
163
                        for(int j=0; j < tw->count(); j++) {
164
 
                                PartsBinPaletteWidget *bin = dynamic_cast<PartsBinPaletteWidget*>(tw->widget(j));
 
164
                                PartsBinPaletteWidget *bin = qobject_cast<PartsBinPaletteWidget*>(tw->widget(j));
165
165
                                if(bin) {
166
166
                                        setAsCurrentTab(bin);
167
167
                                        retval = retval && bin->beforeClosing();
391
391
}
392
392
 
393
393
void BinManager::currentChanged(StackTabWidget *tw, int index) {
394
 
        PartsBinPaletteWidget *bin = dynamic_cast<PartsBinPaletteWidget*>(tw->widget(index));
 
394
        PartsBinPaletteWidget *bin = qobject_cast<PartsBinPaletteWidget*>(tw->widget(index));
395
395
        if(bin) setAsCurrentBin(bin);
396
396
}
397
397
 
442
442
}
443
443
 
444
444
PartsBinPaletteWidget* BinManager::getBin(StackTabWidget* tb, int index) {
445
 
        return dynamic_cast<PartsBinPaletteWidget*>(tb->widget(index));
 
445
        return qobject_cast<PartsBinPaletteWidget*>(tb->widget(index));
446
446
}
447
447
 
448
448
PartsBinPaletteWidget* BinManager::currentBin(StackTabWidget* tb) {
459
459
        settings.remove("bins"); // clean up previous state
460
460
        settings.beginGroup("bins");
461
461
        for(int i=m_stackWidget->count()-1; i >= 0; i--) {
462
 
                StackTabWidget *tw = dynamic_cast<StackTabWidget*>(m_stackWidget->widget(i));
 
462
                StackTabWidget *tw = qobject_cast<StackTabWidget*>(m_stackWidget->widget(i));
463
463
                if(tw) {
464
464
                        bool groupBegan = false;
465
465
                        for(int j=tw->count()-1; j >= 0; j--) {
466
 
                                PartsBinPaletteWidget *bin = dynamic_cast<PartsBinPaletteWidget*>(tw->widget(j));
 
466
                                PartsBinPaletteWidget *bin = qobject_cast<PartsBinPaletteWidget*>(tw->widget(j));
467
467
                                if(bin) {
468
468
                                        if(!groupBegan) {
469
469
                                                settings.beginGroup(QString("%1").arg(i));
486
486
        if(settings.childGroups().size()==0) { // first time? open core and my_parts then
487
487
                StackTabWidget *tw = new StackTabWidget(m_stackWidget);
488
488
 
489
 
                m_mainWindow->fileProgressDialog()->setBinLoadingCount(2);
 
489
                m_mainWindow->fileProgressDialogSetBinLoadingCount(2);
490
490
 
491
491
                PartsBinPaletteWidget* core = newBin();
492
492
                core->load(BinManager::CorePartsBinLocation, m_mainWindow->fileProgressDialog());
504
504
                        settings.beginGroup(g);
505
505
 
506
506
                        StackTabWidget *tw = new StackTabWidget(m_stackWidget);
507
 
                        m_mainWindow->fileProgressDialog()->setBinLoadingCount(settings.childKeys().count());
 
507
                        m_mainWindow->fileProgressDialogSetBinLoadingCount(settings.childKeys().count());
508
508
                        foreach(QString k, settings.childKeys()) {
509
509
                                PartsBinPaletteWidget* bin = newBin();
510
510
                                QString filename = settings.value(k).toString();