The dynasty had experienced tremendous social and political unrest in the years leading up to its fall. It had its prestige severely weakened by its inability to control commerce with Western powers and Japan, and the death of the Empress Cixi in 1908 left China basically rudderless. A series of military uprisings followed, and Sun Yat-Sen established a republic, even as the child emperor Puyi's advisors appeared ready to accept a constitutional monarchy.
Intense social, political, and military conflict were the immediate cause of the fall of the dynasty. However, even after the dynasty fell it was not entirely destroyed, because the young child who had been the last emperor survived, and he was twice put into "power" again, at different stages of his life. There is a great film about this whole matter called The Last Emperor.
It's a combination of foreign and domestic factors. The unequal treaties imposed on China did not help at all. They showed how weak the Qing were. But the Empress's unwillingness to try any reforms until it was too late made things worse. So it's pretty hard to say which was more important since the two fed on one another.
Trade was a massive factor in the downfall of the Qing Dynasty, particularly with Western powers and with other Asian nations such as Japan. This was a massive external factor that combined with other internal factors above to create an environment in which the dynasty collapsed.
The main reasons the Qing were based on both. Resistence was centered around sectors. There were local uprisings and ideas that stemmed from Western Culture and others abandoned Confucian examination system.